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 Display
237 --ansi Enable processing of ANSI color codes
238
239 --tabstop=SPACES
240 Number of spaces for a tab character (default: 8)
241
242 --color=[BASE_SCHEME][,COLOR_NAME[:ANSI_COLOR][:ANSI_ATTRIBUTES]]...
243 Color configuration. The name of the base color scheme is fol‐
244 lowed by custom color mappings.
245
246 BASE SCHEME:
247 (default: dark on 256-color terminal, otherwise 16)
248
249 dark Color scheme for dark 256-color terminal
250 light Color scheme for light 256-color terminal
251 16 Color scheme for 16-color terminal
252 bw No colors (equivalent to --no-color)
253
254 COLOR NAMES:
255 fg Text
256 bg Background
257 preview-fg Preview window text
258 preview-bg Preview window background
259 hl Highlighted substrings
260 fg+ Text (current line)
261 bg+ Background (current line)
262 gutter Gutter on the left (defaults to bg+)
263 hl+ Highlighted substrings (current line)
264 query Query string
265 disabled Query string when search is disabled
266 info Info line (match counters)
267 border Border around the window (--border and --preview)
268 prompt Prompt
269 pointer Pointer to the current line
270 marker Multi-select marker
271 spinner Streaming input indicator
272 header Header
273
274 ANSI COLORS:
275 -1 Default terminal foreground/background color
276 (or the original color of the text)
277 0 ~ 15 16 base colors
278 black
279 red
280 green
281 yellow
282 blue
283 magenta
284 cyan
285 white
286 bright-black (gray | grey)
287 bright-red
288 bright-green
289 bright-yellow
290 bright-blue
291 bright-magenta
292 bright-cyan
293 bright-white
294 16 ~ 255 ANSI 256 colors
295 #rrggbb 24-bit colors
296
297 ANSI ATTRIBUTES: (Only applies to foreground colors)
298 regular Clears previously set attributes; should precede
299 the other ones
300 bold
301 underline
302 reverse
303 dim
304 italic
305
306 EXAMPLES:
307
308 # Seoul256 theme with 8-bit colors
309 # (https://github.com/junegunn/seoul256.vim)
310 fzf --color='bg:237,bg+:236,info:143,border:240,spin‐
311 ner:108' \
312 --color='hl:65,fg:252,header:65,fg+:252' \
313 --color='pointer:161,marker:168,prompt:110,hl+:108'
314
315 # Seoul256 theme with 24-bit colors
316 fzf --color='bg:#4B4B4B,bg+:#3F3F3F,info:#BDBB72,bor‐
317 der:#6B6B6B,spinner:#98BC99' \
318 --color='hl:#719872,fg:#D9D9D9,header:#719872,fg+:#D9D9D9'
319 \
320 --color='pointer:#E12672,marker:#E17899,prompt:#98BEDE,hl+:#98BC99'
321
322 --no-bold
323 Do not use bold text
324
325 --black
326 Use black background
327
328 History
329 --history=HISTORY_FILE
330 Load search history from the specified file and update the file
331 on completion. When enabled, CTRL-N and CTRL-P are automati‐
332 cally remapped to next-history and previous-history.
333
334 --history-size=N
335 Maximum number of entries in the history file (default: 1000).
336 The file is automatically truncated when the number of the lines
337 exceeds the value.
338
339 Preview
340 --preview=COMMAND
341 Execute the given command for the current line and display the
342 result on the preview window. {} in the command is the place‐
343 holder that is replaced to the single-quoted string of the cur‐
344 rent line. To transform the replacement string, specify field
345 index expressions between the braces (See FIELD INDEX EXPRESSION
346 for the details).
347
348 e.g.
349 fzf --preview='head -$LINES {}'
350 ls -l | fzf --preview="echo user={3} when={-4..-2}; cat
351 {-1}" --header-lines=1
352
353 fzf exports $FZF_PREVIEW_LINES and $FZF_PREVIEW_COLUMNS so that
354 they represent the exact size of the preview window. (It also
355 overrides $LINES and $COLUMNS with the same values but they can
356 be reset by the default shell, so prefer to refer to the ones
357 with FZF_PREVIEW_ prefix.)
358
359 A placeholder expression starting with + flag will be replaced
360 to the space-separated list of the selected lines (or the cur‐
361 rent line if no selection was made) individually quoted.
362
363 e.g.
364 fzf --multi --preview='head -10 {+}'
365 git log --oneline | fzf --multi --preview 'git show {+1}'
366
367 When using a field index expression, leading and trailing white‐
368 space is stripped from the replacement string. To preserve the
369 whitespace, use the s flag.
370
371 Also, {q} is replaced to the current query string, and {n} is
372 replaced to zero-based ordinal index of the line. Use {+n} if
373 you want all index numbers when multiple lines are selected.
374
375 A placeholder expression with f flag is replaced to the path of
376 a temporary file that holds the evaluated list. This is useful
377 when you multi-select a large number of items and the length of
378 the evaluated string may exceed ARG_MAX.
379
380 e.g.
381 # Press CTRL-A to select 100K items and see the sum of all
382 the numbers.
383 # This won't work properly without 'f' flag due to ARG_MAX
384 limit.
385 seq 100000 | fzf --multi --bind ctrl-a:select-all \
386 --preview "awk '{sum+=} END {print sum}'
387 {+f}"
388
389 Note that you can escape a placeholder pattern by prepending a
390 backslash.
391
392 Preview window will be updated even when there is no match for
393 the current query if any of the placeholder expressions evalu‐
394 ates to a non-empty string.
395
396 Since 0.24.0, fzf can render partial preview content before the
397 preview command completes. ANSI escape sequence for clearing the
398 display (CSI 2 J) is supported, so you can use it to implement
399 preview window that is constantly updating.
400
401 e.g.
402 fzf --preview 'for i in $(seq 100000); do
403 (( i % 200 == 0 )) && printf "\033[2J"
404 echo "$i"
405 sleep 0.01
406 done'
407
408 --preview-window=[POSITION][,SIZE[%]][,border-BOR‐
409 DER_OPT][,[no]wrap][,[no]follow][,[no]cycle][,[no]hidden][,+SCROLL[OFF‐
410 SETS][/DENOM]][,~HEADER_LINES][,default]
411
412 POSITION: (default: right)
413 up
414 down
415 left
416 right
417
418 Determines the layout of the preview window.
419
420 * If the argument contains :hidden, the preview window will be
421 hidden by default until toggle-preview action is triggered.
422
423 * If size is given as 0, preview window will not be visible, but
424 fzf will still execute the command in the background.
425
426 * Long lines are truncated by default. Line wrap can be enabled
427 with :wrap flag.
428
429 * Preview window will automatically scroll to the bottom when
430 :follow flag is set, similarly to how tail -f works.
431
432 e.g.
433 fzf --preview-window follow --preview 'for i in
434 $(seq 100000); do
435 echo "$i"
436 sleep 0.01
437 (( i % 300 == 0 )) && printf "\033[2J"
438 done'
439
440 * Cyclic scrolling is enabled with :cycle flag.
441
442 * To change the style of the border of the preview window, spec‐
443 ify one of the options for --border with border- prefix. e.g.
444 border-rounded (border with rounded edges, default), border-
445 sharp (border with sharp edges), border-left, border-none, etc.
446
447 * [:+SCROLL[OFFSETS][/DENOM]] determines the initial scroll off‐
448 set of the preview window.
449
450 - SCROLL can be either a numeric integer or a single-field in‐
451 dex expression that refers to a numeric integer.
452
453 - The optional OFFSETS part is for adjusting the base offset.
454 It should be given as a series of signed integers (-INTEGER or
455 +INTEGER).
456
457 - The final /DENOM part is for specifying a fraction of the
458 preview window height.
459
460 * ~HEADER_LINES keeps the top N lines as the fixed header so
461 that they are always visible.
462
463 * default resets all options previously set to the default.
464
465 e.g.
466 # Non-default scroll window positions and sizes
467 fzf --preview="head {}" --preview-window=up,30%
468 fzf --preview="file {}" --preview-window=down,1
469
470 # Initial scroll offset is set to the line number of
471 each line of
472 # git grep output *minus* 5 lines (-5)
473 git grep --line-number '' |
474 fzf --delimiter : --preview 'nl {1}' --preview-
475 window '+{2}-5'
476
477 # Preview with bat, matching line in the middle of
478 the window below
479 # the fixed header of the top 3 lines
480 #
481 # ~3 Top 3 lines as the fixed header
482 # +{2} Base scroll offset extracted from the sec‐
483 ond field
484 # +3 Extra offset to compensate for the 3-line
485 header
486 # /2 Put in the middle of the preview area
487 #
488 git grep --line-number '' |
489 fzf --delimiter : \
490 --preview 'bat --style=full --color=always
491 --highlight-line {2} {1}' \
492 --preview-window '~3,+{2}+3/2'
493
494 # Display top 3 lines as the fixed header
495 fzf --preview 'bat --style=full --color=always {}'
496 --preview-window '~3'
497
498
499 Scripting
500 -q, --query=STR
501 Start the finder with the given query
502
503 -1, --select-1
504 If there is only one match for the initial query (--query), do
505 not start interactive finder and automatically select the only
506 match
507
508 -0, --exit-0
509 If there is no match for the initial query (--query), do not
510 start interactive finder and exit immediately
511
512 -f, --filter=STR
513 Filter mode. Do not start interactive finder. When used with
514 --no-sort, fzf becomes a fuzzy-version of grep.
515
516 --print-query
517 Print query as the first line
518
519 --expect=KEY[,..]
520 Comma-separated list of keys that can be used to complete fzf in
521 addition to the default enter key. When this option is set, fzf
522 will print the name of the key pressed as the first line of its
523 output (or as the second line if --print-query is also used).
524 The line will be empty if fzf is completed with the default en‐
525 ter key. If --expect option is specified multiple times, fzf
526 will expect the union of the keys. --no-expect will clear the
527 list.
528
529 e.g.
530 fzf --expect=ctrl-v,ctrl-t,alt-s --expect=f1,f2,~,@
531
532 --read0
533 Read input delimited by ASCII NUL characters instead of newline
534 characters
535
536 --print0
537 Print output delimited by ASCII NUL characters instead of new‐
538 line characters
539
540 --no-clear
541 Do not clear finder interface on exit. If fzf was started in
542 full screen mode, it will not switch back to the original
543 screen, so you'll have to manually run tput rmcup to return.
544 This option can be used to avoid flickering of the screen when
545 your application needs to start fzf multiple times in order.
546
547 --sync Synchronous search for multi-staged filtering. If specified, fzf
548 will launch ncurses finder only after the input stream is com‐
549 plete.
550
551 e.g. fzf --multi | fzf --sync
552
553 --version
554 Display version information and exit
555
556
557 Note that most options have the opposite versions with --no- prefix.
558
559
561 FZF_DEFAULT_COMMAND
562 Default command to use when input is tty. On *nix systems, fzf
563 runs the command with $SHELL -c if SHELL is set, otherwise with
564 sh -c, so in this case make sure that the command is POSIX-com‐
565 pliant.
566
567 FZF_DEFAULT_OPTS
568 Default options. e.g. export FZF_DEFAULT_OPTS="--extended --cy‐
569 cle"
570
571
573 0 Normal exit
574 1 No match
575 2 Error
576 130 Interrupted with CTRL-C or ESC
577
578
580 A field index expression can be a non-zero integer or a range expres‐
581 sion ([BEGIN]..[END]). --nth and --with-nth take a comma-separated list
582 of field index expressions.
583
584
585 Examples
586 1 The 1st field
587 2 The 2nd field
588 -1 The last field
589 -2 The 2nd to last field
590 3..5 From the 3rd field to the 5th field
591 2.. From the 2nd field to the last field
592 ..-3 From the 1st field to the 3rd to the last field
593 .. All the fields
594
595
597 Unless specified otherwise, fzf will start in "extended-search mode".
598 In this mode, you can specify multiple patterns delimited by spaces,
599 such as: 'wild ^music .mp3$ sbtrkt !rmx
600
601 You can prepend a backslash to a space (\ ) to match a literal space
602 character.
603
604
605 Exact-match (quoted)
606 A term that is prefixed by a single-quote character (') is interpreted
607 as an "exact-match" (or "non-fuzzy") term. fzf will search for the ex‐
608 act occurrences of the string.
609
610
611 Anchored-match
612 A term can be prefixed by ^, or suffixed by $ to become an anchored-
613 match term. Then fzf will search for the lines that start with or end
614 with the given string. An anchored-match term is also an exact-match
615 term.
616
617
618 Negation
619 If a term is prefixed by !, fzf will exclude the lines that satisfy the
620 term from the result. In this case, fzf performs exact match by de‐
621 fault.
622
623
624 Exact-match by default
625 If you don't prefer fuzzy matching and do not wish to "quote" (prefix‐
626 ing with ') every word, start fzf with -e or --exact option. Note that
627 when --exact is set, '-prefix "unquotes" the term.
628
629
630 OR operator
631 A single bar character term acts as an OR operator. For example, the
632 following query matches entries that start with core and end with ei‐
633 ther go, rb, or py.
634
635 e.g. ^core go$ | rb$ | py$
636
637
639 --bind option allows you to bind a key or an event to one or more ac‐
640 tions. You can use it to customize key bindings or implement dynamic
641 behaviors.
642
643 --bind takes a comma-separated list of binding expressions. Each bind‐
644 ing expression is KEY:ACTION or EVENT:ACTION.
645
646 e.g.
647 fzf --bind=ctrl-j:accept,ctrl-k:kill-line
648
649
650 AVAILABLE KEYS: (SYNONYMS)
651 ctrl-[a-z]
652 ctrl-space
653 ctrl-\
654 ctrl-]
655 ctrl-^ (ctrl-6)
656 ctrl-/ (ctrl-_)
657 ctrl-alt-[a-z]
658 alt-[*] (Any case-sensitive single character is allowed)
659 f[1-12]
660 enter (return ctrl-m)
661 space
662 bspace (bs)
663 alt-up
664 alt-down
665 alt-left
666 alt-right
667 alt-enter
668 alt-space
669 alt-bspace (alt-bs)
670 tab
671 btab (shift-tab)
672 esc
673 del
674 up
675 down
676 left
677 right
678 home
679 end
680 insert
681 pgup (page-up)
682 pgdn (page-down)
683 shift-up
684 shift-down
685 shift-left
686 shift-right
687 alt-shift-up
688 alt-shift-down
689 alt-shift-left
690 alt-shift-right
691 left-click
692 right-click
693 double-click
694 or any single character
695
696
697 AVAILABLE EVENTS:
698 change
699 Triggered whenever the query string is changed
700
701 e.g.
702 # Move cursor to the first entry whenever the query is
703 changed
704 fzf --bind change:first
705
706 backward-eof
707 Triggered when the query string is already empty and you try to
708 delete it backward.
709
710 e.g.
711 fzf --bind backward-eof:abort
712
713
714 AVAILABLE ACTIONS:
715 A key or an event can be bound to one or more of the following actions.
716
717 ACTION: DEFAULT BINDINGS (NOTES):
718 abort ctrl-c ctrl-g ctrl-q esc
719 accept enter double-click
720 accept-non-empty (same as accept except that it prevents
721 fzf from exiting without selection)
722 backward-char ctrl-b left
723 backward-delete-char ctrl-h bspace
724 backward-delete-char/eof (same as backward-delete-char except
725 aborts fzf if query is empty)
726 backward-kill-word alt-bs
727 backward-word alt-b shift-left
728 beginning-of-line ctrl-a home
729 cancel (clear query string if not empty, abort
730 fzf otherwise)
731 change-prompt(...) (change prompt to the given string)
732 clear-screen ctrl-l
733 clear-selection (clear multi-selection)
734 close (close preview window if open, abort fzf
735 otherwise)
736 clear-query (clear query string)
737 delete-char del
738 delete-char/eof ctrl-d (same as delete-char except aborts
739 fzf if query is empty)
740 deselect
741 deselect-all (deselect all matches)
742 disable-search (disable search functionality)
743 down ctrl-j ctrl-n down
744 enable-search (enable search functionality)
745 end-of-line ctrl-e end
746 execute(...) (see below for the details)
747 execute-silent(...) (see below for the details)
748 first (move to the first match)
749 forward-char ctrl-f right
750 forward-word alt-f shift-right
751 ignore
752 jump (EasyMotion-like 2-keystroke movement)
753 jump-accept (jump and accept)
754 kill-line
755 kill-word alt-d
756 last (move to the last match)
757 next-history (ctrl-n on --history)
758 page-down pgdn
759 page-up pgup
760 half-page-down
761 half-page-up
762 preview(...) (see below for the details)
763 preview-down shift-down
764 preview-up shift-up
765 preview-page-down
766 preview-page-up
767 preview-half-page-down
768 preview-half-page-up
769 preview-bottom
770 preview-top
771 previous-history (ctrl-p on --history)
772 print-query (print query and exit)
773 put (put the character to the prompt)
774 refresh-preview
775 reload(...) (see below for the details)
776 replace-query (replace query string with the current
777 selection)
778 select
779 select-all (select all matches)
780 toggle (right-click)
781 toggle-all (toggle all matches)
782 toggle+down ctrl-i (tab)
783 toggle-in (--layout=reverse* ? toggle+up : tog‐
784 gle+down)
785 toggle-out (--layout=reverse* ? toggle+down : tog‐
786 gle+up)
787 toggle-preview
788 toggle-preview-wrap
789 toggle-search (toggle search functionality)
790 toggle-sort
791 toggle+up btab (shift-tab)
792 unbind(...) (unbind bindings)
793 unix-line-discard ctrl-u
794 unix-word-rubout ctrl-w
795 up ctrl-k ctrl-p up
796 yank ctrl-y
797
798
799 ACTION COMPOSITION
800 Multiple actions can be chained using + separator.
801
802 e.g.
803 fzf --multi --bind 'ctrl-a:select-all+accept'
804 fzf --multi --bind 'ctrl-a:select-all' --bind 'ctrl-a:+accept'
805
806
807 ACTION ARGUMENT
808 An action denoted with (...) suffix takes an argument.
809
810 e.g.
811 fzf --bind 'ctrl-a:change-prompt(NewPrompt> )'
812 fzf --bind 'ctrl-v:preview(cat {})' --preview-window hidden
813
814 If the argument contains parentheses, fzf may fail to parse the expres‐
815 sion. In that case, you can use any of the following alternative nota‐
816 tions to avoid parse errors.
817
818 action-name[...]
819 action-name~...~
820 action-name!...!
821 action-name@...@
822 action-name#...#
823 action-name$...$
824 action-name%...%
825 action-name^...^
826 action-name&...&
827 action-name*...*
828 action-name;...;
829 action-name/.../
830 action-name|...|
831 action-name:...
832 The last one is the special form that frees you from parse er‐
833 rors as it does not expect the closing character. The catch is
834 that it should be the last one in the comma-separated list of
835 key-action pairs.
836
837
838 COMMAND EXECUTION
839 With execute(...) action, you can execute arbitrary commands without
840 leaving fzf. For example, you can turn fzf into a simple file browser
841 by binding enter key to less command like follows.
842
843 fzf --bind "enter:execute(less {})"
844
845 You can use the same placeholder expressions as in --preview.
846
847 fzf switches to the alternate screen when executing a command. However,
848 if the command is expected to complete quickly, and you are not inter‐
849 ested in its output, you might want to use execute-silent instead,
850 which silently executes the command without the switching. Note that
851 fzf will not be responsive until the command is complete. For asynchro‐
852 nous execution, start your command as a background process (i.e. ap‐
853 pending &).
854
855 On *nix systems, fzf runs the command with $SHELL -c if SHELL is set,
856 otherwise with sh -c, so in this case make sure that the command is
857 POSIX-compliant.
858
859
860 RELOAD INPUT
861 reload(...) action is used to dynamically update the input list without
862 restarting fzf. It takes the same command template with placeholder ex‐
863 pressions as execute(...).
864
865 See https://github.com/junegunn/fzf/issues/1750 for more info.
866
867 e.g.
868 # Update the list of processes by pressing CTRL-R
869 ps -ef | fzf --bind 'ctrl-r:reload(ps -ef)' --header 'Press CTRL-R
870 to reload' \
871 --header-lines=1 --layout=reverse
872
873 # Integration with ripgrep
874 RG_PREFIX="rg --column --line-number --no-heading --color=always
875 --smart-case "
876 INITIAL_QUERY="foobar"
877 FZF_DEFAULT_COMMAND="$RG_PREFIX '$INITIAL_QUERY'" \
878 fzf --bind "change:reload:$RG_PREFIX {q} || true" \
879 --ansi --disabled --query "$INITIAL_QUERY"
880
881
882 PREVIEW BINDING
883 With preview(...) action, you can specify multiple different preview
884 commands in addition to the default preview command given by --preview
885 option.
886
887 e.g.
888
889 # Default preview command with an extra preview binding
890 fzf --preview 'file {}' --bind '?:preview:cat {}'
891
892 # A preview binding with no default preview command
893 # (Preview window is initially empty)
894 fzf --bind '?:preview:cat {}'
895
896 # Preview window hidden by default, it appears when you first hit
897 '?'
898 fzf --bind '?:preview:cat {}' --preview-window hidden
899
900
902 Junegunn Choi (junegunn.c@gmail.com)
903
904
906 Project homepage:
907 https://github.com/junegunn/fzf
908
909 Extra Vim plugin:
910 https://github.com/junegunn/fzf.vim
911
912
914 MIT
915
916
917
918fzf 0.28.0 Nov 2021 fzf(1)