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.

2 Answers 2

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

0
-1

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

2
  • I'm pretty sure the OP doesn't want FZF to search through all the files in his home directory. Aug 6, 2016 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 9, 2016 at 0:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.