fzf Reload, Event Bindings, and Dynamic Sources

Build live search interfaces with reload, change events, refresh-preview, and mode-switching key bindings.

View
StandardDetailedCompact
Export
Copy the compact sheet, download it, or print it.
Download
`D` dense toggle · `C` copy all

Reload patterns

Build dynamic interfaces that refresh their source list in place.

Reload a process list on demand

Refresh the data source with a key binding.

bashANYreloadpsdynamic
bash
fzf --header-lines=1 --header='CTRL-R to reload' --bind 'ctrl-r:reload(ps -ef)' < <(ps -ef)

reload lets you keep one interactive session open while the underlying command is rerun.

Use fzf as a frontend for ripgrep

Run a new ripgrep search whenever the query changes.

bashANYreloadripgrepchange-event
bash
fzf --ansi --disabled --query '' --bind 'start:reload:rg --column --line-number --no-heading --color=always {q} || true' --bind 'change:reload:rg --column --line-number --no-heading --color=always {q} || true' --delimiter=':' --preview 'bat --color=always --highlight-line {2} {1}'

This pattern is one of the most powerful advanced fzf workflows for live content search.

Switch between multiple data sources

Bind keys that swap the prompt and reload command.

bashANYreloadmode-switchprompt
bash
printf '%s
' files dirs | fzf --prompt='Files> ' --bind 'ctrl-d:change-prompt(Dirs> )+reload(fd --type d),ctrl-f:change-prompt(Files> )+reload(fd --type f)'

Useful for command palettes that have multiple modes.

Refresh a changing preview

Force the preview command to rerun.

bashANYrefresh-previewpreview
bash
fzf --preview 'date' --bind '?:refresh-preview'

Helpful when the preview itself is time-sensitive or depends on changing external state.

Transform actions

Alter prompts, headers, previews, or queries from events and bindings.

Rewrite the query dynamically

Change the query from a binding.

bashANYtransform-querybindings
bash
printf '%s
' alpha beta gamma | fzf --bind 'ctrl-e:transform-query:echo beta'

Transform actions make it possible to build richer interactive applications around fzf.

Update preview label dynamically

Show context-sensitive labels as focus moves.

bashANYtransformpreview-labelfocus
bash
printf '%s
' a b c | fzf --preview 'echo {}' --bind 'focus:transform-preview-label:echo Preview'

Small UX improvement for custom UIs and dashboards.

Recommended next

No recommendations yet.