diff options
| author | bitraid <bitraid@protonmail.ch> | 2025-02-27 12:36:57 +0200 |
|---|---|---|
| committer | Junegunn Choi <junegunn.c@gmail.com> | 2025-04-18 21:06:25 +0900 |
| commit | 1a8f63361193446370eb0aec8206091afceaac76 (patch) | |
| tree | 27c15c639a3ef55df90dd7ac5623dbf789302863 /shell/key-bindings.fish | |
| parent | af8fe918d863b18160390a79cbf957ee28dead56 (diff) | |
| download | fzf-1a8f63361193446370eb0aec8206091afceaac76.tar.gz | |
[fish] Fix for file/dir names containing newlines
CTRL-T/ALT-C now works correctly when selecting files or directories
that contain newlines in their names. When external commands defined by
$FZF_CTRL_T_COMMAND/$FZF_ALT_C_COMMAND are used (for example the fd
command with -0 switch), the --read0 option must also be set through
$FZF_CTRL_T_OPTS/$FZF_ALT_C_OPTS.
Diffstat (limited to 'shell/key-bindings.fish')
| -rw-r--r-- | shell/key-bindings.fish | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/shell/key-bindings.fish b/shell/key-bindings.fish index 5083309f..658addbb 100644 --- a/shell/key-bindings.fish +++ b/shell/key-bindings.fish @@ -96,12 +96,12 @@ function fzf_key_bindings set -lx FZF_DEFAULT_OPTS (__fzf_defaults \ "--reverse --walker=file,dir,follow,hidden --scheme=path --walker-root=$dir" \ - "$FZF_CTRL_T_OPTS --multi") + "$FZF_CTRL_T_OPTS --multi --print0") set -lx FZF_DEFAULT_COMMAND "$FZF_CTRL_T_COMMAND" set -lx FZF_DEFAULT_OPTS_FILE - if set -l result (eval (__fzfcmd) --query=$fzf_query) + if set -l result (eval (__fzfcmd) --query=$fzf_query | string split0) # Remove last token from commandline. commandline -t '' for i in $result @@ -155,12 +155,12 @@ function fzf_key_bindings set -lx FZF_DEFAULT_OPTS (__fzf_defaults \ "--reverse --walker=dir,follow,hidden --scheme=path --walker-root=$dir" \ - "$FZF_ALT_C_OPTS --no-multi") + "$FZF_ALT_C_OPTS --no-multi --print0") set -lx FZF_DEFAULT_OPTS_FILE set -lx FZF_DEFAULT_COMMAND "$FZF_ALT_C_COMMAND" - if set -l result (eval (__fzfcmd) --query=$fzf_query) + if set -l result (eval (__fzfcmd) --query=$fzf_query | string split0) cd -- $result commandline -rt -- $prefix end |
