Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get fzf.vim ignore node_modules and .git folders?

Tags:

vim

fzf

I have fzf setup in vim with barely any customisation:

" fzf and ripgrep settings
set rtp+=/usr/local/opt/fzf
let g:fzf_action = {
    \ 'ctrl-t': 'tab split',
    \ 'ctrl-i': 'split',
    \ 'ctrl-s': 'vsplit'
    \ }

In my .bash_profile, I set the environment variable FZF_DEFAULT_COMMAND to show hidden, but ignore node_modules and .git:

export FZF_DEFAULT_COMMAND='rg --files --follow --no-ignore-vcs --hidden -g "!{node_modules/*,.git/*}"'

However, when I use :Files function in vim, it still searches in the folders i want ignored.

like image 231
doctopus Avatar asked May 18 '20 08:05

doctopus


2 Answers

Have you tried :GFiles command?

It is one of the best FZF command that is excluding anything that is in .gitignore.

Personally I like to use it as default.

:help fzf-vim-commands
like image 188
undg Avatar answered Oct 01 '22 10:10

undg


Silly me. I forgot to source ~/.bash_profile

like image 7
doctopus Avatar answered Oct 01 '22 10:10

doctopus