Skip to content

fzf

Reads lines on stdin, lets you fuzzy-select interactively, writes the choice to stdout.

Homebrew formula

What it does

fzf is a filter with a UI. Anything that produces lines can be piped into it, and the selection piped onward — which is why it ends up underneath dozens of other tools’ interactive modes.

Its shell integration rebinds three keys: Ctrl-T inserts a file path, Ctrl-R searches history, and Alt-C changes directory. **<Tab> completes paths fuzzily.

# preview a file while selecting it
fzf --preview 'bat --color=always {}'

# check out a branch
git branch -a | fzf | xargs git switch

Notes

Add eval "$(fzf --zsh)" to ~/.zshrc for the key bindings and completion. FZF_DEFAULT_OPTS sets layout and preview defaults globally.

Alternative to

AlternativeTypeTrade-off
skim (sk)Open sourceA Rust reimplementation with near-identical flags
fzy and pecoOpen sourceSmaller and simpler, fewer features
TelescopeOpen sourceThe same idea, but only inside Neovim

Install

brew install fzf

Links

This post is licensed under CC BY 4.0 by the author.
Last updated on