2015-03-25 18:06:31 +00:00
.ig
The MIT License (MIT)
2021-01-02 15:54:28 +00:00
Copyright (c) 2013-2021 Junegunn Choi
2015-03-25 18:06:31 +00:00
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
. .
2021-06-01 08:00:24 +00:00
.TH fzf 1 "Jun 2021" "fzf 0.27.2" "fzf - a command-line fuzzy finder"
2015-03-25 18:06:31 +00:00
.SH NAME
fzf - a command-line fuzzy finder
.SH SYNOPSIS
fzf [options]
.SH DESCRIPTION
fzf is a general-purpose command-line fuzzy finder.
.SH OPTIONS
.SS Search mode
.TP
.B "-x, --extended"
2015-11-03 13:49:32 +00:00
Extended-search mode. Since 0.10.9, this is enabled by default. You can disable
it with \fB +x\fR or \fB --no-extended\fR .
2015-03-25 18:06:31 +00:00
.TP
2015-11-03 13:49:32 +00:00
.B "-e, --exact"
Enable exact-match
2015-03-25 18:06:31 +00:00
.TP
.B "-i"
Case-insensitive match (default: smart-case match)
.TP
.B "+i"
Case-sensitive match
2016-09-07 00:58:18 +00:00
.TP
2017-01-15 04:22:09 +00:00
.B "--literal"
Do not normalize latin script letters for matching.
2017-01-08 18:12:23 +00:00
.TP
2016-09-07 00:58:18 +00:00
.BI "--algo=" TYPE
Fuzzy matching algorithm (default: v2)
.br
.BR v2 " Optimal scoring algorithm (quality)"
.br
.BR v1 " Faster but not guaranteed to find the optimal result (performance)"
.br
2015-03-25 18:06:31 +00:00
.TP
.BI "-n, --nth=" "N[,..]"
Comma-separated list of field index expressions for limiting search scope.
2016-06-11 17:15:11 +00:00
See \fB FIELD INDEX EXPRESSION\fR for the details.
2015-03-25 18:06:31 +00:00
.TP
.BI "--with-nth=" "N[,..]"
2016-06-11 17:15:11 +00:00
Transform the presentation of each line using field index expressions
2015-03-25 18:06:31 +00:00
.TP
.BI "-d, --delimiter=" "STR"
2015-06-21 08:40:36 +00:00
Field delimiter regex for \fB --nth\fR and \fB --with-nth\fR (default: AWK-style)
2019-11-12 16:27:39 +00:00
.TP
2021-01-02 15:00:40 +00:00
.BI "--disabled"
2019-11-12 16:27:39 +00:00
Do not perform search. With this option, fzf becomes a simple selector
2021-01-02 15:00:40 +00:00
interface rather than a "fuzzy finder". You can later enable the search using
2021-01-09 19:46:00 +00:00
\fB enable-search\fR or \fB toggle-search\fR action.
2015-03-25 18:06:31 +00:00
.SS Search result
.TP
.B "+s, --no-sort"
Do not sort the result
.TP
.B "--tac"
Reverse the order of the input
2016-06-11 17:15:11 +00:00
2015-03-25 18:06:31 +00:00
.RS
2019-11-12 16:27:39 +00:00
e.g.
\fB history | fzf --tac --no-sort\fR
2015-03-25 18:06:31 +00:00
.RE
2015-04-16 05:19:28 +00:00
.TP
2016-01-12 18:07:42 +00:00
.BI "--tiebreak=" "CRI[,..]"
Comma-separated list of sort criteria to apply when the scores are tied.
2015-04-16 05:19:28 +00:00
.br
2016-02-11 22:46:10 +00:00
2015-04-16 05:19:28 +00:00
.br
2016-06-11 17:15:11 +00:00
.BR length " Prefers line with shorter length"
2015-04-16 05:19:28 +00:00
.br
2016-06-11 17:15:11 +00:00
.BR begin " Prefers line with matched substring closer to the beginning"
2015-04-16 05:19:28 +00:00
.br
2016-06-11 17:15:11 +00:00
.BR end " Prefers line with matched substring closer to the end"
2015-04-16 05:19:28 +00:00
.br
2016-06-11 17:15:11 +00:00
.BR index " Prefers line that appeared earlier in the input stream"
2015-04-16 05:19:28 +00:00
.br
2016-02-11 22:46:10 +00:00
2016-01-12 18:07:42 +00:00
.br
- Each criterion should appear only once in the list
.br
- \fB index\fR is only allowed at the end of the list
.br
- \fB index\fR is implicitly appended to the list when not specified
.br
- Default is \fB length\fR (or equivalently \fB length\fR ,index)
2016-06-11 17:15:11 +00:00
.br
- If \fB end\fR is found in the list, fzf will scan each line backwards
2015-03-25 18:06:31 +00:00
.SS Interface
.TP
.B "-m, --multi"
2019-11-12 16:27:39 +00:00
Enable multi-select with tab/shift-tab. It optionally takes an integer argument
which denotes the maximum number of items that can be selected.
2015-03-25 18:06:31 +00:00
.TP
2017-08-01 12:34:44 +00:00
.B "+m, --no-multi"
Disable multi-select
.TP
2015-03-25 18:06:31 +00:00
.B "--no-mouse"
Disable mouse
.TP
2016-06-11 17:15:11 +00:00
.BI "--bind=" "KEYBINDS"
2019-11-12 16:27:39 +00:00
Comma-separated list of custom key bindings. See \fB KEY/EVENT BINDINGS\fR for
the details.
2015-03-25 18:06:31 +00:00
.TP
2016-06-11 17:15:11 +00:00
.B "--cycle"
Enable cyclic scroll
.TP
2020-03-11 13:35:24 +00:00
.B "--keep-right"
Keep the right end of the line visible when it's too long. Effective only when
the query string is empty.
.TP
2016-06-11 17:15:11 +00:00
.B "--no-hscroll"
Disable horizontal scroll
.TP
.BI "--hscroll-off=" "COL"
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.
.TP
2017-01-15 10:42:28 +00:00
.B "--filepath-word"
Make word-wise movements and actions respect path separators. The following
actions are affected:
\fB backward-kill-word\fR
.br
\fB backward-word\fR
.br
\fB forward-word\fR
.br
\fB kill-word\fR
.TP
2016-06-11 17:15:11 +00:00
.BI "--jump-labels=" "CHARS"
Label characters for \fB jump\fR and \fB jump-accept\fR
.SS Layout
2015-03-25 18:06:31 +00:00
.TP
2017-01-07 16:30:31 +00:00
.BI "--height=" "HEIGHT[%]"
Display fzf window below the cursor with the given height instead of using
2017-01-15 17:39:37 +00:00
the full screen.
2017-01-07 16:30:31 +00:00
.TP
2017-01-09 16:04:36 +00:00
.BI "--min-height=" "HEIGHT"
Minimum height when \fB --height\fR is given in percent (default: 10).
Ignored when \fB --height\fR is not specified.
2018-06-09 16:41:50 +00:00
.TP
.BI "--layout=" "LAYOUT"
Choose the layout (default: default)
.br
.BR default " Display from the bottom of the screen"
.br
.BR reverse " Display from the top of the screen"
.br
.BR reverse-list " Display from the top of the screen, prompt at the bottom"
.br
2017-01-09 16:04:36 +00:00
.TP
2015-03-25 18:06:31 +00:00
.B "--reverse"
2018-06-09 16:41:50 +00:00
A synonym for \fB --layout=reverse\fB
2015-03-25 18:06:31 +00:00
.TP
2020-03-05 11:15:15 +00:00
.BI "--border" [=STYLE]
Draw border around the finder
.br
.BR rounded " Border with rounded corners (default)"
.br
.BR sharp " Border with sharp corners"
.br
.BR horizontal " Horizontal lines above and below the finder"
.br
2020-10-26 13:33:41 +00:00
.BR vertical " Vertical lines on each side of the finder"
.br
.BR top
.br
.BR bottom
.br
.BR left
.br
.BR right
.br
2021-04-06 08:37:11 +00:00
.BR none
.br
2019-03-28 17:11:03 +00:00
.TP
.B "--no-unicode"
Use ASCII characters instead of Unicode box drawing characters to draw border
2017-02-04 12:51:22 +00:00
.TP
2015-07-26 14:02:04 +00:00
.BI "--margin=" MARGIN
Comma-separated expression for margins around the finder.
.br
2016-02-11 22:46:10 +00:00
2015-07-26 14:02:04 +00:00
.br
.RS
.BR TRBL " Same margin for top, right, bottom, and left"
.br
.BR TB,RL " Vertical, horizontal margin"
.br
.BR T,RL,B " Top, horizontal, bottom margin"
.br
.BR T,R,B,L " Top, right, bottom, left margin"
.br
2016-02-11 22:46:10 +00:00
2015-07-26 14:02:04 +00:00
.br
Each part can be given in absolute number or in percentage relative to the
terminal size with \fB %\fR suffix.
.br
2016-02-11 22:46:10 +00:00
2015-07-26 14:02:04 +00:00
.br
2019-11-12 16:27:39 +00:00
e.g.
\fB fzf --margin 10%
fzf --margin 1,5%\fR
2015-07-26 14:02:04 +00:00
.RE
2020-11-09 11:34:08 +00:00
.TP
.BI "--padding=" PADDING
Comma-separated expression for padding inside the border. Padding is
distinguishable from margin only when \fB --border\fR option is used.
.br
.br
e.g.
\fB fzf --margin 5% --padding 5% --border --preview 'cat {}' \\
--color bg:#222222,preview-bg:#333333\fR
.br
.RS
.BR TRBL " Same padding for top, right, bottom, and left"
.br
.BR TB,RL " Vertical, horizontal padding"
.br
.BR T,RL,B " Top, horizontal, bottom padding"
.br
.BR T,R,B,L " Top, right, bottom, left padding"
.br
.RE
2015-07-26 14:02:04 +00:00
.TP
2019-11-14 15:39:29 +00:00
.BI "--info=" "STYLE"
Determines the display style of finder info.
.br
.BR default " Display on the next line to the prompt"
.br
.BR inline " Display on the same line"
.br
.BR hidden " Do not display finder info"
.br
.TP
.B "--no-info"
A synonym for \fB --info=hidden\fB
2015-04-21 14:50:53 +00:00
.TP
2015-03-25 18:06:31 +00:00
.BI "--prompt=" "STR"
Input prompt (default: '> ')
2015-03-28 17:59:32 +00:00
.TP
2020-02-17 01:19:03 +00:00
.BI "--pointer=" "STR"
Pointer to the current line (default: '>')
.TP
.BI "--marker=" "STR"
Multi-select marker (default: '>')
.TP
2016-06-11 17:15:11 +00:00
.BI "--header=" "STR"
The given string will be printed as the sticky header. The lines are displayed
2018-06-09 16:41:50 +00:00
in the given order from top to bottom regardless of \fB --layout\fR option, and
2016-06-11 17:15:11 +00:00
are not affected by \fB --with-nth\fR . ANSI color codes are processed even when
\fB --ansi\fR is not set.
2015-03-31 13:05:02 +00:00
.TP
2016-06-11 17:15:11 +00:00
.BI "--header-lines=" "N"
The first N lines of the input are treated as the sticky header. When
\fB --with-nth\fR is set, the lines are transformed just like the other
lines that follow.
.SS Display
.TP
.B "--ansi"
Enable processing of ANSI color codes
.TP
.BI "--tabstop=" SPACES
Number of spaces for a tab character (default: 8)
.TP
2020-10-25 10:29:37 +00:00
.BI "--color=" "[BASE_SCHEME][,COLOR_NAME[:ANSI_COLOR][:ANSI_ATTRIBUTES]]..."
2016-06-11 17:15:11 +00:00
Color configuration. The name of the base color scheme is followed by custom
2020-10-25 10:29:37 +00:00
color mappings.
2015-06-21 08:40:36 +00:00
.RS
2016-06-11 17:15:11 +00:00
.B BASE SCHEME:
(default: dark on 256-color terminal, otherwise 16)
2015-11-08 16:42:01 +00:00
2016-06-11 17:15:11 +00:00
\fB dark \fR Color scheme for dark 256-color terminal
\fB light \fR Color scheme for light 256-color terminal
\fB 16 \fR Color scheme for 16-color terminal
2019-12-12 14:03:17 +00:00
\fB bw \fR No colors (equivalent to \fB --no-color\fR )
2015-11-08 16:42:01 +00:00
2020-10-25 10:29:37 +00:00
.B COLOR NAMES:
2019-12-12 14:03:17 +00:00
\fB fg \fR Text
\fB bg \fR Background
\fB preview-fg \fR Preview window text
\fB preview-bg \fR Preview window background
\fB hl \fR Highlighted substrings
\fB fg+ \fR Text (current line)
\fB bg+ \fR Background (current line)
\fB gutter \fR Gutter on the left (defaults to \fB bg+\fR )
\fB hl+ \fR Highlighted substrings (current line)
2021-01-02 15:00:40 +00:00
\fB query \fR Query string
\fB disabled \fR Query string when search is disabled
2020-03-11 00:58:59 +00:00
\fB info \fR Info line (match counters)
\fB border \fR Border around the window (\fB --border\fR and \fB --preview\fR )
2019-12-12 14:03:17 +00:00
\fB prompt \fR Prompt
\fB pointer \fR Pointer to the current line
\fB marker \fR Multi-select marker
\fB spinner \fR Streaming input indicator
\fB header \fR Header
2019-11-12 16:27:39 +00:00
2020-10-25 10:29:37 +00:00
.B ANSI COLORS:
\fB -1 \fR Default terminal foreground/background color
\fB \fR (or the original color of the text)
\fB 0 ~ 15 \fR 16 base colors
2021-05-26 10:32:20 +00:00
\fB black\fR
\fB red\fR
\fB green\fR
\fB yellow\fR
\fB blue\fR
\fB magenta\fR
\fB cyan\fR
\fB white\fR
\fB bright-black\fR (gray | grey)
\fB bright-red\fR
\fB bright-green\fR
\fB bright-yellow\fR
\fB bright-blue\fR
\fB bright-magenta\fR
\fB bright-cyan\fR
\fB bright-white\fR
2020-10-25 10:29:37 +00:00
\fB 16 ~ 255 \fR ANSI 256 colors
\fB #rrggbb \fR 24-bit colors
.B ANSI ATTRIBUTES: (Only applies to foreground colors)
\fB regular \fR Clears previously set attributes; should precede the other ones
\fB bold\fR
\fB underline\fR
\fB reverse\fR
2020-10-25 15:15:30 +00:00
\fB dim\fR
\fB italic\fR
2020-10-25 10:29:37 +00:00
2019-11-12 16:27:39 +00:00
.B EXAMPLES:
\fB # Seoul256 theme with 8-bit colors
2020-10-25 10:29:37 +00:00
# (https://github.com/junegunn/seoul256.vim)
2019-11-12 16:27:39 +00:00
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'\fR
2015-06-21 08:40:36 +00:00
.RE
.TP
2016-11-19 14:13:26 +00:00
.B "--no-bold"
Do not use bold text
.TP
2016-06-11 17:15:11 +00:00
.B "--black"
Use black background
.SS History
.TP
2015-06-21 08:40:36 +00:00
.BI "--history=" "HISTORY_FILE"
Load search history from the specified file and update the file on completion.
When enabled, \fB CTRL-N\fR and \fB CTRL-P\fR are automatically remapped to
\fB next-history\fR and \fB previous-history\fR .
.TP
.BI "--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.
2016-06-11 17:15:11 +00:00
.SS Preview
2015-07-21 16:12:50 +00:00
.TP
2016-06-11 17:15:11 +00:00
.BI "--preview=" "COMMAND"
Execute the given command for the current line and display the result on the
2016-10-03 17:17:36 +00:00
preview window. \fB {}\fR 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 \fB FIELD INDEX
2017-01-27 07:38:42 +00:00
EXPRESSION\fR for the details).
2016-06-11 17:15:11 +00:00
.RS
2019-11-12 16:27:39 +00:00
e.g.
\fB fzf --preview='head -$LINES {}'
ls -l | fzf --preview="echo user={3} when={-4..-2}; cat {-1}" --header-lines=1\fR
2016-10-03 17:17:36 +00:00
2019-02-22 05:33:29 +00:00
fzf exports \fB $FZF_PREVIEW_LINES\fR and \fB $FZF_PREVIEW_COLUMNS\fR so that
they represent the exact size of the preview window. (It also overrides
\fB $LINES\fR and \fB $COLUMNS\fR with the same values but they can be reset
by the default shell, so prefer to refer to the ones with \fB FZF_PREVIEW_\fR
prefix.)
2017-11-30 18:27:58 +00:00
2017-01-27 07:38:42 +00:00
A placeholder expression starting with \fB +\fR flag will be replaced to the
space-separated list of the selected lines (or the current line if no selection
was made) individually quoted.
2019-11-12 16:27:39 +00:00
e.g.
\fB fzf --multi --preview='head -10 {+}'
git log --oneline | fzf --multi --preview 'git show {+1}'\fR
2017-01-27 07:38:42 +00:00
2018-03-30 02:47:46 +00:00
When using a field index expression, leading and trailing whitespace is stripped
from the replacement string. To preserve the whitespace, use the \fB s\fR flag.
2019-02-18 16:12:57 +00:00
Also, \fB {q}\fR is replaced to the current query string, and \fB {n}\fR is
replaced to zero-based ordinal index of the line. Use \fB {+n}\fR if you want
all index numbers when multiple lines are selected.
2017-01-27 07:38:42 +00:00
2019-11-12 16:27:39 +00:00
A placeholder expression with \fB f\fR 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 \fB ARG_MAX\fR .
e.g.
\fB # 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}"\fR
2016-10-03 17:17:36 +00:00
Note that you can escape a placeholder pattern by prepending a backslash.
2018-06-09 16:40:22 +00:00
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.
2020-10-23 12:37:20 +00:00
Since 0.24.0, fzf can render partial preview content before the preview command
completes. ANSI escape sequence for clearing the display (\fB CSI 2 J\fR ) is
supported, so you can use it to implement preview window that is constantly
updating.
e.g.
\fB fzf --preview 'for i in $(seq 100000); do
(( i % 200 == 0 )) && printf "\\ 033[2J"
echo "$i"
sleep 0.01
done'\fR
2016-06-11 17:15:11 +00:00
.RE
2015-07-21 18:21:20 +00:00
.TP
2021-04-06 11:10:55 +00:00
.BI "--preview-window=" "[POSITION][,SIZE[%]][,border-BORDER_OPT][,[no]wrap][,[no]follow][,[no]cycle][,[no]hidden][,+SCROLL[OFFSETS][/DENOM]][,~HEADER_LINES][,default]"
2020-10-09 10:53:51 +00:00
.RS
.B POSITION: (default: right)
\fB up
\fB down
\fB left
\fB right
2020-12-05 12:16:35 +00:00
\fR Determines the layout of the preview window.
2016-06-11 17:15:11 +00:00
2020-12-05 12:16:35 +00:00
* If the argument contains \fB :hidden\fR , the preview window will be hidden by
default until \fB toggle-preview\fR action is triggered.
* If size is given as 0, preview window will not be visible, but fzf will still
2017-01-23 15:23:16 +00:00
execute the command in the background.
2020-12-05 12:16:35 +00:00
* Long lines are truncated by default. Line wrap can be enabled with
\fB :wrap\fR flag.
* Preview window will automatically scroll to the bottom when \fB :follow\fR
flag is set, similarly to how \fB tail -f\fR works.
.RS
e.g.
\fB fzf --preview-window follow --preview 'for i in $(seq 100000); do
echo "$i"
sleep 0.01
(( i % 300 == 0 )) && printf "\\ 033[2J"
done'\fR
.RE
* Cyclic scrolling is enabled with \fB :cycle\fR flag.
* To change the style of the border of the preview window, specify one of
2021-04-06 08:37:11 +00:00
the options for \fB --border\fR with \fB border-\fR prefix.
e.g. \fB border-rounded\fR (border with rounded edges, default),
\fB border-sharp\fR (border with sharp edges), \fB border-left\fR ,
\fB border-none\fR , etc.
2020-08-23 08:05:45 +00:00
2021-03-12 17:24:37 +00:00
* \fB [:+SCROLL[OFFSETS][/DENOM]]\fR determines the initial scroll offset of the
preview window.
- \fB SCROLL\fR can be either a numeric integer or a single-field index expression that refers to a numeric integer.
- The optional \fB OFFSETS\fR part is for adjusting the base offset. It should be given as a series of signed integers (\fB -INTEGER\fR or \fB +INTEGER\fR ).
- The final \fB /DENOM\fR part is for specifying a fraction of the preview window height.
2020-07-26 15:15:25 +00:00
2021-03-12 10:51:28 +00:00
* \fB ~HEADER_LINES\fR keeps the top N lines as the fixed header so that they
are always visible.
2020-12-05 12:16:35 +00:00
* \fB default\fR resets all options previously set to the default.
2020-10-10 16:51:39 +00:00
2016-06-11 17:15:11 +00:00
.RS
2019-11-12 16:27:39 +00:00
e.g.
2020-07-26 15:15:25 +00:00
\fB # Non-default scroll window positions and sizes
2021-04-06 11:10:55 +00:00
fzf --preview="head {}" --preview-window=up,30%
fzf --preview="file {}" --preview-window=down,1
2020-07-26 15:15:25 +00:00
# Initial scroll offset is set to the line number of each line of
2020-08-23 06:57:49 +00:00
# git grep output *minus* 5 lines (-5)
2020-07-26 15:15:25 +00:00
git grep --line-number '' |
2021-03-12 17:24:37 +00:00
fzf --delimiter : --preview 'nl {1}' --preview-window '+{2}-5'
# Preview with bat, matching line in the middle of the window below
# the fixed header of the top 3 lines
#
# ~3 Top 3 lines as the fixed header
# +{2} Base scroll offset extracted from the second field
# +3 Extra offset to compensate for the 3-line header
# /2 Put in the middle of the preview area
#
2020-08-23 06:57:49 +00:00
git grep --line-number '' |
fzf --delimiter : \\
2021-03-12 17:24:37 +00:00
--preview 'bat --style=full --color=always --highlight-line {2} {1}' \\
2021-04-06 11:10:55 +00:00
--preview-window '~3,+{2}+3/2'
2020-07-26 15:15:25 +00:00
2021-03-12 10:51:28 +00:00
# Display top 3 lines as the fixed header
2021-03-12 17:24:37 +00:00
fzf --preview 'bat --style=full --color=always {}' --preview-window '~3'\fR
2016-06-11 17:15:11 +00:00
.RE
2020-10-09 10:53:51 +00:00
2015-05-20 16:51:24 +00:00
.SS Scripting
.TP
.BI "-q, --query=" "STR"
Start the finder with the given query
.TP
.B "-1, --select-1"
2021-05-22 00:47:02 +00:00
If there is only one match for the initial query (\fB --query\fR ), do not start
interactive finder and automatically select the only match
2015-05-20 16:51:24 +00:00
.TP
.B "-0, --exit-0"
2021-05-22 00:47:02 +00:00
If there is no match for the initial query (\fB --query\fR ), do not start
interactive finder and exit immediately
2015-05-20 16:51:24 +00:00
.TP
.BI "-f, --filter=" "STR"
Filter mode. Do not start interactive finder. When used with \fB --no-sort\fR ,
fzf becomes a fuzzy-version of grep.
.TP
.B "--print-query"
Print query as the first line
.TP
.BI "--expect=" "KEY[,..]"
2015-06-21 08:40:36 +00:00
Comma-separated list of keys that can be used to complete fzf in addition to
the default enter key. When this option is set, fzf will print the name of the
key pressed as the first line of its output (or as the second line if
2015-05-20 16:51:24 +00:00
\fB --print-query\fR is also used). The line will be empty if fzf is completed
2017-08-26 17:19:39 +00:00
with the default enter key. If \fB --expect\fR option is specified multiple
times, fzf will expect the union of the keys. \fB --no-expect\fR will clear the
list.
2016-06-11 17:15:11 +00:00
2015-05-20 16:51:24 +00:00
.RS
2019-11-12 16:27:39 +00:00
e.g.
\fB fzf --expect=ctrl-v,ctrl-t,alt-s --expect=f1,f2,~,@\fR
2015-05-20 16:51:24 +00:00
.RE
2015-05-20 12:25:15 +00:00
.TP
2016-09-17 19:52:47 +00:00
.B "--read0"
2017-01-26 02:41:20 +00:00
Read input delimited by ASCII NUL characters instead of newline characters
2016-09-17 19:52:47 +00:00
.TP
.B "--print0"
2017-01-26 02:41:20 +00:00
Print output delimited by ASCII NUL characters instead of newline characters
2016-09-17 19:52:47 +00:00
.TP
2017-03-04 02:29:31 +00:00
.B "--no-clear"
Do not clear finder interface on exit. If fzf was started in full screen mode,
it will not switch back to the original screen, so you'll have to manually run
\fB tput rmcup\fR to return. This option can be used to avoid flickering of the
screen when your application needs to start fzf multiple times in order.
.TP
2015-03-25 18:06:31 +00:00
.B "--sync"
2015-03-28 19:08:37 +00:00
Synchronous search for multi-staged filtering. If specified, fzf will launch
ncurses finder only after the input stream is complete.
2016-06-11 17:15:11 +00:00
2015-03-25 18:06:31 +00:00
.RS
e.g. \fB fzf --multi | fzf --sync\fR
.RE
2017-04-02 02:30:22 +00:00
.TP
.B "--version"
Display version information and exit
2015-03-25 18:06:31 +00:00
2017-08-01 12:34:44 +00:00
.TP
Note that most options have the opposite versions with \fB --no-\fR prefix.
2016-06-11 17:15:11 +00:00
.SH ENVIRONMENT VARIABLES
2015-03-25 18:06:31 +00:00
.TP
.B FZF_DEFAULT_COMMAND
2018-09-30 13:19:09 +00:00
Default command to use when input is tty. On *nix systems, fzf runs the command
2021-02-01 11:07:42 +00:00
with \fB $SHELL -c\fR if \fB SHELL\fR is set, otherwise with \fB sh -c\fR , so in
this case make sure that the command is POSIX-compliant.
2015-03-25 18:06:31 +00:00
.TP
.B FZF_DEFAULT_OPTS
2015-06-21 16:35:36 +00:00
Default options. e.g. \fB export FZF_DEFAULT_OPTS="--extended --cycle"\fR
2015-03-25 18:06:31 +00:00
.SH EXIT STATUS
.BR 0 " Normal exit"
.br
2016-02-26 14:36:07 +00:00
.BR 1 " No match"
.br
.BR 2 " Error"
.br
.BR 130 " Interrupted with \fBCTRL-C\fR or \fBESC\fR"
2015-03-25 18:06:31 +00:00
.SH FIELD INDEX EXPRESSION
A field index expression can be a non-zero integer or a range expression
2015-06-21 08:40:36 +00:00
([BEGIN]..[END]). \fB --nth\fR and \fB --with-nth\fR take a comma-separated list
2015-03-25 18:06:31 +00:00
of field index expressions.
.SS Examples
.BR 1 " The 1st field"
.br
.BR 2 " The 2nd field"
.br
.BR -1 " The last field"
.br
.BR -2 " The 2nd to last field"
.br
.BR 3 ..5 " From the 3rd field to the 5th field"
.br
.BR 2 .. " From the 2nd field to the last field"
.br
.BR ..-3 " From the 1st field to the 3rd to the last field"
.br
.BR .. " All the fields"
.br
.SH EXTENDED SEARCH MODE
2015-11-03 13:49:32 +00:00
Unless specified otherwise, fzf will start in "extended-search mode". In this
mode, you can specify multiple patterns delimited by spaces, such as: \fB 'wild
^music .mp3$ sbtrkt !rmx\fR
2015-03-25 18:06:31 +00:00
2017-08-26 18:32:21 +00:00
You can prepend a backslash to a space (\fB \\ \fR ) to match a literal space
character.
2015-03-25 18:06:31 +00:00
.SS Exact-match (quoted)
2015-09-12 04:31:07 +00:00
A term that is prefixed by a single-quote character (\fB '\fR ) is interpreted as
an "exact-match" (or "non-fuzzy") term. fzf will search for the exact
occurrences of the string.
2015-03-25 18:06:31 +00:00
.SS Anchored-match
2015-09-12 04:31:07 +00:00
A term can be prefixed by \fB ^\fR , or suffixed by \fB $\fR to become an
2016-06-11 17:15:11 +00:00
anchored-match term. Then fzf will search for the lines that start with or end
2015-09-12 04:31:07 +00:00
with the given string. An anchored-match term is also an exact-match term.
2015-03-25 18:06:31 +00:00
.SS Negation
2016-06-11 17:15:11 +00:00
If a term is prefixed by \fB !\fR , fzf will exclude the lines that satisfy the
2016-10-03 17:17:36 +00:00
term from the result. In this case, fzf performs exact match by default.
2015-03-25 18:06:31 +00:00
2015-11-03 13:49:32 +00:00
.SS Exact-match by default
2015-09-12 04:31:07 +00:00
If you don't prefer fuzzy matching and do not wish to "quote" (prefixing with
2015-11-03 13:49:32 +00:00
\fB '\fR ) every word, start fzf with \fB -e\fR or \fB --exact\fR option. Note that
when \fB --exact\fR is set, \fB '\fR -prefix "unquotes" the term.
2015-03-25 18:06:31 +00:00
2015-11-08 15:58:20 +00:00
.SS OR operator
A single bar character term acts as an OR operator. For example, the following
query matches entries that start with \fB core\fR and end with either \fB go\fR ,
\fB rb\fR , or \fB py\fR .
e.g. \fB ^core go$ | rb$ | py$\fR
2019-11-12 16:27:39 +00:00
.SH KEY/EVENT BINDINGS
\fB --bind\fR option allows you to bind \fB a key\fR or \fB an event\fR to one or
more \fB actions\fR . You can use it to customize key bindings or implement
dynamic behaviors.
\fB --bind\fR takes a comma-separated list of binding expressions. Each binding
expression is \fB KEY:ACTION\fR or \fB EVENT:ACTION\fR .
e.g.
\fB fzf --bind=ctrl-j:accept,ctrl-k:kill-line\fR
.SS AVAILABLE KEYS: (SYNONYMS)
\fI ctrl-[a-z]\fR
.br
\fI ctrl-space\fR
.br
2019-11-14 13:39:25 +00:00
\fI ctrl-\\ \fR
.br
\fI ctrl-]\fR
.br
\fI ctrl-^\fR (\fI ctrl-6\fR )
.br
\fI ctrl-/\fR (\fI ctrl-_\fR )
.br
2019-11-12 16:27:39 +00:00
\fI ctrl-alt-[a-z]\fR
.br
2020-12-29 16:59:18 +00:00
\fI alt-[*]\fR (Any case-sensitive single character is allowed)
2019-11-12 16:27:39 +00:00
.br
\fI f[1-12]\fR
.br
\fI enter\fR (\fI return\fR \fI ctrl-m\fR )
.br
\fI space\fR
.br
\fI bspace\fR (\fI bs\fR )
.br
\fI alt-up\fR
.br
\fI alt-down\fR
.br
\fI alt-left\fR
.br
\fI alt-right\fR
.br
\fI alt-enter\fR
.br
\fI alt-space\fR
.br
\fI alt-bspace\fR (\fI alt-bs\fR )
.br
\fI tab\fR
.br
\fI btab\fR (\fI shift-tab\fR )
.br
\fI esc\fR
.br
\fI del\fR
.br
\fI up\fR
.br
\fI down\fR
.br
\fI left\fR
.br
\fI right\fR
.br
\fI home\fR
.br
\fI end\fR
.br
2020-02-23 16:43:19 +00:00
\fI insert\fR
.br
2019-11-12 16:27:39 +00:00
\fI pgup\fR (\fI page-up\fR )
.br
\fI pgdn\fR (\fI page-down\fR )
.br
\fI shift-up\fR
.br
\fI shift-down\fR
.br
\fI shift-left\fR
.br
\fI shift-right\fR
.br
2020-11-24 10:36:58 +00:00
\fI alt-shift-up\fR
.br
\fI alt-shift-down\fR
.br
\fI alt-shift-left\fR
.br
\fI alt-shift-right\fR
.br
2019-11-12 16:27:39 +00:00
\fI left-click\fR
.br
\fI right-click\fR
.br
\fI double-click\fR
.br
or any single character
.SS AVAILABLE EVENTS:
2020-06-07 14:07:03 +00:00
\fI change\fR
.RS
Triggered whenever the query string is changed
e.g.
2020-12-29 16:51:25 +00:00
\fB # Move cursor to the first entry whenever the query is changed
fzf --bind change:first\fR
2020-06-07 14:07:03 +00:00
.RE
2019-11-12 16:27:39 +00:00
2020-06-07 14:07:03 +00:00
\fI backward-eof\fR
.RS
Triggered when the query string is already empty and you try to delete it
backward.
e.g.
\fB fzf --bind backward-eof:abort\fR
.RE
2019-11-12 16:27:39 +00:00
.SS AVAILABLE ACTIONS:
A key or an event can be bound to one or more of the following actions.
2017-05-22 08:07:05 +00:00
2020-02-27 17:38:32 +00:00
\fB ACTION: DEFAULT BINDINGS (NOTES):
\fB abort\fR \fI ctrl-c ctrl-g ctrl-q esc\fR
\fB accept\fR \fI enter double-click\fR
\fB accept-non-empty\fR (same as \fB accept\fR except that it prevents fzf from exiting without selection)
\fB backward-char\fR \fI ctrl-b left\fR
\fB backward-delete-char\fR \fI ctrl-h bspace\fR
\fB backward-delete-char/eof\fR (same as \fB backward-delete-char\fR except aborts fzf if query is empty)
\fB backward-kill-word\fR \fI alt-bs\fR
\fB backward-word\fR \fI alt-b shift-left\fR
\fB beginning-of-line\fR \fI ctrl-a home\fR
\fB cancel\fR (clear query string if not empty, abort fzf otherwise)
2020-12-04 11:34:41 +00:00
\fB change-prompt(...)\fR (change prompt to the given string)
2020-02-27 17:38:32 +00:00
\fB clear-screen\fR \fI ctrl-l\fR
\fB clear-selection\fR (clear multi-selection)
2021-02-01 15:08:54 +00:00
\fB close\fR (close preview window if open, abort fzf otherwise)
2020-02-27 17:38:32 +00:00
\fB clear-query\fR (clear query string)
\fB delete-char\fR \fI del\fR
\fB delete-char/eof\fR \fI ctrl-d\fR (same as \fB delete-char\fR except aborts fzf if query is empty)
2021-02-25 12:14:15 +00:00
\fB deselect\fR
2020-02-27 17:38:32 +00:00
\fB deselect-all\fR (deselect all matches)
2021-01-02 15:00:40 +00:00
\fB disable-search\fR (disable search functionality)
2020-02-27 17:38:32 +00:00
\fB down\fR \fI ctrl-j ctrl-n down\fR
2021-01-02 15:00:40 +00:00
\fB enable-search\fR (enable search functionality)
2020-02-27 17:38:32 +00:00
\fB end-of-line\fR \fI ctrl-e end\fR
\fB execute(...)\fR (see below for the details)
\fB execute-silent(...)\fR (see below for the details)
2020-12-29 16:51:25 +00:00
\fB first\fR (move to the first match)
2020-02-27 17:38:32 +00:00
\fB forward-char\fR \fI ctrl-f right\fR
\fB forward-word\fR \fI alt-f shift-right\fR
2016-06-11 17:15:11 +00:00
\fB ignore\fR
2020-02-27 17:38:32 +00:00
\fB jump\fR (EasyMotion-like 2-keystroke movement)
\fB jump-accept\fR (jump and accept)
2016-06-11 17:15:11 +00:00
\fB kill-line\fR
2020-02-27 17:38:32 +00:00
\fB kill-word\fR \fI alt-d\fR
2020-12-29 16:51:25 +00:00
\fB last\fR (move to the last match)
2020-02-27 17:38:32 +00:00
\fB next-history\fR (\fI ctrl-n\fR on \fB --history\fR )
\fB page-down\fR \fI pgdn\fR
\fB page-up\fR \fI pgup\fR
2017-01-16 02:58:13 +00:00
\fB half-page-down\fR
\fB half-page-up\fR
2020-06-21 13:41:33 +00:00
\fB preview(...)\fR (see below for the details)
2020-02-27 17:38:32 +00:00
\fB preview-down\fR \fI shift-down\fR
\fB preview-up\fR \fI shift-up\fR
2016-09-26 06:33:46 +00:00
\fB preview-page-down\fR
\fB preview-page-up\fR
2020-10-05 12:58:56 +00:00
\fB preview-half-page-down\fR
\fB preview-half-page-up\fR
2020-12-31 03:54:58 +00:00
\fB preview-bottom\fR
\fB preview-top\fR
2020-02-27 17:38:32 +00:00
\fB previous-history\fR (\fI ctrl-p\fR on \fB --history\fR )
\fB print-query\fR (print query and exit)
2020-06-20 13:04:09 +00:00
\fB refresh-preview\fR
2020-02-27 17:38:32 +00:00
\fB reload(...)\fR (see below for the details)
\fB replace-query\fR (replace query string with the current selection)
2021-02-25 12:14:15 +00:00
\fB select\fR
2020-02-27 17:38:32 +00:00
\fB select-all\fR (select all matches)
\fB toggle\fR (\fI right-click\fR )
\fB toggle-all\fR (toggle all matches)
\fB toggle+down\fR \fI ctrl-i (tab)\fR
\fB toggle-in\fR (\fB --layout=reverse*\fR ? \fB toggle+up\fR : \fB toggle+down\fR )
\fB toggle-out\fR (\fB --layout=reverse*\fR ? \fB toggle+down\fR : \fB toggle+up\fR )
2016-06-11 17:15:11 +00:00
\fB toggle-preview\fR
2017-02-18 14:49:00 +00:00
\fB toggle-preview-wrap\fR
2021-01-02 15:00:40 +00:00
\fB toggle-search\fR (toggle search functionality)
2017-01-26 02:54:08 +00:00
\fB toggle-sort\fR
2020-02-27 17:38:32 +00:00
\fB toggle+up\fR \fI btab (shift-tab)\fR
2021-05-22 04:13:55 +00:00
\fB unbind(...)\fR (unbind bindings)
2020-02-27 17:38:32 +00:00
\fB unix-line-discard\fR \fI ctrl-u\fR
\fB unix-word-rubout\fR \fI ctrl-w\fR
\fB up\fR \fI ctrl-k ctrl-p up\fR
\fB yank\fR \fI ctrl-y\fR
2016-06-11 17:15:11 +00:00
2019-11-12 16:27:39 +00:00
.SS ACTION COMPOSITION
2017-01-21 17:32:49 +00:00
Multiple actions can be chained using \fB +\fR separator.
2019-11-12 16:27:39 +00:00
e.g.
2020-12-04 11:34:41 +00:00
\fB fzf --multi --bind 'ctrl-a:select-all+accept'\fR
\fB fzf --multi --bind 'ctrl-a:select-all' --bind 'ctrl-a:+accept'\fR
2019-11-12 16:27:39 +00:00
2020-12-04 11:34:41 +00:00
.SS ACTION ARGUMENT
2017-01-21 17:32:49 +00:00
2020-12-04 11:34:41 +00:00
An action denoted with \fB (...)\fR suffix takes an argument.
2016-06-11 17:15:11 +00:00
2020-12-04 11:34:41 +00:00
e.g.
\fB fzf --bind 'ctrl-a:change-prompt(NewPrompt> )'\fR
\fB fzf --bind 'ctrl-v:preview(cat {})' --preview-window hidden\fR
2016-10-03 17:17:36 +00:00
2020-12-04 11:34:41 +00:00
If the argument contains parentheses, fzf may fail to parse the expression. In
2016-10-03 17:17:36 +00:00
that case, you can use any of the following alternative notations to avoid
parse errors.
2016-06-11 17:15:11 +00:00
2020-12-04 11:34:41 +00:00
\fB action-name[...]\fR
\fB action-name~...~\fR
\fB action-name!...!\fR
\fB action-name@...@\fR
\fB action-name#...#\fR
\fB action-name$...$\fR
\fB action-name%...%\fR
\fB action-name^...^\fR
\fB action-name&...&\fR
\fB action-name*...*\fR
\fB action-name;...;\fR
\fB action-name/.../\fR
\fB action-name|...|\fR
\fB action-name:...\fR
2016-06-11 17:15:11 +00:00
.RS
2019-11-12 16:27:39 +00:00
The last one is the special form that frees you from parse errors as it does
not expect the closing character. The catch is that it should be the last one
in the comma-separated list of key-action pairs.
2016-06-11 17:15:11 +00:00
.RE
2020-12-04 11:34:41 +00:00
.SS COMMAND EXECUTION
With \fB execute(...)\fR action, you can execute arbitrary commands without
leaving fzf. For example, you can turn fzf into a simple file browser by
binding \fB enter\fR key to \fB less\fR command like follows.
\fB fzf --bind "enter:execute(less {})"\fR
You can use the same placeholder expressions as in \fB --preview\fR .
2017-01-27 08:46:56 +00:00
fzf switches to the alternate screen when executing a command. However, if the
2017-01-29 16:27:12 +00:00
command is expected to complete quickly, and you are not interested in its
2017-01-27 08:46:56 +00:00
output, you might want to use \fB execute-silent\fR instead, which silently
2017-01-29 16:27:12 +00:00
executes the command without the switching. Note that fzf will not be
2018-03-27 08:53:20 +00:00
responsive until the command is complete. For asynchronous execution, start
2017-01-29 16:27:12 +00:00
your command as a background process (i.e. appending \fB &\fR ).
2016-06-11 17:15:11 +00:00
2021-02-01 11:07:42 +00:00
On *nix systems, fzf runs the command with \fB $SHELL -c\fR if \fB SHELL\fR is
set, otherwise with \fB sh -c\fR , so in this case make sure that the command is
POSIX-compliant.
2019-11-12 16:27:39 +00:00
.SS RELOAD INPUT
\fB reload(...)\fR action is used to dynamically update the input list
without restarting fzf. It takes the same command template with placeholder
expressions as \fB execute(...)\fR .
See \fI https://github.com/junegunn/fzf/issues/1750\fR for more info.
e.g.
\fB # Update the list of processes by pressing CTRL-R
ps -ef | fzf --bind 'ctrl-r:reload(ps -ef)' --header 'Press CTRL-R to reload' \\
--header-lines=1 --layout=reverse
# Integration with ripgrep
RG_PREFIX="rg --column --line-number --no-heading --color=always --smart-case "
INITIAL_QUERY="foobar"
FZF_DEFAULT_COMMAND="$RG_PREFIX '$INITIAL_QUERY'" \\
fzf --bind "change:reload:$RG_PREFIX {q} || true" \\
2021-01-02 15:00:40 +00:00
--ansi --disabled --query "$INITIAL_QUERY"\fR
2019-11-12 16:27:39 +00:00
2020-06-21 13:41:33 +00:00
.SS PREVIEW BINDING
With \fB preview(...)\fR action, you can specify multiple different preview
commands in addition to the default preview command given by \fB --preview\fR
option.
e.g.
# Default preview command with an extra preview binding
fzf --preview 'file {}' --bind '?:preview:cat {}'
# A preview binding with no default preview command
# (Preview window is initially empty)
fzf --bind '?:preview:cat {}'
# Preview window hidden by default, it appears when you first hit '?'
fzf --bind '?:preview:cat {}' --preview-window hidden
2015-03-25 18:06:31 +00:00
.SH AUTHOR
2015-03-26 01:31:11 +00:00
Junegunn Choi (\fI junegunn.c@gmail.com\fR )
2015-03-25 18:06:31 +00:00
.SH SEE ALSO
2015-09-12 04:31:07 +00:00
.B Project homepage:
.RS
2015-03-26 01:31:11 +00:00
.I https://github.com/junegunn/fzf
2015-09-12 04:31:07 +00:00
.RE
.br
2016-02-11 22:46:10 +00:00
2015-09-12 04:31:07 +00:00
.br
.B Extra Vim plugin:
.RS
.I https://github.com/junegunn/fzf.vim
.RE
2015-03-25 18:06:31 +00:00
.SH LICENSE
MIT