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:
C-t
::Paste the selected file path(s) into the command line. Useful to insert quickly paths into arguments of commands.M-C
::Directory search,cd
into the selected directoryvi $(fd \.yaml|fzf)
::run a command with the selected item fromfzf
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 variables / aliases
unset **<TAB>
export **<TAB>
unalias **<TAB>
Use with ripgrep
rg . | fzf
::Fuzzy search every line in every file
rg . | fzf | cut -d ":" -f 1
::Fuzzy search every line, in every file, and return the file location