fzf Preview Windows, Key Bindings, and Actions/Preview file contents with bat

Render a syntax-highlighted preview for files.

Section: Preview window

Preview file contents with bat

bash
bash
fzf --preview 'bat --style=numbers --color=always --line-range :200 {}'
Explanation

A common choice because bat provides color and line numbers.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Preview window
Scroll the preview pane
Add custom preview scrolling bindings.
OpenIn sheetbashsame section
Place preview on the right
Move the preview window and size it.
OpenIn sheetbashsame section
Toggle preview visibility
Start with the preview hidden and toggle it on demand.
OpenIn sheetbashsame section
Select all items with a key binding
Bind a key to select all results in multi-select mode.
Clear all selections
Bind a key to deselect all marked entries.
Run a command on the current item
Open the selected file without leaving fzf permanently.