# fzf fzf is a general-purpose command-line fuzzy finder. Written in [[Go]] by Junegunn Choi, it reads input from stdin (or files) and presents an interactive filter interface, making it easy to search and select items from any list — files, command history, processes, git branches, and more. ## Key features - **Fuzzy matching**: Finds results even with partial or out-of-order input - **Fast**: Processes millions of lines with minimal latency - **Portable**: Single binary, works on [[Linux]], macOS, and Windows - **Composable**: Works with any command that produces text output - **Shell integration**: Built-in keybindings for [[Bash]], [[Zsh (Z Shell)]], and fish ## Installation ```sh # Arch pacman -S fzf # Debian/Ubuntu sudo apt install fzf # macOS brew install fzf # Git git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf && ~/.fzf/install ``` ## Common usage ```sh # Find and open a file vim $(fzf) # Fuzzy search with preview fzf --preview 'cat {}' # Pipe any list into fzf ls | fzf git branch | fzf ps aux | fzf # Use with ripgrep for content search rg --files | fzf rg -l "pattern" | fzf --preview 'cat {}' ``` ## Shell keybindings (after setup) | Keybinding | Action | |------------|--------| | `Ctrl+T` | Paste selected file path | | `Ctrl+R` | Search command history | | `Alt+C` | cd into selected directory | ## Environment variables ```sh # Default command (what fzf searches) export FZF_DEFAULT_COMMAND='rg --files --hidden --glob "!.git/"' # Default options export FZF_DEFAULT_OPTS='--height 40% --layout=reverse --border' # Ctrl+T behavior export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND" ``` ## Integration with other tools - **[[ripgrep]]**: `rg --files | fzf` for fast file finding - **[[Neovim]]**: telescope.nvim uses fzf-style matching; fzf.vim provides native integration - **[[Vim]]**: fzf.vim plugin for fuzzy finding within Vim - **[[Git]]**: `git log --oneline | fzf` to pick commits, `git branch | fzf` to switch branches - **[[TMux]]**: fzf-tmux wrapper for running fzf in a tmux pane ## References - https://github.com/junegunn/fzf - https://junegunn.github.io/fzf/ ## Related - [[ripgrep]] - [[grep]] - [[Neovim]] - [[Vim]] - [[Command Line Interface (CLI)]] - [[Shell]] - [[Bash]] - [[Zsh (Z Shell)]] - [[TMux]] - [[Git]]