Skip to content

Releases: junegunn/fzf

0.66.0

12 Oct 13:24
v0.66.0
8cdfb23
Compare
Choose a tag to compare

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 Name nomatch Color for non-matching items in raw mode
New Color Attr strip Remove original colors
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 match
  • 0 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 layout
  • down for reverse or reverse-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 CTR...
Read more

0.65.2

31 Aug 13:25
v0.65.2
416aff8
Compare
Choose a tag to compare
  • Bug fixes and improvements
    • Fix incorrect truncation of --info-command with --info=inline-right (#4479)
    • [install] Support old uname in macOS (#4492)
    • [bash 3] Fix CTRL-T and ALT-C to preserve the last yank (#4496)
    • Do not unset FZF_DEFAULT_* variables when using winpty (#4497) (#4400)
    • Fix rendering of items with tabs when using a non-default ellipsis (#4505)
  • This is the final release to support Windows 7.
    • Future versions will be built with the latest Go toolchain, which has dropped support for Windows 7.
    • Bug fixes will be backported to go-1.20 branch. You can build your own binary from it.

0.65.1

03 Aug 05:51
v0.65.1
e5cd7f0
Compare
Choose a tag to compare
  • Fixed incorrect $FZF_CLICK_HEADER_WORD and $FZF_CLICK_FOOTER_WORD when the header or footer contains ANSI escape sequences and tab characters.
  • Fixed a bug where you cannot unset the default --nth using change-nth action.
  • Fixed a highlighting bug when using --color fg:dim,nth:regular pattern over ANSI-colored items.

0.65.0

27 Jul 01:43
v0.65.0
04c4269
Compare
Choose a tag to compare
  • Added click-footer event that is triggered when the footer section is clicked. When the event is triggered, the following environment variables are set:
    • $FZF_CLICK_FOOTER_COLUMN - clicked column (1-based)
    • $FZF_CLICK_FOOTER_LINE - clicked line (1-based)
    • $FZF_CLICK_FOOTER_WORD - the word under the cursor
    fzf --footer $'[Edit] [View]\n[Copy to clipboard]' \
        --with-shell 'bash -c' \
        --bind 'click-footer:transform:
          [[ $FZF_CLICK_FOOTER_WORD =~ Edit ]] && echo "execute:vim \{}"
          [[ $FZF_CLICK_FOOTER_WORD =~ View ]] && echo "execute:view \{}"
          (( FZF_CLICK_FOOTER_LINE == 2 )) && (( FZF_CLICK_FOOTER_COLUMN < 20 )) &&
              echo "execute-silent(echo -n \{} | pbcopy)+bell"
        '
  • Added trigger(...) action that triggers events bound to another key or event.
    # You can click on each key name to trigger the actions bound to that key
    fzf --footer 'Ctrl-E: Edit / Ctrl-V: View / Ctrl-Y: Copy to clipboard' \
        --with-shell 'bash -c' \
        --bind 'ctrl-e:execute:vim {}' \
        --bind 'ctrl-v:execute:view {}' \
        --bind 'ctrl-y:execute-silent(echo -n {} | pbcopy)+bell' \
        --bind 'click-footer:transform:
          [[ $FZF_CLICK_FOOTER_WORD =~ Ctrl ]] && echo "trigger(${FZF_CLICK_FOOTER_WORD%:})"
        '
    • You can specify a series of keys and events
      fzf --bind 'a:up,b:trigger(a,a,a)'
  • Added support for {*n} and {*nf} placeholder.
    • {*n} evaluates to the zero-based ordinal index of all matched items.
    • {*nf} evaluates to the temporary file containing that.
  • Bug fixes and improvements
    • [neovim] Fixed margin background color when &winborder is used (#4453)
    • Fixed rendering error when hiding a preview window without border (#4465)
    • fix(shell): check for mawk existence before version check (#4468)
    • Fixed --no-header-lines-border behavior (08027e7)

0.64.0

06 Jul 15:05
v0.64.0
0076ec2
Compare
Choose a tag to compare
  • Added multi event that is triggered when the multi-selection has changed.
    fzf --multi \
        --bind 'ctrl-a:select-all,ctrl-d:deselect-all' \
        --bind 'multi:transform-footer:(( FZF_SELECT_COUNT )) && echo "Selected $FZF_SELECT_COUNT item(s)"'
  • Halfwidth and fullwidth alphanumeric and punctuation characters are now internally normalized to their ASCII equivalents to allow matching with ASCII queries.
    echo ABC| fzf -q abc
  • Renamed clear-selection action to clear-multi for consistency.
    • clear-selection remains supported as an alias for backward compatibility.
  • Bug fixes
    • Fixed a bug that could cause fzf to abort due to incorrect update ordering.
    • Fixed a bug where some multi-selections were lost when using exclude or change-nth.

0.63.0

27 Jun 16:12
v0.63.0
397fe8e
Compare
Choose a tag to compare

Release highlights: https://junegunn.github.io/fzf/releases/0.63.0/

image

  • Added footer. The default border style for footer is line, which draws a single separator line.
    fzf --reverse --footer "fzf: friend zone forever"
    • Options
      • --footer[=STRING]
      • --footer-border[=STYLE]
      • --footer-label=LABEL
      • --footer-label-pos=COL[:bottom]
    • Colors
      • footer
      • footer-bg
      • footer-border
      • footer-label
    • Actions
      • change-footer
      • transform-footer
      • bg-transform-footer
      • change-footer-label
      • transform-footer-label
      • bg-transform-footer-label
  • line border style is now allowed for all types of border except for --list-border.
    fzf --height 50% --style full:line --preview 'cat {}' \
        --bind 'focus:bg-transform-header(file {})+bg-transform-footer(wc {})'
  • Added {*} placeholder flag that evaluates to all matched items.
    seq 10000 | fzf --preview "awk '{sum += \$1} END {print sum}' {*f}"
    • Use this with caution, as it can make fzf sluggish for large lists.
  • Added asynchronous transform actions with bg- prefix that run asynchronously in the background, along with bg-cancel action to cancel currently running bg-transform actions.
    # Implement popup that disappears after 1 second
    #   * Use footer as the popup
    #   * Use `bell` to ring the terminal bell
    #   * Use `bg-transform-footer` to clear the footer after 1 second
    #   * Use `bg-cancel` to cancel currently running background transform actions
    fzf --multi --list-border \
        --bind 'enter:execute-silent(echo -n {+} | pbcopy)+bell' \
        --bind 'enter:+transform-footer(echo Copied {} to clipboard)' \
        --bind 'enter:+bg-cancel+bg-transform-footer(sleep 1)'
    
    # It's okay for the commands to take a little while because they run in the background
    GETTER='curl -s http://metaphorpsum.com/sentences/1'
    fzf --style full --border --preview : \
        --bind "focus:bg-transform-header:$GETTER" \
        --bind "focus:+bg-transform-footer:$GETTER" \
        --bind "focus:+bg-transform-border-label:$GETTER" \
        --bind "focus:+bg-transform-preview-label:$GETTER" \
        --bind "focus:+bg-transform-input-label:$GETTER" \
        --bind "focus:+bg-transform-list-label:$GETTER" \
        --bind "focus:+bg-transform-header-label:$GETTER" \
        --bind "focus:+bg-transform-footer-label:$GETTER" \
        --bind "focus:+bg-transform-ghost:$GETTER" \
        --bind "focus:+bg-transform-prompt:$GETTER"
  • Added support for full-line background color in the list section
    for i in $(seq 16 255); do
      echo -e "\x1b[48;5;${i}m\x1b[0Khello"
    done | fzf --ansi
  • SSH completion enhancements by @akinomyoga
  • Bug fixes and improvements

0.62.0

04 May 10:00
v0.62.0
d226d84
Compare
Choose a tag to compare
  • Relaxed the --color option syntax to allow whitespace-separated entries (in addition to commas), making multi-line definitions easier to write and read
    # seoul256-light
    fzf --style full --color='
      fg:#616161 fg+:#616161
      bg:#ffffff bg+:#e9e9e9 alt-bg:#f1f1f1
      hl:#719872 hl+:#719899
      pointer:#e12672 marker:#e17899
      header:#719872
      spinner:#719899 info:#727100
      prompt:#0099bd query:#616161
      border:#e1e1e1
    '
  • Added alt-bg color to create striped lines to visually separate rows
    fzf --color bg:237,alt-bg:238,current-bg:236 --highlight-line
    
    declare -f | perl -0777 -pe 's/^}\n/}\0/gm' |
      bat --plain --language bash --color always |
      fzf --read0 --ansi --reverse --multi \
          --color bg:237,alt-bg:238,current-bg:236 --highlight-line
  • [fish] Improvements in CTRL-R binding (@bitraid)
    • You can trigger CTRL-R in the middle of a command to insert the selected item
    • You can delete history items with SHIFT-DEL
  • Bug fixes and improvements
    • Fixed unnecessary 100ms delay after reload (#4364)
    • Fixed selected-bg not applied to colored items (#4372)

Screenshot

image

0.61.3

22 Apr 12:55
v0.61.3
d24b58e
Compare
Choose a tag to compare
  • Reverted #4351 as it caused tmux run-shell 'fzf --tmux' to fail (#4559 #4560)
  • More environment variables for child processes (#4356)

0.61.2

20 Apr 02:42
v0.61.2
90ad1b7
Compare
Choose a tag to compare
  • Fixed panic when using header border without pointer/marker (@phanen)
  • Fixed --tmux option when already inside a tmux popup (@peikk0)
  • Bug fixes and improvements in CTRL-T binding of fish (#4334) (@bitraid)
  • Added --no-tty-default option to make fzf search for the current TTY device instead of defaulting to /dev/tty (#4242)

0.61.1

06 Apr 04:15
v0.61.1
93cb375
Compare
Choose a tag to compare
  • Disable bracketed-paste mode on exit. This fixes issue where pasting breaks after running fzf on old bash versions that don't support the mode.