Code Self Study Forum

Check out fzf

If anyone isn’t using fzf yet, check it out. It works well with other command line tools like fd, ripgrep, and bat.

Here is a video walk through:

Here’s a text version of the tutorial:

If the terminal keybindings don’t work out of the box, you can find the configuration scripts by searching with fzf from the root of your system (Linux or Mac1) like this:

cd /
fzf

Then type the names of the files that you’re searching for.

Copy the config files called key-bindings.zsh and completion.zsh somewhere in your dotfiles/config area and source them in your .zshrc (or similar) file.

They are probably located at a path something like:

...???/fzf/key-bindings.zsh
...???/fzf/completion.zsh

(I found their names in the Arch Wiki.)

There is some more info here: CLI: improved (command line tools) - #5 by Josh


1 I’m not sure how to do it in Windows.

1 Like

I think these are the default keybindings:

  • ctrl+t — search files
  • alt+c — search directories
  • ctrlrr — search command history

The characters ** followed by a tab will trigger the fuzzy finder.

For example, type this and then press tab:

$ vim **

(Select multiple files with the tab key.)

I created some aliases like these that fuzzy search for files in the current directory (multi-select with tab) and opens them in various kinds of splits/tabs in vim:

alias v='vim `fzf`'        # opens files
alias vof='vim -o `fzf`'   # opens files in horizontal splits
alias vOf='vim -O `fzf`'   # opens files in vertical splits
alias vpf='vim -p `fzf`'   # opens files in tabs

There’s another article here: