Running fzf
<cmd> | fzf
Choose one line from the input
fzf
Browse files under the current dir
fzf -m
Multi-select (Tab marks, Shift+Tab unmarks)
fzf -q '<query>'
Start with a query typed in
fzf -1 -0
Auto-pick a single match, exit on none
fzf --height 40%
Inline list instead of full screen
fzf --layout reverse
Prompt at the top, list grows down
fzf --border
Draw a border around the finder
fzf --ansi
Keep colours from the input
fzf --print0
Separate output by NUL (pair with xargs -0)
fzf --disabled
Turn off filtering; list is driven by reload
fzf --tmux 80%
Open in a tmux popup
Needs tmux 3.3+; silently ignored elsewhere
Shell integration
eval "$(fzf --bash)"
Enable bindings and completion in bash
source <(fzf --zsh)
Enable in zsh
fzf --fish | source
Enable in fish
Ctrl+T
Paste selected files or dirs at the cursor
Ctrl+R
Fuzzy search command history
Alt+C
cd into a selected directory
Ctrl+R (again)
Toggle relevance and chronological sort
<cmd> **<Tab>
Fuzzy completion of paths, e.g. vim **<Tab>
kill -9 **<Tab>
Pick a process to kill
ssh **<Tab>
Pick a host from config and hosts files
export **<Tab>
Pick a variable name (also unset, unalias)
FZF_CTRL_R_COMMAND= FZF_ALT_C_COMMAND= eval "$(fzf
--bash)"
Disable chosen bindings while sourcing
Setting the variable after sourcing has no effect.
Preview and layout
fzf --preview 'cat {}'
Show a preview of the focused line
fzf --preview-window right,50%
Position and size the preview
--preview-window up,40%,border-bottom
Put the preview above the list
--preview-window hidden
Start hidden (toggle with a bind)
--preview-window '~3'
Pin the first 3 preview lines as a header
fzf --header '<text>'
Add a fixed header line
fzf --header-lines 1
Treat input's first line as header
fzf --prompt '<text> '
Change the prompt string
fzf --color <spec>
Customise colours (e.g. dark, bw)
fzf --style full
Use the full borders-and-labels style
Fields and output
--delimiter ':'
Split each line into fields
--nth 2
Search only field 2
--with-nth 2..
Show only fields from 2 onwards
--accept-nth 1
Print only field 1 of the selection
{1} {2} {-1}
Field placeholders in preview or bind commands
--expect ctrl-o
Print the key pressed before the result
--print-query
Print the typed query as the first line
--read0
Read NUL-separated input
--tac
Reverse the input order
--no-sort
Keep input order instead of ranking
--walker file,dir,follow,hidden
Choose what the built-in walker lists
--walker-skip .git,node_modules
Skip directories while walking
Bindings and actions
--bind 'ctrl-/:toggle-preview'
Bind a key to a preview toggle
--bind 'enter:become(vim {})'
Replace fzf with a command on Enter
--bind
'ctrl-y:execute-silent(<cmd>)+abort'
Run a command silently, then quit
--bind 'ctrl-o:execute(<cmd> {})'
Run a command, then return to fzf
--bind 'ctrl-r:reload(<cmd>)'
Replace the list with new output
--bind 'change:reload(<cmd> {q})'
Re-run a command on each keystroke
--bind 'start:<action>'
Event bindings: start, change, focus, result
--bind 'ctrl-a:select-all'
Mark every visible item
--bind
'ctrl-/:change-preview-window(50%|hidden|)'
Cycle preview layouts
--bind 'ctrl-t:transform-header(<cmd>)'
Rewrite the header from a command