Skip to main content

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

KeyAction
Ctrl+j / Ctrl+n / Move cursor down
Ctrl+k / Ctrl+p / Move cursor up
Ctrl+f / Page DownPage down
Ctrl+b / Page UpPage up
HomeGo to first item
EndGo to last item

Selection

KeyAction
EnterAccept selection
Esc / Ctrl+cCancel
TabToggle mark (multi-select)
Shift+TabToggle mark backwards
Ctrl+aSelect / deselect all

Query Editing

KeyAction
Ctrl+aMove to beginning of query
Ctrl+eMove to end of query
Ctrl+uClear query
Ctrl+wDelete previous word
Ctrl+h / BackspaceDelete previous character
Alt+BackspaceDelete previous word
Alt+fMove forward one word
Alt+bMove backward one word
Ctrl+gClear query and abort

The --bind Flag

fzf --bind "KEY:ACTION"
fzf --bind "KEY:ACTION,KEY2:ACTION2" # multiple bindings

Special Keys in --bind

TokenMeaning
ctrl-a through ctrl-zCtrl + letter
alt-a through alt-zAlt + letter
f1 through f12Function keys
enter, esc, tab, spaceNamed keys
up, down, left, rightArrow keys
page-up, page-downPage keys
home, endHome/End
insert, deleteInsert/Delete
changeFires when query changes
startFires when fzf starts
loadFires when list is loaded
focusFires when focused item changes

Actions Available in --bind

ActionDescription
acceptAccept selection (like Enter)
abortCancel (like Esc)
toggleToggle selection of current item
toggle-allToggle all selections
select-allSelect all items
deselect-allDeselect all
upMove cursor up
downMove cursor down
page-up / page-downScroll pages
first / lastGo to first/last item
clear-queryClear query
toggle-previewShow/hide preview window
preview-up / preview-downScroll preview
preview-page-up/downPage in preview
toggle-sortToggle 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-queryReplace query with highlighted item
print-queryPrint query before selected
jumpEasyMotion-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'
"

What's Next