@ 261102.1

260907.1 · ad151d84154632a6abec67b40fe326c1ea2c9481

fish: Improve custom CTRL-T command execution (#4909)

The custom CTRL-T command is now executed by the script in the current shell session, instead of being called by fzf through a subshell. This ensures that the value of $dir can't be altered by user initialization scripts, and is also a little faster.

Fix #4498

reading declarations

CHANGELOG.md

@@ -21,6 +21,7 @@ CHANGELOG     - fzf now opens in a tmux or Zellij floating pane by default, so the window it was started from stays visible and can be used while fzf is running         - Requires tmux 3.7+ or Zellij 0.44+         - Set `g:fzf_layout` to pick a different layout+- fish: Fixed custom CTRL-T command not using the prefixed target directory in some cases (#4498)  0.74.3 ------

shell/key-bindings.fish

@@ -104,7 +104,7 @@ function fzf_key_bindings   # Store current token in $dir as root for the 'find' command   function fzf-file-widget -d "List files and folders"     set -l commandline (__fzf_parse_commandline)-    set -lx dir $commandline[1]+    set -l dir $commandline[1]     set -l fzf_query $commandline[2]     set -l prefix $commandline[3] @@ -112,10 +112,17 @@ function fzf_key_bindings       "--reverse --walker=file,dir,follow,hidden --scheme=path" \       "--multi $FZF_CTRL_T_OPTS --print0") -    set -lx FZF_DEFAULT_COMMAND "$FZF_CTRL_T_COMMAND"     set -lx FZF_DEFAULT_OPTS_FILE -    set -l result (eval (__fzfcmd) --walker-root=$dir --query=$fzf_query | string split0)+    set -lx FZF_DEFAULT_COMMAND++    if test -n "$FZF_CTRL_T_COMMAND"+      set -f result (eval $FZF_CTRL_T_COMMAND \| (__fzfcmd) --query=$fzf_query | string split0)+    else+      set -f result (eval (__fzfcmd) --walker-root=$dir --query=$fzf_query | string split0)+    end++    test -n "$result"     and commandline -rt -- (string join -- ' ' $prefix(string escape -n -- $result))' '      commandline -f repaint