fzf
It’s a general purpose fuzzy finder written in Go that can be used with any list of things: files, processes, command history, git branches, etc.
For Zsh, it provides the following key bindings (overwrite existing ones), and they are very handy:
M-C
:Directory search, cd
into the selected directoryC-t
:Paste the selected file path(s) into the command line. Useful to insert quickly paths into arguments of commands. vi $(fd \.yaml|fzf)
:run a command with the selected item from fzf
as argumentmv $(fd -t directory|fzf) ~/Temp/
, DANGER:move a directory from selected path to ~/Temp/
Fuzzy completion mode
-
Select multiple items in FZF:
vi **
and press<TAB>
-
Select Files under parent directory:
vi ../**<TAB>
-
Select Files under parent directory that match
fzf
:vi ../fzf**<TAB>
-
Select Files under your home directory:
vi ~/**<TAB>
-
Find/Change to some directory under current directory (single-selection):
cd **<TAB>
-
Select Host names:
ssh **<TAB>
-
Select Telent:
telnet **<TAB>
-
Select Directories under
~/.config
that matchnvim
cd ~/.config/nvim**<TAB>
- Select Process IDs. Can select multiple processes with
TAB
orS-TAB
kill -9 **<TAB>
Select environment variable / aliases
unset **<TAB>
export **<TAB>
unalias **<TAB>
Using fzf with ripgrep
rg . | fzf
:rg . | fzf | cut -d ":" -f 1
: