vimfzfvim-fzf

Filter out invalid results in vim-fzf/fzf


I use fzf.vim quite a bit in my workflow I have one problem when using :GFiles.

In the codebase I work on, we have src/node_modules checked into git, so whenever I use :GFiles we get a lot of results back, which includes the node_modules contents.

How can I remove items that start with src/node_modules* for example from the :GFiles command in fzf.vim?


Solution

  • I figured out that git ls-files is what :GFiles run and the implementation allows for arguments and unix pipes.

    The solution is to run grep to filter out the results:

    map <C-p> :GFiles \| grep -v -E "(node_modules\|bower_components)"<CR>