fzf installieren: Keybindings, Shell-History, fzf vs Ctrl+R

fzf einrichten, Bindings laden, History-UI vs Ctrl+R unterscheiden.

Ctrl+R reverse search walks history one match at a time; tab completion rarely shows a preview. fzf (Junegunn, Go) turns any list into a fuzzy filter UI. With official shell key bindings, Ctrl+R becomes searchable history, Ctrl+T picks files, and Alt+C jumps directories. This guide covers installing fzf, enabling key bindings, and fzf history vs plain Ctrl+R for hereink readers who already use fd, rg, and bat—not a ripgrep tutorial.

The query is fzf installieren Keybindings und Ctrl+R History. You should finish with fzf on PATH, bindings sourced in bash/zsh, sensible FZF_* options, and when to keep the shell’s built-in reverse search.

installbrew · apt · script
bindCtrl+R · T · Alt+C
comparefzf vs Ctrl+R
install fzfkey bindingshistory vs Ctrl+R

What fzf fixes

Fuzzy pick, not exact prefixes

Type deploy nginx to surface ./scripts/deploy-staging-nginx.sh. Pipes like fd | fzf or git branch | fzf use the same UI.

Pairs with fd and rg

fd lists paths, rg searches content, fzf chooses one row. Example: rg -l TODO | fzf --preview 'bat {}' when bat is installed.

Upstream: github.com/junegunn/fzf. Run fzf --version after install.

Install on macOS and Linux

  1. 1
    macOS (Homebrew)

    brew install fzf. The binary lands on PATH; key bindings need a second step (next section).

  2. 2
    Debian / Ubuntu

    sudo apt update && sudo apt install fzf. Distro packages can lag; clone from GitHub and run the install script if you need the latest (official README).

  3. 3
    Fedora / Arch

    sudo dnf install fzf or sudo pacman -S fzf.

  4. 4
    First interaction

    Anywhere: ls | fzf. Type to filter, Enter prints the selection to stdout, Esc aborts.

Enable shell key bindings

After Homebrew install, run the upstream installer (path may vary slightly):

"$(brew --prefix)/opt/fzf/install"
"$(brew --prefix)/opt/fzf/install" --all   # non-interactive; read flags first

The script offers key bindings and completion. Accepting adds source …/key-bindings.bash or .zsh to your rc file. Restart the shell or source ~/.zshrc.

Default shortcuts (bash / zsh)

Ctrl+R   command history (fuzzy)
Ctrl+T   fuzzy file pick under cwd, insert on the line
Alt+C    fuzzy directory, then cd (Option as Meta on macOS terminals)

# Direct invocation still works
fzf
history | fzf
git log --oneline | fzf

If Alt+C fails in Terminal.app, enable “Use Option as Meta key” or use iTerm2/Alacritty with Option set to Meta.

fzf history vs plain Ctrl+R

AspectBuilt-in Ctrl+Rfzf-bound Ctrl+R
UIinline reverse-i-searchfull-screen list with fuzzy scoring
Matchingmostly contiguous substringsfuzzy gaps, e.g. gco main → git checkout main
PreviewnoneFZF_CTRL_R_OPTS --preview can show the full command
Multi-selectnohistory binding is usually single; pipe with fzf -m for many
Dependenciesshell built-inrequires fzf + sourced key-bindings
Minimal SSHalways thereskip bindings if fzf is not installed

To use fzf on history without hijacking Ctrl+R, decline binding during install and bind history | fzf to another key.

Useful environment variables

export FZF_DEFAULT_COMMAND='fd --type f --hidden --follow --exclude .git'
export FZF_DEFAULT_OPTS='--height 40% --layout=reverse --border --info=inline'
export FZF_CTRL_T_OPTS='--preview "bat --color=always {} 2>/dev/null | head -200"'
export FZF_CTRL_R_OPTS='--preview "echo {}" --preview-window down:3:hidden:wrap --bind "?:toggle-preview"'

FZF_DEFAULT_COMMAND feeds Ctrl+T. Without fd, point it at find or git ls-files; see our fd install note.

Good fit
Daily “find one line then run it” workflows; terminals already using fd/rg/bat.
Not ideal
Hosts where you cannot install binaries—keep default Ctrl+R; plain POSIX sh without bash/zsh bindings.
Overlap with the ripgrep articles?

No. Ripgrep posts cover content search in repos; this one covers interactive selection. Combine with rg -l | fzf, but we do not teach rg flags here.

Ctrl+R unchanged after install?

Confirm key-bindings are sourced, shell is bash/zsh, and no other plugin re-binds Ctrl+R. Check type fzf and bindkey | grep fzf on zsh.

Use fzf without overriding Ctrl+R?

Yes—skip bindings in install or comment out the source line; map history | fzf to a free shortcut.

Windows?

Official path is Git Bash / WSL; PowerShell ports exist in the community. Steps here target macOS/Linux bash/zsh.

Nach dem Terminal: Diagramm ausrichten

Service boundaries are easier on a shared board. See create a space.

Raum starten