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:
Using 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 toCtrl+T
, but lets you complete a partially typed path so that you can complete paths that are not in your current directoryFor 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 witht
underneath~/some/dir
-
!
(while in in fzf selector window) - lets you filter (likegrep -v
) the resultsfzf
shows you -
Alt+N
- lets you complete a path to a directory from a partially typed command line.You can actually use
Ctrl+T
or**
+<Tab>
to do this as well, but for folders with a lot of files in themAlt+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
re-installing fzf
this way (from the ‘Using
git’ section of fzf
’s readme):
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install