Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude folders #128

Closed
KaoruDev opened this issue Feb 14, 2015 · 10 comments
Closed

Exclude folders #128

KaoruDev opened this issue Feb 14, 2015 · 10 comments
Labels

Comments

@KaoruDev
Copy link

In node projects it'd be nice to be able to not search in the node_modules folder =)

@junegunn
Copy link
Owner

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.

@shri3k
Copy link

shri3k commented Nov 2, 2015

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.

@pencilcheck
Copy link

pencilcheck commented Apr 22, 2017

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

@caneta
Copy link

caneta commented Jul 7, 2017

As mentioned here, I solved adding the following in my .bashrc:

export FZF_DEFAULT_COMMAND='ag --hidden --ignore .git -g ""'

@pencilcheck
Copy link

Yea, but it is manual, if ag can respect .gitignore that would be awesome.

@caneta
Copy link

caneta commented Jul 7, 2017

Ag respects .gitignore when you add that variable.
It does not consider node_modules and that directory is only inside my .gitignore

@KaoruDev
Copy link
Author

KaoruDev commented Jul 8, 2017

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 😄

@junegunn
Copy link
Owner

junegunn commented Jul 8, 2017

@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

@KaoruDev
Copy link
Author

KaoruDev commented Jul 8, 2017

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 🎉

@lpender
Copy link

lpender commented Dec 13, 2019

Best vim solution for me:

map ; :GFiles<CR>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants