1fzf(1) fzf - a command-line fuzzy finder fzf(1)
2
3
4
6 fzf - a command-line fuzzy finder
7
8
10 fzf [options]
11
12
14 fzf is a general-purpose command-line fuzzy finder.
15
16
18 Search mode
19 -x, --extended
20 Extended-search mode. Since 0.10.9, this is enabled by default.
21 You can disable it with +x or --no-extended.
22
23 -e, --exact
24 Enable exact-match
25
26 -i Case-insensitive match (default: smart-case match)
27
28 +i Case-sensitive match
29
30 --literal
31 Do not normalize latin script letters for matching.
32
33 --algo=TYPE
34 Fuzzy matching algorithm (default: v2)
35
36 v2 Optimal scoring algorithm (quality)
37 v1 Faster but not guaranteed to find the optimal result
38 (performance)
39
40
41 -n, --nth=N[,..]
42 Comma-separated list of field index expressions for limiting
43 search scope. See FIELD INDEX EXPRESSION for the details.
44
45 --with-nth=N[,..]
46 Transform the presentation of each line using field index ex‐
47 pressions
48
49 -d, --delimiter=STR
50 Field delimiter regex for --nth and --with-nth (default: AWK-
51 style)
52
53 --disabled
54 Do not perform search. With this option, fzf becomes a simple
55 selector interface rather than a "fuzzy finder". You can later
56 enable the search using enable-search or toggle-search action.
57
58 Search result
59 +s, --no-sort
60 Do not sort the result
61
62 --tac Reverse the order of the input
63
64 e.g.
65 history | fzf --tac --no-sort
66
67 --tiebreak=CRI[,..]
68 Comma-separated list of sort criteria to apply when the scores
69 are tied.
70
71 length Prefers line with shorter length
72 begin Prefers line with matched substring closer to the begin‐
73 ning
74 end Prefers line with matched substring closer to the end
75 index Prefers line that appeared earlier in the input stream
76
77 - Each criterion should appear only once in the list
78 - index is only allowed at the end of the list
79 - index is implicitly appended to the list when not specified
80 - Default is length (or equivalently length,index)
81 - If end is found in the list, fzf will scan each line backwards
82
83 Interface
84 -m, --multi
85 Enable multi-select with tab/shift-tab. It optionally takes an
86 integer argument which denotes the maximum number of items that
87 can be selected.
88
89 +m, --no-multi
90 Disable multi-select
91
92 --no-mouse
93 Disable mouse
94
95 --bind=KEYBINDS
96 Comma-separated list of custom key bindings. See KEY/EVENT BIND‐
97 INGS for the details.
98
99 --cycle
100 Enable cyclic scroll
101
102 --keep-right
103 Keep the right end of the line visible when it's too long. Ef‐
104 fective only when the query string is empty.
105
106 --scroll-off=LINES
107 Number of screen lines to keep above or below when scrolling to
108 the top or to the bottom (default: 0).
109
110 --no-hscroll
111 Disable horizontal scroll
112
113 --hscroll-off=COLS
114 Number of screen columns to keep to the right of the highlighted
115 substring (default: 10). Setting it to a large value will cause
116 the text to be positioned on the center of the screen.
117
118 --filepath-word
119 Make word-wise movements and actions respect path separators.
120 The following actions are affected:
121
122 backward-kill-word
123 backward-word
124 forward-word
125 kill-word
126
127 --jump-labels=CHARS
128 Label characters for jump and jump-accept
129
130 Layout
131 --height=HEIGHT[%]
132 Display fzf window below the cursor with the given height in‐
133 stead of using the full screen.
134
135 --min-height=HEIGHT
136 Minimum height when --height is given in percent (default: 10).
137 Ignored when --height is not specified.
138
139 --layout=LAYOUT
140 Choose the layout (default: default)
141
142 default Display from the bottom of the screen
143 reverse Display from the top of the screen
144 reverse-list Display from the top of the screen, prompt at the
145 bottom
146
147
148 --reverse
149 A synonym for --layout=reverse
150
151
152 --border[=STYLE]
153 Draw border around the finder
154
155 rounded Border with rounded corners (default)
156 sharp Border with sharp corners
157 horizontal Horizontal lines above and below the finder
158 vertical Vertical lines on each side of the finder
159 top
160 bottom
161 left
162 right
163 none
164
165
166 --no-unicode
167 Use ASCII characters instead of Unicode box drawing characters
168 to draw border
169
170
171 --margin=MARGIN
172 Comma-separated expression for margins around the finder.
173
174 TRBL Same margin for top, right, bottom, and left
175 TB,RL Vertical, horizontal margin
176 T,RL,B Top, horizontal, bottom margin
177 T,R,B,L Top, right, bottom, left margin
178
179 Each part can be given in absolute number or in percentage rela‐
180 tive to the terminal size with % suffix.
181
182 e.g.
183 fzf --margin 10%
184 fzf --margin 1,5%
185
186 --padding=PADDING
187 Comma-separated expression for padding inside the border. Pad‐
188 ding is distinguishable from margin only when --border option is
189 used.
190
191 e.g.
192 fzf --margin 5% --padding 5% --border --preview 'cat {}' \
193 --color bg:#222222,preview-bg:#333333
194
195 TRBL Same padding for top, right, bottom, and left
196 TB,RL Vertical, horizontal padding
197 T,RL,B Top, horizontal, bottom padding
198 T,R,B,L Top, right, bottom, left padding
199
200
201 --info=STYLE
202 Determines the display style of finder info.
203
204 default Display on the next line to the prompt
205 inline Display on the same line
206 hidden Do not display finder info
207
208
209 --no-info
210 A synonym for --info=hidden
211
212
213 --prompt=STR
214 Input prompt (default: '> ')
215
216 --pointer=STR
217 Pointer to the current line (default: '>')
218
219 --marker=STR
220 Multi-select marker (default: '>')
221
222 --header=STR
223 The given string will be printed as the sticky header. The lines
224 are displayed in the given order from top to bottom regardless
225 of --layout option, and are not affected by --with-nth. ANSI
226 color codes are processed even when --ansi is not set.
227
228 --header-lines=N
229 The first N lines of the input are treated as the sticky header.
230 When --with-nth is set, the lines are transformed just like the
231 other lines that follow.
232
233 --header-first
234 Print header before the prompt line
235
236 --ellipsis=STR
237 Ellipsis to show when line is truncated (default: '..')
238
239 Display
240 --ansi Enable processing of ANSI color codes
241
242 --tabstop=SPACES
243 Number of spaces for a tab character (default: 8)
244
245 --color=[BASE_SCHEME][,COLOR_NAME[:ANSI_COLOR][:ANSI_ATTRIBUTES]]...
246 Color configuration. The name of the base color scheme is fol‐
247 lowed by custom color mappings.
248
249 BASE SCHEME:
250 (default: dark on 256-color terminal, otherwise 16)
251
252 dark Color scheme for dark 256-color terminal
253 light Color scheme for light 256-color terminal
254 16 Color scheme for 16-color terminal
255 bw No colors (equivalent to --no-color)
256
257 COLOR NAMES:
258 fg Text
259 bg Background
260 preview-fg Preview window text
261 preview-bg Preview window background
262 hl Highlighted substrings
263 fg+ Text (current line)
264 bg+ Background (current line)
265 gutter Gutter on the left (defaults to bg+)
266 hl+ Highlighted substrings (current line)
267 query Query string
268 disabled Query string when search is disabled
269 info Info line (match counters)
270 border Border around the window (--border and --preview)
271 prompt Prompt
272 pointer Pointer to the current line
273 marker Multi-select marker
274 spinner Streaming input indicator
275 header Header
276
277 ANSI COLORS:
278 -1 Default terminal foreground/background color
279 (or the original color of the text)
280 0 ~ 15 16 base colors
281 black
282 red
283 green
284 yellow
285 blue
286 magenta
287 cyan
288 white
289 bright-black (gray | grey)
290 bright-red
291 bright-green
292 bright-yellow
293 bright-blue
294 bright-magenta
295 bright-cyan
296 bright-white
297 16 ~ 255 ANSI 256 colors
298 #rrggbb 24-bit colors
299
300 ANSI ATTRIBUTES: (Only applies to foreground colors)
301 regular Clears previously set attributes; should precede
302 the other ones
303 bold
304 underline
305 reverse
306 dim
307 italic
308
309 EXAMPLES:
310
311 # Seoul256 theme with 8-bit colors
312 # (https://github.com/junegunn/seoul256.vim)
313 fzf --color='bg:237,bg+:236,info:143,border:240,spin‐
314 ner:108' \
315 --color='hl:65,fg:252,header:65,fg+:252' \
316 --color='pointer:161,marker:168,prompt:110,hl+:108'
317
318 # Seoul256 theme with 24-bit colors
319 fzf --color='bg:#4B4B4B,bg+:#3F3F3F,info:#BDBB72,bor‐
320 der:#6B6B6B,spinner:#98BC99' \
321 --color='hl:#719872,fg:#D9D9D9,header:#719872,fg+:#D9D9D9'
322 \
323 --color='pointer:#E12672,marker:#E17899,prompt:#98BEDE,hl+:#98BC99'
324
325 --no-bold
326 Do not use bold text
327
328 --black
329 Use black background
330
331 History
332 --history=HISTORY_FILE
333 Load search history from the specified file and update the file
334 on completion. When enabled, CTRL-N and CTRL-P are automati‐
335 cally remapped to next-history and previous-history.
336
337 --history-size=N
338 Maximum number of entries in the history file (default: 1000).
339 The file is automatically truncated when the number of the lines
340 exceeds the value.
341
342 Preview
343 --preview=COMMAND
344 Execute the given command for the current line and display the
345 result on the preview window. {} in the command is the place‐
346 holder that is replaced to the single-quoted string of the cur‐
347 rent line. To transform the replacement string, specify field
348 index expressions between the braces (See FIELD INDEX EXPRESSION
349 for the details).
350
351 e.g.
352 fzf --preview='head -$LINES {}'
353 ls -l | fzf --preview="echo user={3} when={-4..-2}; cat
354 {-1}" --header-lines=1
355
356 fzf exports $FZF_PREVIEW_LINES and $FZF_PREVIEW_COLUMNS so that
357 they represent the exact size of the preview window. (It also
358 overrides $LINES and $COLUMNS with the same values but they can
359 be reset by the default shell, so prefer to refer to the ones
360 with FZF_PREVIEW_ prefix.)
361
362 A placeholder expression starting with + flag will be replaced
363 to the space-separated list of the selected lines (or the cur‐
364 rent line if no selection was made) individually quoted.
365
366 e.g.
367 fzf --multi --preview='head -10 {+}'
368 git log --oneline | fzf --multi --preview 'git show {+1}'
369
370 When using a field index expression, leading and trailing white‐
371 space is stripped from the replacement string. To preserve the
372 whitespace, use the s flag.
373
374 Also, {q} is replaced to the current query string, and {n} is
375 replaced to zero-based ordinal index of the line. Use {+n} if
376 you want all index numbers when multiple lines are selected.
377
378 A placeholder expression with f flag is replaced to the path of
379 a temporary file that holds the evaluated list. This is useful
380 when you multi-select a large number of items and the length of
381 the evaluated string may exceed ARG_MAX.
382
383 e.g.
384 # Press CTRL-A to select 100K items and see the sum of all
385 the numbers.
386 # This won't work properly without 'f' flag due to ARG_MAX
387 limit.
388 seq 100000 | fzf --multi --bind ctrl-a:select-all \
389 --preview "awk '{sum+=} END {print sum}'
390 {+f}"
391
392 Note that you can escape a placeholder pattern by prepending a
393 backslash.
394
395 Preview window will be updated even when there is no match for
396 the current query if any of the placeholder expressions evalu‐
397 ates to a non-empty string.
398
399 Since 0.24.0, fzf can render partial preview content before the
400 preview command completes. ANSI escape sequence for clearing the
401 display (CSI 2 J) is supported, so you can use it to implement
402 preview window that is constantly updating.
403
404 e.g.
405 fzf --preview 'for i in $(seq 100000); do
406 (( i % 200 == 0 )) && printf "\033[2J"
407 echo "$i"
408 sleep 0.01
409 done'
410
411 --preview-window=[POSITION][,SIZE[%]][,border-BOR‐
412 DER_OPT][,[no]wrap][,[no]follow][,[no]cycle][,[no]hidden][,+SCROLL[OFF‐
413 SETS][/DENOM]][,~HEADER_LINES][,default]
414
415 POSITION: (default: right)
416 up
417 down
418 left
419 right
420
421 Determines the layout of the preview window.
422
423 * If the argument contains :hidden, the preview window will be
424 hidden by default until toggle-preview action is triggered.
425
426 * If size is given as 0, preview window will not be visible, but
427 fzf will still execute the command in the background.
428
429 * Long lines are truncated by default. Line wrap can be enabled
430 with :wrap flag.
431
432 * Preview window will automatically scroll to the bottom when
433 :follow flag is set, similarly to how tail -f works.
434
435 e.g.
436 fzf --preview-window follow --preview 'for i in
437 $(seq 100000); do
438 echo "$i"
439 sleep 0.01
440 (( i % 300 == 0 )) && printf "\033[2J"
441 done'
442
443 * Cyclic scrolling is enabled with :cycle flag.
444
445 * To change the style of the border of the preview window, spec‐
446 ify one of the options for --border with border- prefix. e.g.
447 border-rounded (border with rounded edges, default), border-
448 sharp (border with sharp edges), border-left, border-none, etc.
449
450 * [:+SCROLL[OFFSETS][/DENOM]] determines the initial scroll off‐
451 set of the preview window.
452
453 - SCROLL can be either a numeric integer or a single-field in‐
454 dex expression that refers to a numeric integer.
455
456 - The optional OFFSETS part is for adjusting the base offset.
457 It should be given as a series of signed integers (-INTEGER or
458 +INTEGER).
459
460 - The final /DENOM part is for specifying a fraction of the
461 preview window height.
462
463 * ~HEADER_LINES keeps the top N lines as the fixed header so
464 that they are always visible.
465
466 * default resets all options previously set to the default.
467
468 e.g.
469 # Non-default scroll window positions and sizes
470 fzf --preview="head {}" --preview-window=up,30%
471 fzf --preview="file {}" --preview-window=down,1
472
473 # Initial scroll offset is set to the line number of
474 each line of
475 # git grep output *minus* 5 lines (-5)
476 git grep --line-number '' |
477 fzf --delimiter : --preview 'nl {1}' --preview-
478 window '+{2}-5'
479
480 # Preview with bat, matching line in the middle of
481 the window below
482 # the fixed header of the top 3 lines
483 #
484 # ~3 Top 3 lines as the fixed header
485 # +{2} Base scroll offset extracted from the sec‐
486 ond field
487 # +3 Extra offset to compensate for the 3-line
488 header
489 # /2 Put in the middle of the preview area
490 #
491 git grep --line-number '' |
492 fzf --delimiter : \
493 --preview 'bat --style=full --color=always
494 --highlight-line {2} {1}' \
495 --preview-window '~3,+{2}+3/2'
496
497 # Display top 3 lines as the fixed header
498 fzf --preview 'bat --style=full --color=always {}'
499 --preview-window '~3'
500
501
502 Scripting
503 -q, --query=STR
504 Start the finder with the given query
505
506 -1, --select-1
507 If there is only one match for the initial query (--query), do
508 not start interactive finder and automatically select the only
509 match
510
511 -0, --exit-0
512 If there is no match for the initial query (--query), do not
513 start interactive finder and exit immediately
514
515 -f, --filter=STR
516 Filter mode. Do not start interactive finder. When used with
517 --no-sort, fzf becomes a fuzzy-version of grep.
518
519 --print-query
520 Print query as the first line
521
522 --expect=KEY[,..]
523 Comma-separated list of keys that can be used to complete fzf in
524 addition to the default enter key. When this option is set, fzf
525 will print the name of the key pressed as the first line of its
526 output (or as the second line if --print-query is also used).
527 The line will be empty if fzf is completed with the default en‐
528 ter key. If --expect option is specified multiple times, fzf
529 will expect the union of the keys. --no-expect will clear the
530 list.
531
532 e.g.
533 fzf --expect=ctrl-v,ctrl-t,alt-s --expect=f1,f2,~,@
534
535 --read0
536 Read input delimited by ASCII NUL characters instead of newline
537 characters
538
539 --print0
540 Print output delimited by ASCII NUL characters instead of new‐
541 line characters
542
543 --no-clear
544 Do not clear finder interface on exit. If fzf was started in
545 full screen mode, it will not switch back to the original
546 screen, so you'll have to manually run tput rmcup to return.
547 This option can be used to avoid flickering of the screen when
548 your application needs to start fzf multiple times in order.
549
550 --sync Synchronous search for multi-staged filtering. If specified, fzf
551 will launch ncurses finder only after the input stream is com‐
552 plete.
553
554 e.g. fzf --multi | fzf --sync
555
556 --version
557 Display version information and exit
558
559
560 Note that most options have the opposite versions with --no- prefix.
561
562
564 FZF_DEFAULT_COMMAND
565 Default command to use when input is tty. On *nix systems, fzf
566 runs the command with $SHELL -c if SHELL is set, otherwise with
567 sh -c, so in this case make sure that the command is POSIX-com‐
568 pliant.
569
570 FZF_DEFAULT_OPTS
571 Default options. e.g. export FZF_DEFAULT_OPTS="--extended --cy‐
572 cle"
573
574
576 0 Normal exit
577 1 No match
578 2 Error
579 130 Interrupted with CTRL-C or ESC
580
581
583 A field index expression can be a non-zero integer or a range expres‐
584 sion ([BEGIN]..[END]). --nth and --with-nth take a comma-separated list
585 of field index expressions.
586
587
588 Examples
589 1 The 1st field
590 2 The 2nd field
591 -1 The last field
592 -2 The 2nd to last field
593 3..5 From the 3rd field to the 5th field
594 2.. From the 2nd field to the last field
595 ..-3 From the 1st field to the 3rd to the last field
596 .. All the fields
597
598
600 Unless specified otherwise, fzf will start in "extended-search mode".
601 In this mode, you can specify multiple patterns delimited by spaces,
602 such as: 'wild ^music .mp3$ sbtrkt !rmx
603
604 You can prepend a backslash to a space (\ ) to match a literal space
605 character.
606
607
608 Exact-match (quoted)
609 A term that is prefixed by a single-quote character (') is interpreted
610 as an "exact-match" (or "non-fuzzy") term. fzf will search for the ex‐
611 act occurrences of the string.
612
613
614 Anchored-match
615 A term can be prefixed by ^, or suffixed by $ to become an anchored-
616 match term. Then fzf will search for the lines that start with or end
617 with the given string. An anchored-match term is also an exact-match
618 term.
619
620
621 Negation
622 If a term is prefixed by !, fzf will exclude the lines that satisfy the
623 term from the result. In this case, fzf performs exact match by de‐
624 fault.
625
626
627 Exact-match by default
628 If you don't prefer fuzzy matching and do not wish to "quote" (prefix‐
629 ing with ') every word, start fzf with -e or --exact option. Note that
630 when --exact is set, '-prefix "unquotes" the term.
631
632
633 OR operator
634 A single bar character term acts as an OR operator. For example, the
635 following query matches entries that start with core and end with ei‐
636 ther go, rb, or py.
637
638 e.g. ^core go$ | rb$ | py$
639
640
642 --bind option allows you to bind a key or an event to one or more ac‐
643 tions. You can use it to customize key bindings or implement dynamic
644 behaviors.
645
646 --bind takes a comma-separated list of binding expressions. Each bind‐
647 ing expression is KEY:ACTION or EVENT:ACTION.
648
649 e.g.
650 fzf --bind=ctrl-j:accept,ctrl-k:kill-line
651
652
653 AVAILABLE KEYS: (SYNONYMS)
654 ctrl-[a-z]
655 ctrl-space
656 ctrl-\
657 ctrl-]
658 ctrl-^ (ctrl-6)
659 ctrl-/ (ctrl-_)
660 ctrl-alt-[a-z]
661 alt-[*] (Any case-sensitive single character is allowed)
662 f[1-12]
663 enter (return ctrl-m)
664 space
665 bspace (bs)
666 alt-up
667 alt-down
668 alt-left
669 alt-right
670 alt-enter
671 alt-space
672 alt-bspace (alt-bs)
673 tab
674 btab (shift-tab)
675 esc
676 del
677 up
678 down
679 left
680 right
681 home
682 end
683 insert
684 pgup (page-up)
685 pgdn (page-down)
686 shift-up
687 shift-down
688 shift-left
689 shift-right
690 alt-shift-up
691 alt-shift-down
692 alt-shift-left
693 alt-shift-right
694 left-click
695 right-click
696 double-click
697 or any single character
698
699
700 AVAILABLE EVENTS:
701 change
702 Triggered whenever the query string is changed
703
704 e.g.
705 # Move cursor to the first entry whenever the query is
706 changed
707 fzf --bind change:first
708
709 backward-eof
710 Triggered when the query string is already empty and you try to
711 delete it backward.
712
713 e.g.
714 fzf --bind backward-eof:abort
715
716
717 AVAILABLE ACTIONS:
718 A key or an event can be bound to one or more of the following actions.
719
720 ACTION: DEFAULT BINDINGS (NOTES):
721 abort ctrl-c ctrl-g ctrl-q esc
722 accept enter double-click
723 accept-non-empty (same as accept except that it prevents
724 fzf from exiting without selection)
725 backward-char ctrl-b left
726 backward-delete-char ctrl-h bspace
727 backward-delete-char/eof (same as backward-delete-char except
728 aborts fzf if query is empty)
729 backward-kill-word alt-bs
730 backward-word alt-b shift-left
731 beginning-of-line ctrl-a home
732 cancel (clear query string if not empty, abort
733 fzf otherwise)
734 change-preview(...) (change --preview option)
735 change-preview-window(...) (change --preview-window option; rotate
736 through the multiple option sets separated by '|')
737 change-prompt(...) (change prompt to the given string)
738 clear-screen ctrl-l
739 clear-selection (clear multi-selection)
740 close (close preview window if open, abort fzf
741 otherwise)
742 clear-query (clear query string)
743 delete-char del
744 delete-char/eof ctrl-d (same as delete-char except
745 aborts fzf if query is empty)
746 deselect
747 deselect-all (deselect all matches)
748 disable-search (disable search functionality)
749 down ctrl-j ctrl-n down
750 enable-search (enable search functionality)
751 end-of-line ctrl-e end
752 execute(...) (see below for the details)
753 execute-silent(...) (see below for the details)
754 first (move to the first match)
755 forward-char ctrl-f right
756 forward-word alt-f shift-right
757 ignore
758 jump (EasyMotion-like 2-keystroke movement)
759 jump-accept (jump and accept)
760 kill-line
761 kill-word alt-d
762 last (move to the last match)
763 next-history (ctrl-n on --history)
764 page-down pgdn
765 page-up pgup
766 half-page-down
767 half-page-up
768 preview(...) (see below for the details)
769 preview-down shift-down
770 preview-up shift-up
771 preview-page-down
772 preview-page-up
773 preview-half-page-down
774 preview-half-page-up
775 preview-bottom
776 preview-top
777 previous-history (ctrl-p on --history)
778 print-query (print query and exit)
779 put (put the character to the prompt)
780 refresh-preview
781 rebind(...) (rebind bindings after unbind)
782 reload(...) (see below for the details)
783 replace-query (replace query string with the current
784 selection)
785 select
786 select-all (select all matches)
787 toggle (right-click)
788 toggle-all (toggle all matches)
789 toggle+down ctrl-i (tab)
790 toggle-in (--layout=reverse* ? toggle+up : tog‐
791 gle+down)
792 toggle-out (--layout=reverse* ? toggle+down : tog‐
793 gle+up)
794 toggle-preview
795 toggle-preview-wrap
796 toggle-search (toggle search functionality)
797 toggle-sort
798 toggle+up btab (shift-tab)
799 unbind(...) (unbind bindings)
800 unix-line-discard ctrl-u
801 unix-word-rubout ctrl-w
802 up ctrl-k ctrl-p up
803 yank ctrl-y
804
805
806 ACTION COMPOSITION
807 Multiple actions can be chained using + separator.
808
809 e.g.
810 fzf --multi --bind 'ctrl-a:select-all+accept'
811 fzf --multi --bind 'ctrl-a:select-all' --bind 'ctrl-a:+accept'
812
813
814 ACTION ARGUMENT
815 An action denoted with (...) suffix takes an argument.
816
817 e.g.
818 fzf --bind 'ctrl-a:change-prompt(NewPrompt> )'
819 fzf --bind 'ctrl-v:preview(cat {})' --preview-window hidden
820
821 If the argument contains parentheses, fzf may fail to parse the expres‐
822 sion. In that case, you can use any of the following alternative nota‐
823 tions to avoid parse errors.
824
825 action-name[...]
826 action-name~...~
827 action-name!...!
828 action-name@...@
829 action-name#...#
830 action-name$...$
831 action-name%...%
832 action-name^...^
833 action-name&...&
834 action-name*...*
835 action-name;...;
836 action-name/.../
837 action-name|...|
838 action-name:...
839 The last one is the special form that frees you from parse er‐
840 rors as it does not expect the closing character. The catch is
841 that it should be the last one in the comma-separated list of
842 key-action pairs.
843
844
845 COMMAND EXECUTION
846 With execute(...) action, you can execute arbitrary commands without
847 leaving fzf. For example, you can turn fzf into a simple file browser
848 by binding enter key to less command like follows.
849
850 fzf --bind "enter:execute(less {})"
851
852 You can use the same placeholder expressions as in --preview.
853
854 fzf switches to the alternate screen when executing a command. However,
855 if the command is expected to complete quickly, and you are not inter‐
856 ested in its output, you might want to use execute-silent instead,
857 which silently executes the command without the switching. Note that
858 fzf will not be responsive until the command is complete. For asynchro‐
859 nous execution, start your command as a background process (i.e. ap‐
860 pending &).
861
862 On *nix systems, fzf runs the command with $SHELL -c if SHELL is set,
863 otherwise with sh -c, so in this case make sure that the command is
864 POSIX-compliant.
865
866
867 RELOAD INPUT
868 reload(...) action is used to dynamically update the input list without
869 restarting fzf. It takes the same command template with placeholder ex‐
870 pressions as execute(...).
871
872 See https://github.com/junegunn/fzf/issues/1750 for more info.
873
874 e.g.
875 # Update the list of processes by pressing CTRL-R
876 ps -ef | fzf --bind 'ctrl-r:reload(ps -ef)' --header 'Press CTRL-R
877 to reload' \
878 --header-lines=1 --layout=reverse
879
880 # Integration with ripgrep
881 RG_PREFIX="rg --column --line-number --no-heading --color=always
882 --smart-case "
883 INITIAL_QUERY="foobar"
884 FZF_DEFAULT_COMMAND="$RG_PREFIX '$INITIAL_QUERY'" \
885 fzf --bind "change:reload:$RG_PREFIX {q} || true" \
886 --ansi --disabled --query "$INITIAL_QUERY"
887
888
889 PREVIEW BINDING
890 With preview(...) action, you can specify multiple different preview
891 commands in addition to the default preview command given by --preview
892 option.
893
894 e.g.
895 # Default preview command with an extra preview binding
896 fzf --preview 'file {}' --bind '?:preview:cat {}'
897
898 # A preview binding with no default preview command
899 # (Preview window is initially empty)
900 fzf --bind '?:preview:cat {}'
901
902 # Preview window hidden by default, it appears when you first hit
903 '?'
904 fzf --bind '?:preview:cat {}' --preview-window hidden
905
906
907 CHANGE PREVIEW WINDOW ATTRIBUTES
908 change-preview-window action can be used to change the properties of
909 the preview window. Unlike the --preview-window option, you can specify
910 multiple sets of options separated by '|' characters.
911
912 e.g.
913 # Rotate through the options using CTRL-/
914 fzf --preview 'cat {}' --bind 'ctrl-/:change-preview-win‐
915 dow(right,70%|down,40%,border-horizontal|hidden|right)'
916
917 # The default properties given by `--preview-window` are inher‐
918 ited, so an empty string in the list is interpreted as the default
919 fzf --preview 'cat {}' --preview-window 'right,40%,border-left'
920 --bind 'ctrl-/:change-preview-window(70%|down,border-top|hidden|)'
921
922 # This is equivalent to toggle-preview action
923 fzf --preview 'cat {}' --bind 'ctrl-/:change-preview-window(hid‐
924 den|)'
925
926
928 Junegunn Choi (junegunn.c@gmail.com)
929
930
932 Project homepage:
933 https://github.com/junegunn/fzf
934
935 Extra Vim plugin:
936 https://github.com/junegunn/fzf.vim
937
938
940 MIT
941
942
943
944fzf 0.30.0 Apr 2022 fzf(1)