

Normal-mode mapping so that we can trigger this flow with ff.Invoke FZF() function when we call :Files in vim.So if you prefer to have different set of results per vim window, then use :lfile/ :lgetfile. Location lists are window-specific, whereas quickfix lists are global. Note #2: you may replace :cfile/ :cgetfile with :lfile/ :lgetfile to use location list instead of quickfix list.Note #1: you may use :cgetfile to only load results into quickfix list without jumping to the 1st result.Load results from temp file into quickfix list and jump to the 1st result.Finally, direct the results into the temp file.Note: you can drop this awk command if you set errorformat+=%f in your vimrc, but I found %f to capture a lot of false-positives from other programs' outputs and therefore :cnext/ :cprevious don't function on these false-positive results.Pipe to awk to append :1:0 to fzf results to make them errorformat-compatible.Call fzf with -multi to allow for selecting multiple files.

Generate a path to a temporary file and store it in a variable.Here is what the final vimscript looks like:Įnter fullscreen mode Exit fullscreen mode Load the results into Vim's quickfix list with :cfile or :cgetfile, so that we can navigate through the results with :cnext/ :cprevious or :copen.Format the output to make it compatible with errorformat.This setup is simple and it leverages a feature in vim called quickfix. There has to be a simple way to integrate a command-line program with a command-line editor, right? Recently, however, I have been experimenting with a plugin-free Vim setup and while :find is sufficient for some use-cases, I found myself quitting vim and running fzf to find deeply nested files in new or large projects. FZF is a great command-line fuzzy-finder and there is fzf.vim plugin that integrates with Vim to provide features, like :Files to fuzzy search over files and :Rg to fuzzy search over text using ripgrep.
