Skip to content
Myr

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

Before adoption: this commit came in with the history the project adopted, so no landing records it.

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

authored by bitraid · committed by GitHub · parent 7e63399 · Browse files · 2 files+11 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+11 added−3 removed

  • other:+11 added−3 removed

2 files+11 added−3 removed

modified:shell/key-bindings.fish+10 added-3 removed
102 unmodified lines
103104 # Store current token in $dir as root for the 'find' command105 function fzf-file-widget -d "List files and folders"106 set -l commandline (__fzf_parse_commandline)107 set -lx dir $commandline[1]107 set -l dir $commandline[1]108 set -l fzf_query $commandline[2]109 set -l prefix $commandline[3]110111 set -lx FZF_DEFAULT_OPTS (__fzf_defaults \112 "--reverse --walker=file,dir,follow,hidden --scheme=path" \113 "--multi $FZF_CTRL_T_OPTS --print0")114115 set -lx FZF_DEFAULT_COMMAND "$FZF_CTRL_T_COMMAND"115 set -lx FZF_DEFAULT_OPTS_FILE116117 set -lx FZF_DEFAULT_COMMAND118119 if test -n "$FZF_CTRL_T_COMMAND"120 set -f result (eval $FZF_CTRL_T_COMMAND \| (__fzfcmd) --query=$fzf_query | string split0)121 else118 set -l result (eval (__fzfcmd) --walker-root=$dir --query=$fzf_query | string split0)122 set -f result (eval (__fzfcmd) --walker-root=$dir --query=$fzf_query | string split0)123 end124125 test -n "$result"126 and commandline -rt -- (string join -- ' ' $prefix(string escape -n -- $result))' '127128 commandline -f repaint129 end
94 unmodified lines
modified:CHANGELOG.md+1 added
19 unmodified lines
20 ```21 - 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 running22 - Requires tmux 3.7+ or Zellij 0.44+23 - Set `g:fzf_layout` to pick a different layout24- fish: Fixed custom CTRL-T command not using the prefixed target directory in some cases (#4498)25260.74.327------28- Performance optimizations for non-ASCII input
3421 unmodified lines