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


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


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

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

Your Answer

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

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