Lesser known FZF tricks
junegunn/fzf is one of my absolute favorite terminal productivity tools.
It’s most common use is as a superpowered
Ctrl+R (reverse isearch) to make
finding and executing commands from your shell history fast and easy:
fzf to search through your shell history this way is pretty handy, but
Ctrl+R isn’t the only thing
fzf provides. Here’s some lesser known, but
extremely useful keybindings that
fzf ships with the default installation:
Ctrl+T- bring up an fzf window to select a file or directory from the command line (relative to the current directory).
<Tab>- similar to
Ctrl+T, but lets you complete a partially typed path so that you can complete paths that are not in your current directory
For example, if you’ve typed
cd ~/some/dir/t**and then hit tab fzf will pop up a fuzzy selector of all the subdirs and files that start with
!(while in in fzf selector window) - lets you filter (like
grep -v) the results
Alt+N- lets you complete a path to a directory from a partially typed command line.
You can actually use
<Tab> to do this as well, but for
folders with a lot of files in them
Alt+N can be faster since it only
searches over directories.
These are easier explained visually than verbally, so if you’d like more info on how and when to use these check out the video tutorial here:
If you have
fzf installed but the keyboard shortcuts don’t work try
fzf this way (from the ‘Using
git’ section of
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf ~/.fzf/install