fzf(1) | fzf - a command-line fuzzy finder | fzf(1) |
fzf - a command-line fuzzy finder
fzf [options]
fzf is a general-purpose command-line fuzzy finder.
v2 Optimal scoring algorithm (quality)
v1 Faster but not guaranteed to find the optimal result
(performance)
length Prefers line with shorter length
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
backward-kill-word
backward-word
forward-word
kill-word
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
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%
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
COLOR:
fg Text
bg Background
hl Highlighted substrings
fg+ Text (current line)
bg+ Background (current line)
hl+ Highlighted substrings (current line)
info Info
border Border of the preview window and horizontal separators
(--border)
prompt Prompt
pointer Pointer to the current line
marker Multi-select marker
spinner Streaming input indicator
header Header
fzf overrides $LINES and $COLUMNS so that they represent the exact size 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.
Also, {q} is replaced to the current query string.
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.
If size is given as 0, preview window will not be visible, but fzf will still execute the command in the background.
0 Normal exit
1 No match
2 Error
130 Interrupted with CTRL-C or ESC
A field index expression can be a non-zero integer or a range expression ([BEGIN]..[END]). --nth and --with-nth take a comma-separated list of field index expressions.
1 The 1st field
2 The 2nd field
-1 The last field
-2 The 2nd to last field
3..5 From the 3rd field to the 5th field
2.. From the 2nd field to the last field
..-3 From the 1st field to the 3rd to the last field
.. All the fields
Unless specified otherwise, fzf will start in "extended-search mode". In this mode, you can specify multiple patterns delimited by spaces, such as: 'wild ^music .mp3$ sbtrkt !rmx
You can prepend a backslash to a space (\ ) to match a literal space character.
A term that is prefixed by a single-quote character (') is interpreted as an "exact-match" (or "non-fuzzy") term. fzf will search for the exact occurrences of the string.
A term can be prefixed by ^, or suffixed by $ to become an anchored-match term. Then fzf will search for the lines that start with or end with the given string. An anchored-match term is also an exact-match term.
If a term is prefixed by !, fzf will exclude the lines that satisfy the term from the result. In this case, fzf performs exact match by default.
If you don't prefer fuzzy matching and do not wish to "quote" (prefixing with ') every word, start fzf with -e or --exact option. Note that when --exact is set, '-prefix "unquotes" the term.
A single bar character term acts as an OR operator. For example, the following query matches entries that start with core and end with either go, rb, or py.
e.g. ^core go$ | rb$ | py$
You can customize key bindings of fzf with --bind option which takes a comma-separated list of key binding expressions. Each key binding expression follows the following format: KEY:ACTION
e.g. fzf --bind=ctrl-j:accept,ctrl-k:kill-line
AVAILABLE KEYS: (SYNONYMS)
ctrl-[a-z]
ctrl-space
ctrl-alt-[a-z]
alt-[a-z]
alt-[0-9]
f[1-12]
enter (return ctrl-m)
space
bspace (bs)
alt-up
alt-down
alt-left
alt-right
alt-enter
alt-space
alt-bspace (alt-bs)
alt-/
tab
btab (shift-tab)
esc
del
up
down
left
right
home
end
pgup (page-up)
pgdn (page-down)
shift-up
shift-down
shift-left
shift-right
left-click
right-click
double-click
or any single character
Additionally, a special event named change is available which is triggered whenever the query string is changed.
e.g. fzf --bind change:top
ACTION: DEFAULT BINDINGS (NOTES):
abort ctrl-c ctrl-g ctrl-q esc
accept enter double-click
accept-non-empty (same as accept except that it prevents fzf
from exiting without selection)
backward-char ctrl-b left
backward-delete-char ctrl-h bspace
backward-kill-word alt-bs
backward-word alt-b shift-left
beginning-of-line ctrl-a home
cancel (clears query string if not empty, aborts fzf otherwise)
clear-screen ctrl-l
delete-char del
delete-char/eof ctrl-d
deselect-all
down ctrl-j ctrl-n down
end-of-line ctrl-e end
execute(...) (see below for the details)
execute-silent(...) (see below for the details)
execute-multi(...) (deprecated in favor of {+} expression)
forward-char ctrl-f right
forward-word alt-f shift-right
ignore
jump (EasyMotion-like 2-keystroke movement)
jump-accept (jump and accept)
kill-line
kill-word alt-d
next-history (ctrl-n on --history)
page-down pgdn
page-up pgup
half-page-down
half-page-up
preview-down shift-down
preview-up shift-up
preview-page-down
preview-page-up
previous-history (ctrl-p on --history)
print-query (print query and exit)
replace-query (replace query string with the current selection)
select-all
toggle (right-click)
toggle-all
toggle+down ctrl-i (tab)
toggle-in (--layout=reverse* ? toggle+up :
toggle+down)
toggle-out (--layout=reverse* ? toggle+down :
toggle+up)
toggle-preview
toggle-preview-wrap
toggle-sort
toggle+up btab (shift-tab)
top (move to the top result)
unix-line-discard ctrl-u
unix-word-rubout ctrl-w
up ctrl-k ctrl-p up
yank ctrl-y
Multiple actions can be chained using + separator.
fzf --bind 'ctrl-a:select-all+accept'
With execute(...) action, you can execute arbitrary commands without leaving fzf. For example, you can turn fzf into a simple file browser by binding enter key to less command like follows.
fzf --bind "enter:execute(less {})"
You can use the same placeholder expressions as in --preview.
If the command contains parentheses, fzf may fail to parse the expression. In that case, you can use any of the following alternative notations to avoid parse errors.
execute[...]
execute~...~
execute!...!
execute@...@
execute#...#
execute$...$
execute%...%
execute^...^
execute&...&
execute*...*
execute;...;
execute/.../
execute|...|
execute:...
fzf switches to the alternate screen when executing a command. However, if the command is expected to complete quickly, and you are not interested in its output, you might want to use execute-silent instead, which silently executes the command without the switching. Note that fzf will not be responsive until the command is complete. For asynchronous execution, start your command as a background process (i.e. appending &).
Junegunn Choi (junegunn.c@gmail.com)
Project homepage:
Extra Vim plugin:
MIT
Oct 2018 | fzf 0.17.5 |