Key Bindings Reference
fzf supports a rich key binding system. Built-in defaults cover navigation and selection. The --bind flag lets you attach custom actions to any key.
Built-in Default Bindings
Navigation
| Key | Action |
|---|---|
Ctrl+j / Ctrl+n / ↓ | Move cursor down |
Ctrl+k / Ctrl+p / ↑ | Move cursor up |
Ctrl+f / Page Down | Page down |
Ctrl+b / Page Up | Page up |
Home | Go to first item |
End | Go to last item |
Selection
| Key | Action |
|---|---|
Enter | Accept selection |
Esc / Ctrl+c | Cancel |
Tab | Toggle mark (multi-select) |
Shift+Tab | Toggle mark backwards |
Ctrl+a | Select / deselect all |
Query Editing
| Key | Action |
|---|---|
Ctrl+a | Move to beginning of query |
Ctrl+e | Move to end of query |
Ctrl+u | Clear query |
Ctrl+w | Delete previous word |
Ctrl+h / Backspace | Delete previous character |
Alt+Backspace | Delete previous word |
Alt+f | Move forward one word |
Alt+b | Move backward one word |
Ctrl+g | Clear query and abort |
The --bind Flag
fzf --bind "KEY:ACTION"
fzf --bind "KEY:ACTION,KEY2:ACTION2" # multiple bindings
Special Keys in --bind
| Token | Meaning |
|---|---|
ctrl-a through ctrl-z | Ctrl + letter |
alt-a through alt-z | Alt + letter |
f1 through f12 | Function keys |
enter, esc, tab, space | Named keys |
up, down, left, right | Arrow keys |
page-up, page-down | Page keys |
home, end | Home/End |
insert, delete | Insert/Delete |
change | Fires when query changes |
start | Fires when fzf starts |
load | Fires when list is loaded |
focus | Fires when focused item changes |
Actions Available in --bind
| Action | Description |
|---|---|
accept | Accept selection (like Enter) |
abort | Cancel (like Esc) |
toggle | Toggle selection of current item |
toggle-all | Toggle all selections |
select-all | Select all items |
deselect-all | Deselect all |
up | Move cursor up |
down | Move cursor down |
page-up / page-down | Scroll pages |
first / last | Go to first/last item |
clear-query | Clear query |
toggle-preview | Show/hide preview window |
preview-up / preview-down | Scroll preview |
preview-page-up/down | Page in preview |
toggle-sort | Toggle sort |
reload(cmd) | Reload list from command |
execute(cmd) | Run command in subshell (stay in fzf) |
execute-silent(cmd) | Run silently (no output shown) |
become(cmd) | Replace fzf with command |
change-preview(cmd) | Change the preview command |
change-preview-window(opts) | Change preview window options |
transform(cmd) | Transform an option based on state |
put(str) | Insert string into query |
replace-query | Replace query with highlighted item |
print-query | Print query before selected |
jump | EasyMotion-style jump |
Practical --bind Examples
Toggle Preview with Ctrl+/
fzf --preview 'cat {}' --bind 'ctrl-/:toggle-preview'
Change Preview When Focus Changes
ls | fzf \
--preview 'file {}' \
--bind 'focus:change-preview(bat --color=always {})'
Reload List Dynamically
# Switch between searching files and directories
find . -type f | fzf \
--bind 'ctrl-f:reload(find . -type f)' \
--bind 'ctrl-d:reload(find . -type d)' \
--header 'CTRL-F: files CTRL-D: dirs'
Execute Action Without Leaving fzf
# View file content without exiting
ls | fzf --bind 'ctrl-p:execute(cat {})'
# Edit file and return to fzf after
ls | fzf --bind 'ctrl-e:execute(nvim {})'
Custom Accept with Multiple Actions
# Select file, open in neovim, and also copy path to clipboard
ls | fzf --bind 'enter:become(nvim {})+execute-silent(echo -n {} | xclip -selection clipboard)'
Jump Mode (EasyMotion-style)
ls | fzf --bind 'ctrl-j:jump'
# Labels appear on items; press the label key to jump to that item
Setting Global Bindings via FZF_DEFAULT_OPTS
~/.bashrc or ~/.zshrc
export FZF_DEFAULT_OPTS="
--bind='ctrl-/:toggle-preview'
--bind='ctrl-u:preview-half-page-up'
--bind='ctrl-d:preview-half-page-down'
--bind='ctrl-a:select-all'
--bind='ctrl-y:execute-silent(echo -n {} | xclip -selection clipboard)'
--bind='alt-enter:print-query'
"