6

Using FZF in Vim, is it possible to search project directory and a library directory? For example when executing FZF, it would search directories:

~/project/ and ~/libs/include, and provide results.

Martin Tournoij
  • 62,054
  • 25
  • 192
  • 271
user1135541
  • 1,103
  • 8
  • 22

2 Answers2

3

You can specify the command to obtain the input of fzf by using the fzf#run() function. In your case, this can look something like this:

call fzf#run({'source': 'find ~/project/ ~/libs/include -type f', 
             \ 'sink':  'edit'})

and if you want, you can add a command like this

command! FZFLib call fzf#run({'source': 'find ~/project/ ~/libs/include -type f', 'sink':  'edit'})

The options of fzf#run() are listed on the fzf homepage

Ingo
  • 986
  • 1
  • 5
  • 11
-1

FZF will search the total pwd. If pwd is ~, both directories ~/project/ and ~/libs/include will be searched.

Martin Tournoij
  • 62,054
  • 25
  • 192
  • 271
Sol
  • 1
  • I'm pretty sure the OP doesn't want FZF to search through all the files in his home directory. – EvergreenTree Aug 06 '16 at 13:06
  • It's just a solution. And FZF search only one directory once. The two directories can be moved into the same directory. If you don't want to search though all the files in the directory, you can set FZF_DEFAULT_COMMAND with ag or find and ignore options or file to filter the other directories. – Sol Aug 09 '16 at 00:12