In node projects it'd be nice to be able to not search in the node_modules folder =)
When fzf is started w/o STDIN pipe, the default command it uses is find * -path '*/\.*' -prune -o -type f -print -o -type l -print 2> /dev/null. You can try setting up FZF_DEFAULT_COMMAND environment variable to override the default.
Although I'm pretty sure it's obvious for others by now, fzf does respect .gitignore et. al which should solve this problem.
<3 this tool btw @junegunn.
In my case, fzf does not respect .gitignore. I don't know why.
-------------------edit-----------------------
Looks like I have to use ag or ack to respect the .*ignore files
As mentioned here, I solved adding the following in my _.bashrc_:
export FZF_DEFAULT_COMMAND='ag --hidden --ignore .git -g ""'
Yea, but it is manual, if ag can respect .gitignore that would be awesome.
Ag respects .gitignore when you add that variable.
It does not consider node_modules and that directory is only inside my .gitignore
The problem I was originally having was that fzf was opening files in node_modules via vim
The best solution I've found was to do this:
nmap ff :call fzf#run({
\ ‘source’: ‘git ls-files --exclude-standard --others --cached,
\ ‘sink’: ‘edit’
\ })<Enter>
basically git ls-files --exclude-standard --others --cached | fzf since you should be ignoring node_modules in .gitginore this works like a charm 😄
@KaoruDev That will open fzf in full screen right? You might want to use fzf#wrap function that applies the default layout, and the default set of key bindings (ctrl-t for opening in a new tab, ctrl-x, ctrl-v for horizontal and vertical split)
call fzf#run(fzf#wrap({'source': 'git ls-files --exclude-standard --others --cached'}))
See: https://github.com/junegunn/fzf/blob/master/README-VIM.md#fzfwrap
yeah it does open in the full screen, kind of gotten used to it, will try what you suggested and see if i like it more, thanks for the tip! @junegunn and fzf is bomb.com thanks for your contribution + time 🎉
Best vim solution for me:
map ; :GFiles<CR>
Most helpful comment
As mentioned here, I solved adding the following in my _.bashrc_: