fzf(1) fzf - a command-line fuzzy finder fzf(1) NAME fzf - a command-line fuzzy finder SYNOPSIS fzf [options] DESCRIPTION fzf is a general-purpose command-line fuzzy finder. OPTIONS Note Most long options have the opposite version with --no- prefix. Search mode -x, --extended Extended-search mode. Since 0.10.9, this is enabled by default. You can disable it with +x or --no-extended. -e, --exact Enable exact-match -i Case-insensitive match (default: smart-case match) +i Case-sensitive match --literal Do not normalize latin script letters for matching. --scheme=SCHEME Choose scoring scheme tailored for different types of input. default Generic scoring scheme designed to work well with any type of input path Scoring scheme well suited for file paths history Scoring scheme well suited for command history or any input where chronological ordering is important Sets --tiebreak=index as well. --algo=TYPE Fuzzy matching algorithm (default: v2) v2 Optimal scoring algorithm (quality) v1 Faster but not guaranteed to find the optimal result (performance) -n, --nth=N[,..] Comma-separated list of field index expressions for limiting search scope. See FIELD INDEX EXPRESSION for the details. --with-nth=N[,..] Transform the presentation of each line using field index expressions -d, --delimiter=STR Field delimiter regex for --nth and --with-nth (default: AWK- style) --disabled Do not perform search. With this option, fzf becomes a simple selector interface rather than a "fuzzy finder". You can later enable the search using enable-search or toggle-search action. Search result +s, --no-sort Do not sort the result --track Make fzf track the current selection when the result list is updated. This can be useful when browsing logs using fzf with sorting disabled. It is not recommended to use this option with --tac as the resulting behavior can be confusing. Also, consider using track action instead of this option. e.g. git log --oneline --graph --color=always | nl | fzf --ansi --track --no-sort --layout=reverse-list --tac Reverse the order of the input e.g. history | fzf --tac --no-sort --tiebreak=CRI[,..] Comma-separated list of sort criteria to apply when the scores are tied. length Prefers line with shorter length chunk Prefers line with shorter matched chunk (delimited by whitespaces) begin Prefers line with matched substring closer to the beginning end Prefers line with matched substring closer to the end index Prefers line that appeared earlier in the input stream - Each criterion should appear only once in the list - index is only allowed at the end of the list - index is implicitly appended to the list when not specified - Default is length (or equivalently length,index) - If end is found in the list, fzf will scan each line backwards Interface -m, --multi Enable multi-select with tab/shift-tab. It optionally takes an integer argument which denotes the maximum number of items that can be selected. +m, --no-multi Disable multi-select --no-mouse Disable mouse --bind=KEYBINDS Comma-separated list of custom key bindings. See KEY/EVENT BINDINGS for the details. --cycle Enable cyclic scroll --keep-right Keep the right end of the line visible when it's too long. Effective only when the query string is empty. --scroll-off=LINES Number of screen lines to keep above or below when scrolling to the top or to the bottom (default: 0). --no-hscroll Disable horizontal scroll --hscroll-off=COLS Number of screen columns to keep to the right of the highlighted substring (default: 10). Setting it to a large value will cause the text to be positioned on the center of the screen. --filepath-word Make word-wise movements and actions respect path separators. The following actions are affected: backward-kill-word backward-word forward-word kill-word --jump-labels=CHARS Label characters for jump mode. Layout --height=[~]HEIGHT[%] Display fzf window below the cursor with the given height instead of using the full screen. If a negative value is specified, the height is calculated as the terminal height minus the given value. fzf --height=-1 When prefixed with ~, fzf will automatically determine the height in the range according to the input size. Note that adaptive height is not compatible with top/bottom margin and padding given in percent size. It is also not compatible with a negative height value. # Will not take up 100% of the screen seq 5 | fzf --height=~100% --min-height=HEIGHT Minimum height when --height is given in percent (default: 10). Ignored when --height is not specified. --layout=LAYOUT Choose the layout (default: default) default Display from the bottom of the screen reverse Display from the top of the screen reverse-list Display from the top of the screen, prompt at the bottom --reverse A synonym for --layout=reverse --border[=BORDER_OPT] Draw border around the finder rounded Border with rounded corners (default) sharp Border with sharp corners bold Border with bold lines double Border with double lines block Border using block elements; suitable when using different background colors thinblock Border using legacy computing symbols; may not be displayed on some terminals horizontal Horizontal lines above and below the finder vertical Vertical lines on each side of the finder top (up) bottom (down) left right none If you use a terminal emulator where each box-drawing character takes 2 columns, try setting --ambidouble. If the border is still not properly rendered, set --no-unicode. --border-label[=LABEL] Label to print on the horizontal border line. Should be used with one of the following --border options. * rounded * sharp * bold * double * horizontal * top (up) * bottom (down) e.g. # ANSI color codes are supported # (with https://github.com/busyloop/lolcat) label=$(curl -s http://metaphorpsum.com/sentences/1 | lolcat -f) # Border label at the center fzf --height=10 --border --border-label=" $label " --color=label:italic:black # Left-aligned (positive integer) fzf --height=10 --border --border-label=" $label " --border-label-pos=3 --color=label:italic:black # Right-aligned (negative integer) on the bottom line (:bottom) fzf --height=10 --border --border-label=" $label " --border-label-pos=-3:bottom --color=label:italic:black --border-label-pos[=N[:top|bottom]] Position of the border label on the border line. Specify a positive integer as the column position from the left. Specify a negative integer to right-align the label. Label is printed on the top border line by default, add :bottom to put it on the border line on the bottom. The default value 0 (or center) will put the label at the center of the border line. --no-unicode Use ASCII characters instead of Unicode drawing characters to draw borders, the spinner and the horizontal separator. --ambidouble Set this option if your terminal displays ambiguous width characters (e.g. box-drawing characters for borders) as 2 columns. --margin=MARGIN Comma-separated expression for margins around the finder. TRBL Same margin for top, right, bottom, and left TB,RL Vertical, horizontal margin T,RL,B Top, horizontal, bottom margin T,R,B,L Top, right, bottom, left margin Each part can be given in absolute number or in percentage relative to the terminal size with % suffix. e.g. fzf --margin 10% fzf --margin 1,5% --padding=PADDING Comma-separated expression for padding inside the border. Padding is distinguishable from margin only when --border option is used. e.g. fzf --margin 5% --padding 5% --border --preview 'cat {}' \ --color bg:#222222,preview-bg:#333333 TRBL Same padding for top, right, bottom, and left TB,RL Vertical, horizontal padding T,RL,B Top, horizontal, bottom padding T,R,B,L Top, right, bottom, left padding --info=STYLE Determines the display style of the finder info. (e.g. match counter, loading indicator, etc.) default On the left end of the horizontal separator right On the right end of the horizontal separator hidden Do not display finder info inline After the prompt with the default prefix ' < ' inline:PREFIX After the prompt with a non-default prefix inline-right On the right end of the prompt line inline-right:PREFIX On the right end of the prompt line with a custom prefix --no-info A synonym for --info=hidden --separator=STR The given string will be repeated to form the horizontal separator on the info line (default: '' or '-' depending on --no-unicode). ANSI color codes are supported. --no-separator Do not display horizontal separator on the info line. A synonym for --separator='' --scrollbar=CHAR1[CHAR2] Use the given character to render scrollbar. (default: '|' or ':' depending on --no-unicode). The optional CHAR2 is used to render scrollbar of the preview window. --no-scrollbar Do not display scrollbar. A synonym for --scrollbar='' --prompt=STR Input prompt (default: '> ') --pointer=STR Pointer to the current line (default: '>') --marker=STR Multi-select marker (default: '>') --header=STR The given string will be printed as the sticky header. The lines are displayed in the given order from top to bottom regardless of --layout option, and are not affected by --with-nth. ANSI color codes are processed even when --ansi is not set. --header-lines=N The first N lines of the input are treated as the sticky header. When --with-nth is set, the lines are transformed just like the other lines that follow. --header-first Print header before the prompt line --ellipsis=STR Ellipsis to show when line is truncated (default: '..') Display --ansi Enable processing of ANSI color codes --tabstop=SPACES Number of spaces for a tab character (default: 8) --color=[BASE_SCHEME][,COLOR_NAME[:ANSI_COLOR][:ANSI_ATTRIBUTES]]... Color configuration. The name of the base color scheme is followed by custom color mappings. BASE SCHEME: (default: dark on 256-color terminal, otherwise 16) dark Color scheme for dark 256-color terminal light Color scheme for light 256-color terminal 16 Color scheme for 16-color terminal bw No colors (equivalent to --no-color) COLOR NAMES: fg Text preview-fg Preview window text bg Background preview-bg Preview window background hl Highlighted substrings fg+ Text (current line) bg+ Background (current line) gutter Gutter on the left hl+ Highlighted substrings (current line) query Query string disabled Query string when search is disabled (--disabled) info Info line (match counters) border Border around the window (--border and --preview) scrollbar Scrollbar preview-border Border around the preview window (--preview) preview-scrollbar Scrollbar separator Horizontal separator on info line label Border label (--border-label and --preview-label) preview-label Border label of the preview window (--preview-label) prompt Prompt pointer Pointer to the current line marker Multi-select marker spinner Streaming input indicator header Header ANSI COLORS: -1 Default terminal foreground/background color (or the original color of the text) 0 ~ 15 16 base colors black red green yellow blue magenta cyan white bright-black (gray | grey) bright-red bright-green bright-yellow bright-blue bright-magenta bright-cyan bright-white 16 ~ 255 ANSI 256 colors #rrggbb 24-bit colors ANSI ATTRIBUTES: (Only applies to foreground colors) regular Clears previously set attributes; should precede the other ones bold underline reverse dim italic strikethrough EXAMPLES: # Seoul256 theme with 8-bit colors # (https://github.com/junegunn/seoul256.vim) fzf --color='bg:237,bg+:236,info:143,border:240,spinner:108' \ --color='hl:65,fg:252,header:65,fg+:252' \ --color='pointer:161,marker:168,prompt:110,hl+:108' # Seoul256 theme with 24-bit colors fzf --color='bg:#4B4B4B,bg+:#3F3F3F,info:#BDBB72,border:#6B6B6B,spinner:#98BC99' \ --color='hl:#719872,fg:#D9D9D9,header:#719872,fg+:#D9D9D9' \ --color='pointer:#E12672,marker:#E17899,prompt:#98BEDE,hl+:#98BC99' --no-bold Do not use bold text --black Use black background History --history=HISTORY_FILE Load search history from the specified file and update the file on completion. When enabled, CTRL-N and CTRL-P are automatically remapped to next-history and prev-history. --history-size=N Maximum number of entries in the history file (default: 1000). The file is automatically truncated when the number of the lines exceeds the value. Preview --preview=COMMAND Execute the given command for the current line and display the result on the preview window. {} in the command is the placeholder that is replaced to the single-quoted string of the current line. To transform the replacement string, specify field index expressions between the braces (See FIELD INDEX EXPRESSION for the details). e.g. fzf --preview='head -$LINES {}' ls -l | fzf --preview="echo user={3} when={-4..-2}; cat {-1}" --header-lines=1 fzf exports $FZF_PREVIEW_LINES and $FZF_PREVIEW_COLUMNS so that they represent the exact size of the preview window. (It also overrides $LINES and $COLUMNS with the same values but they can be reset by the default shell, so prefer to refer to the ones with FZF_PREVIEW_ prefix.) fzf also exports $FZF_PREVIEW_TOP and $FZF_PREVIEW_LEFT so that the preview command can determine the position of the preview window. A placeholder expression starting with + flag will be replaced to the space-separated list of the selected lines (or the current line if no selection was made) individually quoted. e.g. fzf --multi --preview='head -10 {+}' git log --oneline | fzf --multi --preview 'git show {+1}' When using a field index expression, leading and trailing whitespace is stripped from the replacement string. To preserve the whitespace, use the s flag. A placeholder expression with f flag is replaced to the path of a temporary file that holds the evaluated list. This is useful when you multi-select a large number of items and the length of the evaluated string may exceed ARG_MAX. e.g. # Press CTRL-A to select 100K items and see the sum of all the numbers. # This won't work properly without 'f' flag due to ARG_MAX limit. seq 100000 | fzf --multi --bind ctrl-a:select-all \ --preview "awk '{sum+=\$1} END {print sum}' {+f}" Also, * {q} (or {fzf:query}) is replaced to the current query string * {n} is replaced to the zero-based ordinal index of the current item. Use {+n} if you want all index numbers when multiple lines are selected. Note that you can escape a placeholder pattern by prepending a backslash. Preview window will be updated even when there is no match for the current query if any of the placeholder expressions evaluates to a non-empty string or {q} is in the command template. Since 0.24.0, fzf can render partial preview content before the preview command completes. ANSI escape sequence for clearing the display (CSI 2 J) is supported, so you can use it to implement preview window that is constantly updating. e.g. fzf --preview 'for i in $(seq 100000); do (( i % 200 == 0 )) && printf "\033[2J" echo "$i" sleep 0.01 done' fzf has experimental support for Kitty graphics protocol and Sixel graphics. The following example uses https://github.com/junegunn/fzf/blob/master/bin/fzf-preview.sh script to render an image using either of the protocols inside the preview window. e.g. fzf --preview='fzf-preview.sh {}' --preview-label[=LABEL] Label to print on the horizontal border line of the preview window. Should be used with one of the following --preview- window options. * border-rounded (default on non-Windows platforms) * border-sharp (default on Windows) * border-bold * border-double * border-block * border-thinblock * border-horizontal * border-top * border-bottom --preview-label-pos[=N[:top|bottom]] Position of the border label on the border line of the preview window. Specify a positive integer as the column position from the left. Specify a negative integer to right-align the label. Label is printed on the top border line by default, add :bottom to put it on the border line on the bottom. The default value 0 (or center) will put the label at the center of the border line. --preview-window=[POSITION][,SIZE[%]][,border-BORDER_OPT][,[no]wrap][,[no]follow][,[no]cycle][,[no]hidden][,+SCROLL[OFFSETS][/DENOM]][,~HEADER_LINES][,default][,