Quick summary
This version introduces many new features centered around the new "raw" mode.
Type | Class | Name | Description |
---|---|---|---|
New | Option | --raw
| Enable raw mode by default |
New | Option | --gutter CHAR
| Set the gutter column character |
New | Option | --gutter-raw CHAR
| Set the gutter column character in raw mode |
Enhancement | Option | --listen SOCKET
| Added support for Unix domain sockets |
New | Action | toggle-raw
| Toggle raw mode |
New | Action | enable-raw
| Enable raw mode |
New | Action | disable-raw
| Disable raw mode |
New | Action | up-match
| Move up to the matching item |
New | Action | down-match
| Move down to the matching item |
New | Action | best
| Move to the matching item with the best score |
New | Color | nomatch
| Color for non-matching items in raw mode |
New | Env Var | FZF_RAW
| Matching status in raw mode (0, 1, or undefined) |
New | Env Var | FZF_DIRECTION
| up or down depending on the layout
|
New | Env Var | FZF_SOCK
| Path to the Unix domain socket fzf is listening on |
Enhancement | Key | CTRL-N
| down -> down-match
|
Enhancement | Key | CTRL-P
| up -> up-match
|
Enhancement | Shell | CTRL-R binding
| Toggle raw mode with ALT-R
|
Enhancement | Shell | CTRL-R binding
| Opt-out with an empty FZF_CTRL_R_COMMAND
|
1. Introducing "raw" mode
This version introduces a new "raw" mode (named so because it shows the list "unfiltered"). In raw mode, non-matching items stay in their original positions, but appear dimmed. This allows you see surrounding items of a match and better understand the context of it. You can enable raw mode by default with --raw
, but it's often more useful when toggled dynamically with the toggle-raw
action.
tree | fzf --reverse --bind alt-r:toggle-raw
While non-matching items are displayed in a dimmed color, they are treated just like matching items, so you can place the cursor on them and perform any action. If you prefer to navigate only through matching items, use the down-match
and up-match
actions, which are from now on bound to CTRL-N
and CTRL-P
respectively, and also to ALT-DOWN
and ALT-UP
.
Key | Action | With --history
|
---|---|---|
down
| down
| |
up
| up
| |
ctrl-j
| down
| |
ctrl-k
| up
| |
ctrl-n
| down-match
| next-history
|
ctrl-p
| up-match
| prev-history
|
alt-down
| down-match
| |
alt-up
| up-match
|
Note
CTRL-N
and CTRL-P
are bound to next-history
and prev-history
when --history
option is enabled, so in that case, you'll need to manually bind them, or use ALT-DOWN
and ALT-UP
instead.
Tip
up-match
and down-match
are equivalent to up
and down
when not in raw mode, so you can safely bind them to up
and arrow
keys if you prefer.
fzf --bind up:up-match,down:down-match
Customizing the behavior
In raw mode, the input list is presented in its original order, unfiltered, and your cursor will not move to the matching item automatically. Here are ways to customize the behavior.
# When the result list is updated, move the cursor to the item with the best score
# (assuming sorting is not disabled)
fzf --raw --bind result:best
# Move to the first matching item in the original list
# - $FZF_RAW is set to 0 when raw mode is enabled and the current item is a non-match
# - $FZF_DIRECTION is set to either 'up' or 'down' depending on the layout direction
fzf --raw --bind 'result:first+transform:[[ $FZF_RAW = 0 ]] && echo $FZF_DIRECTION-match'
Customizing the look
Gutter
To make the mode visually distinct, the gutter column is rendered in a dashed line using ▖
character. But you can customize it with the --gutter-raw CHAR
option.
# Use a thinner gutter instead of the default dashed line
fzf --bind alt-r:toggle-raw --gutter-raw ▎
Color and style of non-matching items
Non-matching items are displayed in a dimmed color by default, but you can change it with the --color nomatch:...
option.
fzf --raw --color nomatch:red
fzf --raw --color nomatch:red:dim
fzf --raw --color nomatch:red:dim:strikethrough
fzf --raw --color nomatch:red:dim:strikethrough:italic
For colored input, dimming alone may not be enough, and you may prefer to remove colors entirely. For that case, a new special style attribute strip
has been added.
fd --color always | fzf --ansi --raw --color nomatch:dim:strip:strikethrough
Conditional actions for raw mode
You may want to perform different actions depending on whether the current item is a match or not. For that, fzf now exports $FZF_RAW
environment variable.
It's:
- Undefined if raw mode is disabled
1
if the current item is a match0
otherwise
# Do not allow selecting non-matching items
fzf --raw --bind 'enter:transform:[[ ${FZF_RAW-1} = 1 ]] && echo accept || echo bell'
Leveraging raw mode in shell integration
The CTRL-R
binding (command history) now lets you toggle raw mode with ALT-R
.
2. Style changes
The screenshot on the right shows the updated gutter style:
This version includes a few minor updates to fzf's classic visual style:
- The gutter column is now narrower, rendered with the left-half block character (
▌
). - Markers no longer use background colors.
- The
--color base16
theme (alias:16
) has been updated for better compatibility with both dark and light themes.
3. --listen
now supports Unix domain sockets
If an argument to --listen
ends with .sock
, fzf will listen on a Unix domain socket at the specified path.
fzf --listen /tmp/fzf.sock --no-tmux
# GET
curl --unix-socket /tmp/fzf.sock http
# POST
curl --unix-socket /tmp/fzf.sock http -d up
Note that any existing file at the given path will be removed before creating the socket, so avoid using an important file path.
4. Added options
--gutter CHAR
The gutter column can now be customized using --gutter CHAR
and styled with --color gutter:...
. Examples:
# Right-aligned gutter
fzf --gutter '▐'
# Even thinner gutter
fzf --gutter '▎'
# Yellow checker pattern
fzf --gutter '▚' --color gutter:yellow
# Classic style
fzf --gutter ' ' --color gutter:reverse
--gutter-raw CHAR
As noted above, the --gutter-raw CHAR
option was also added for customizing the gutter column in raw mode.
5. Added actions
The following actions were introduced to support working with raw mode:
Action | Description |
---|---|
toggle-raw
| Toggle raw mode |
enable-raw
| Enable raw mode |
disable-raw
| Disable raw mode |
up-match
| Move up to the matching item; identical to up if raw mode is disabled
|
down-match
| Move down to the matching item; identical to down if raw mode is disabled
|
best
| Move to the matching item with the best score; identical to first if raw mode is disabled
|
6. Added environment variables
$FZF_DIRECTION
$FZF_DIRECTION
is now exported to child processes, indicating the list direction of the current layout:
up
for the default layoutdown
forreverse
orreverse-list
This simplifies writing transform actions involving layout-dependent actions like {up,down}-match
, {up,down}-selected
, and toggle+{up,down}
.
fzf --raw --bind 'result:first+transform:[[ $FZF_RAW = 0 ]] && echo $FZF_DIRECTION-match'
$FZF_SOCK
When fzf is listening on a Unix domain socket using --listen
, the path to the socket is exported as $FZF_SOCK
, analogous to $FZF_PORT
for TCP sockets.
$FZF_RAW
As described above, $FZF_RAW
is now exported to child processes in raw mode, indicating whether the current item is a match (1
) or not (0
). It is not defined when not in raw mode.
$FZF_CTRL_R_COMMAND
You can opt-out CTRL-R
binding from the shell integration by setting FZF_CTRL_R_COMMAND
to an empty string. Setting it to any other value is not supported and will result in a warning.
# Disable the CTRL-R binding from the shell integration
FZF_CTRL_R_COMMAND= eval "$(fzf --bash)"
7. Added key support for --bind
Pull request #3996 added support for many additional keys for --bind
option, such as ctrl-backspace
.
8. Breaking changes
Hiding the gutter column
In the previous versions, the recommended way to hide the gutter column was to set --color gutter:-1
. That's because the gutter column was just a space character, reversed. But now that it's using a visible character (▌
), applying the default color is no longer enough to hide it. Instead, you can set it to a space character.
# Hide the gutter column
fzf --gutter ' '
# Classic style
fzf --gutter ' ' --color gutter:reverse
--color
option
In the previous versions, some elements had default style attributes applied and you would have to explicitly unset them with regular
attribute if you wanted to reset them. This is no longer needed now, as the default style attributes are applied only when you do not specify any color or style for that element.
# No 'dim', just red and italic.
fzf --ghost 'Type to search' --color ghost:red:italic
Compatibility changes
Starting with this release, fzf is built with Go 1.23. Support for some old OS versions has been dropped.