Skip to content

Releases: junegunn/fzf

0.45.0

01 Jan 06:41
0.45.0
2024010
Compare
Choose a tag to compare
  • Added transform action to conditionally perform a series of actions
    # Disallow selecting an empty line
    echo -e "1. Hello\n2. Goodbye\n\n3. Exit" |
      fzf --height '~100%' --reverse --header 'Select one' \
          --bind 'enter:transform:[[ -n {} ]] && echo accept || echo "change-header:Invalid selection"'
    
    # Move cursor past the empty line
    echo -e "1. Hello\n2. Goodbye\n\n3. Exit" |
      fzf --height '~100%' --reverse --header 'Select one' \
          --bind 'enter:transform:[[ -n {} ]] && echo accept || echo "change-header:Invalid selection"' \
          --bind 'focus:transform:[[ -n {} ]] && exit; [[ {fzf:action} =~ up$ ]] && echo up || echo down'
    
    # A single key binding to toggle between modes
    fd --type file |
      fzf --prompt 'Files> ' \
          --header 'CTRL-T: Switch between Files/Directories' \
          --bind 'ctrl-t:transform:[[ ! {fzf:prompt} =~ Files ]] &&
                    echo "change-prompt(Files> )+reload(fd --type file)" ||
                    echo "change-prompt(Directories> )+reload(fd --type directory)"'
  • Added placeholder expressions
    • {fzf:action} - The name of the last action performed
    • {fzf:prompt} - Prompt string (including ANSI color codes)
    • {fzf:query} - Synonym for {q}
  • Added support for negative height
    # Terminal height minus 1, so you can still see the command line
    fzf --height=-1
    • This handles a terminal resize better than --height=$(($(tput lines) - 1))
  • Added accept-or-print-query action that acts like accept but prints the current query when there's no match for the query
    # You can make CTRL-R paste the current query when there's no match
    export FZF_CTRL_R_OPTS='--bind enter:accept-or-print-query'
    • Note that there are alternative ways to implement the same strategy
      # 'become' is apparently more versatile but it's not available on Windows.
      export FZF_CTRL_R_OPTS='--bind "enter:become:if [ -z {} ]; then echo {q}; else echo {}; fi"'
      
      # Using the new 'transform' action
      export FZF_CTRL_R_OPTS='--bind "enter:transform:[ -z {} ] && echo print-query || echo accept"'
  • Added show-header and hide-header actions
  • Bug fixes

0.44.1

17 Nov 10:20
0.44.1
d7d2ac3
Compare
Choose a tag to compare
  • Fixed crash when preview window is hidden on focus event

0.44.0

12 Nov 13:10
0.44.0
7320b7d
Compare
Choose a tag to compare
  • (Experimental) Sixel image support in preview window (not available on Windows)

    • bin/fzf-preview.sh is added to demonstrate how to display an image using Kitty image protocol or Sixel. You can use it like so:
      fzf --preview='fzf-preview.sh {}'
  • (Experimental) iTerm2 inline image protocol support in preview window (not available on Windows)

    # Using https://iterm2.com/utilities/imgcat
    fzf --preview 'imgcat -W $FZF_PREVIEW_COLUMNS -H $FZF_PREVIEW_LINES {}'
    image
  • HTTP server can be configured to accept remote connections

    # FZF_API_KEY is required for a non-localhost listen address
    export FZF_API_KEY="$(head -c 32 /dev/urandom | base64)"
    fzf --listen 0.0.0.0:6266
    • To allow remote process execution, use --listen-unsafe instead
      (execute*, reload*, become, preview, change-preview, transform-*)
      fzf --listen-unsafe 0.0.0.0:6266
  • Bug fixes

0.43.0

14 Oct 17:06
0.43.0
d3311d9
Compare
Choose a tag to compare
  • (Experimental) Added support for Kitty image protocol in the preview window (currently not supported on Windows)

    fzf --preview='
      if file --mime-type {} | grep -qF image/; then
        # --transfer-mode=memory is the fastest option but if you want fzf to be able
        # to redraw the image on terminal resize or on "change-preview-window",
        # you need to use --transfer-mode=stream.
        kitty icat --clear --transfer-mode=memory --stdin=no --place=${FZF_PREVIEW_COLUMNS}x${FZF_PREVIEW_LINES}@0x0 {} | sed \$d
      else
        bat --color=always {}
      fi
    '
    image
  • (Experimental) --listen server can report program state in JSON format (GET /)

    # fzf server started in "headless" mode
    fzf --listen 6266 2> /dev/null
    
    # Get program state
    curl localhost:6266 | jq .
    
    # Increase the number of items returned (default: 100)
    curl localhost:6266?limit=1000 | jq .
  • --listen server can be secured by setting $FZF_API_KEY environment
    variable.

    export FZF_API_KEY="$(head -c 32 /dev/urandom | base64)"
    
    # Server
    fzf --listen 6266
    
    # Client
    curl localhost:6266 -H "x-api-key: $FZF_API_KEY" -d 'change-query(yo)'
  • Added toggle-header action

  • Added mouse events for --bind

    • scroll-up (bound to up)
    • scroll-down (bound to down)
    • shift-scroll-up (bound to toggle+up)
    • shift-scroll-down (bound to toggle+down)
    • shift-left-click (bound to toggle)
    • shift-right-click (bound to toggle)
    • preview-scroll-up (bound to preview-up)
    • preview-scroll-down (bound to preview-down)
    # Twice faster scrolling both in the main window and the preview window
    fzf --bind 'scroll-up:up+up,scroll-down:down+down' \
        --bind 'preview-scroll-up:preview-up+preview-up' \
        --bind 'preview-scroll-down:preview-down+preview-down' \
        --preview 'cat {}'
  • Added offset-up and offset-down actions

    # Scrolling will behave similarly to CTRL-E and CTRL-Y of vim
    fzf --bind scroll-up:offset-up,scroll-down:offset-down \
        --bind ctrl-y:offset-up,ctrl-e:offset-down \
        --scroll-off=5
  • Shell extensions

    • Updated bash completion for fzf options
    • bash key bindings no longer requires perl; it will use awk or mawk
      instead if perl is not found
    • Basic context-aware completion for ssh command
    • Applied --scheme=path for better ordering of the result
  • Bug fixes and improvements

