$ cat > ~/.fzf.conf
exclude Applications/
exclude Library/
$ vi some/parent/dir/<Ctrl-t>
I expected that fzf would show files under some/parent/dir/ or its descendant dirs.
Furthermore, It would be very handy if fzf supports auto-completion like this:
$ vi s/p/d/<Ctrl-t>
@justinmk With 1. and 2., what I am trying to tell you is how to speed up loading file list with exclude pattern, not how to filter out some exclude pattern within file list.
I have checked the fzf man page, but I can't find how I can set the exclude pattern.
Please tell me what I have misunderstood.
I totally agree with you on 3. I've always missed that and it felt very natural to have such a behavior. Maybe it could be made configurable (something you can turn off).
Thanks for the suggestion.
Regarding point 1 and 2, let me put it this way: fzf can be thought of as _an interactive version of grep_. Does grep cache the input? No. And grep does know the meaning of the text it's processing. It's designed to "not care" about the context. The same can be said about fzf.
seq 1000 | fzf
git tag | fzf
ps -ef | fzf
find . | fzf
You see, fzf cannot decide whether if it makes sense to cache the input, or if some extra pre-filtering is appropriate or not. It all depends on the context but fzf is designed to be a context-free filter just like grep. So in that sense, it's beyond the scope of this project.
What you can do instead is to write a script that caches the output of find and use it as the input to fzf. The users should know better about their systems and their needs.
find-cached | filter-irrelevant | fzf
# or
export FZF_DEFAULT_COMMAND='fzf-cached | filter-irrelevant'
fzf
(There's also $FZF_CTRL_T_COMMAND.)
Many users including myself use ag as their FZF_DEFAULT_COMMAND:
export FZF_DEFAULT_COMMAND='ag --hidden --ignore .git -g ""'
ag also allows you to extend its filtering rule with .agignore file, so you might want to check it out.
https://github.com/ggreer/the_silver_searcher/wiki/Advanced-Usage
The behavior you described in point 3 is available via fuzzy completion (vim some/parent/dir/**<tab>) and if you use zsh, you can configure CTRL-T to act as the dedicated key for fuzzy completion. You can find the details in this page.
$ vi s/p/d/
I'm not against the idea as long as we can have the same behavior both on bash and zsh (I myself am a bash user). Pull requests are appreciated.
The behavior you described in point 3 is available via fuzzy completion (vim some/parent/dir/**
)
Wow, didn't know that! That helps a lot, thank you!
@junegunn Thank you for your kind reply.
I agree with the point that fzf binary should remain in the same scope with grep.
But grep doesn't do key binding such as Ctrl-t or Ctrl-r.
I thought the functionalities could be added as shell integration extensions.
I have switched from bash into zsh, and I realized how handy tab completions are.
I think vi s/p/d/<Ctrl-t> is much cooler than vi some/parent/dir/**<tab>.
Anyway, I'll try more configurations that you suggested.
And thank you for fzf.
@dongminkim Yeah I see your point, but the way I see it, they are optional and not the core part of the project. They are there to give you the idea of how fzf can be used to extend the functionality of shell and to get you started with fzf, but I don't plan to add more to them.
Most helpful comment
Thanks for the suggestion.
Regarding point 1 and 2, let me put it this way: fzf can be thought of as _an interactive version of grep_. Does grep cache the input? No. And grep does know the meaning of the text it's processing. It's designed to "not care" about the context. The same can be said about fzf.
You see, fzf cannot decide whether if it makes sense to cache the input, or if some extra pre-filtering is appropriate or not. It all depends on the context but fzf is designed to be a context-free filter just like grep. So in that sense, it's beyond the scope of this project.
What you can do instead is to write a script that caches the output of find and use it as the input to fzf. The users should know better about their systems and their needs.
(There's also
$FZF_CTRL_T_COMMAND.)Many users including myself use
agas theirFZF_DEFAULT_COMMAND:ag also allows you to extend its filtering rule with .agignore file, so you might want to check it out.
https://github.com/ggreer/the_silver_searcher/wiki/Advanced-Usage
The behavior you described in point 3 is available via fuzzy completion (
vim some/parent/dir/**<tab>) and if you use zsh, you can configure CTRL-T to act as the dedicated key for fuzzy completion. You can find the details in this page.I'm not against the idea as long as we can have the same behavior both on bash and zsh (I myself am a bash user). Pull requests are appreciated.