0.42.0

14 Jun 15:42
0.42.0
d471067
Compare
Choose a tag to compare
  • Added new info style: --info=right
  • Added new info style: --info=inline-right
  • Added new border style thinblock which uses symbols for legacy computing one eighth block elements
    • Similarly to block, this style is suitable when using a different background color because the window is completely contained within the border.
    • This style may not render correctly depending on the font and the terminal emulator.
    • thinblock
      • BAT_THEME=GitHub fzf --info=right --border=thinblock --preview-window=border-thinblock \
            --margin=3 --scrollbar=▏▕ --preview='bat --color=always --style=numbers {}' \
            --color=light,query:238,fg:238,bg:251,bg+:249,gutter:251,border:248,preview-bg:253
    • block
      • BAT_THEME=GitHub fzf --info=right --border=block --preview-window=border-block \
            --margin=3 --scrollbar=▌▐ --separator=━ --preview='bat --color=always --style=numbers {}' \
            --color=light,query:238,fg:238,bg:251,bg+:249,gutter:251,border:248,preview-bg:253,preview-border:252
        image

0.41.1

27 May 06:57
0.41.1
6eb1874
Compare
Choose a tag to compare
  • Fixed a bug where preview window is not updated when --disabled is set and
    a reload is triggered by change:reload binding

0.41.0

25 May 15:32
0.41.0
098ef4d
Compare
Choose a tag to compare
  • Added color name preview-border and preview-scrollbar

  • Added new border style block which uses block elements

  • --scrollbar can take two characters, one for the main window, the other
    for the preview window

  • Putting it altogether:

    fzf-tmux -p 80% --padding 1,2 --preview 'bat --style=plain --color=always {}' \
        --color 'bg:237,bg+:235,gutter:237,border:238,scrollbar:236' \
        --color 'preview-bg:235,preview-border:236,preview-scrollbar:234' \
        --preview-window 'border-block' --border block --scrollbar '▌▐'
    image
  • Bug fixes and improvements

0.40.0

30 Apr 17:12
0.40.0
fb76893
Compare
Choose a tag to compare
  • Added zero event that is triggered when there's no match
  • New actions
    • Added track action which makes fzf track the current item when the
      search result is updated. If the user manually moves the cursor, or the
      item is not in the updated search result, tracking is automatically
      disabled. Tracking is useful when you want to see the surrounding items
      by deleting the query string.
      # Narrow down the list with a query, point to a command,
      # and hit CTRL-T to see its surrounding commands.
      export FZF_CTRL_R_OPTS="
        --preview 'echo {}' --preview-window up:3:hidden:wrap
        --bind 'ctrl-/:toggle-preview'
        --bind 'ctrl-t:track+clear-query'
        --bind 'ctrl-y:execute-silent(echo -n {2..} | pbcopy)+abort'
        --color header:italic
        --header 'Press CTRL-Y to copy command into clipboard'"
    • Added change-header(...)
    • Added transform-header(...)
    • Added toggle-track action
  • Fixed --track behavior when used with --tac
    • However, using --track with --tac is not recommended. The resulting
      behavior can be very confusing.
  • Bug fixes and improvements

0.39.0

02 Apr 14:37
0.39.0
2023040
Compare
Choose a tag to compare
  • Added one event that is triggered when there's only one match
    # Automatically select the only match
    seq 10 | fzf --bind one:accept
  • Added --track option that makes fzf track the current selection when the
    result list is updated. This can be useful when browsing logs using fzf with
    sorting disabled.
    git log --oneline --graph --color=always | nl |
        fzf --ansi --track --no-sort --layout=reverse-list
  • If you use --listen option without a port number fzf will automatically
    allocate an available port and export it as $FZF_PORT environment
    variable.
    # Automatic port assignment
    fzf --listen --bind 'start:execute-silent:echo $FZF_PORT > /tmp/fzf-port'
    
    # Say hello
    curl "localhost:$(cat /tmp/fzf-port)" -d 'preview:echo Hello, fzf is listening on $FZF_PORT.'
  • A carriage return and a line feed character will be rendered as dim ␍ and
    ␊ respectively.
    printf "foo\rbar\nbaz" | fzf --read0 --preview 'echo {}'
  • fzf will stop rendering a non-displayable character as a space. This will
    likely cause less glitches in the preview window.
    fzf --preview 'head -1000 /dev/random'
  • Bug fixes and improvements

0.38.0

15 Feb 14:27
0.38.0
352ea07
Compare
Choose a tag to compare
  • New actions
    • become(...) - Replace the current fzf process with the specified command using execve(2) system call.
      See https://github.com/junegunn/fzf#turning-into-a-different-process for more information.
      # Open selected files in Vim
      fzf --multi --bind 'enter:become(vim {+})'
      
      # Open the file in Vim and go to the line
      git grep --line-number . |
          fzf --delimiter : --nth 3.. --bind 'enter:become(vim {1} +{2})'
      • This action is not supported on Windows
    • show-preview
    • hide-preview
  • Bug fixes
    • --preview-window 0,hidden should not execute the preview command until toggle-preview action is triggered