diff options
| author | bitraid <bitraid@protonmail.ch> | 2025-02-13 18:56:46 +0200 |
|---|---|---|
| committer | Junegunn Choi <junegunn.c@gmail.com> | 2025-02-20 08:30:30 +0900 |
| commit | ff8ee9ee4e44a476ee575f3869b17a2cd8635b97 (patch) | |
| tree | 10bf62a69f6c5d3ca43ee61522c4d13ca5bbe308 /shell | |
| parent | cbbd939a94696e68471c43a6212cd24e62dbbb4f (diff) | |
| download | fzf-ff8ee9ee4e44a476ee575f3869b17a2cd8635b97.tar.gz | |
[fish] Refactor fzf-file-widget
- Remove check/set of FZF_TMUX_HEIGHT variable. It is already done by
__fzf_defaults.
- Remove unnecessary begin/end block.
- Simplify result variable check.
- Insert file names using a single call to commandline.
Diffstat (limited to 'shell')
| -rw-r--r-- | shell/key-bindings.fish | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/shell/key-bindings.fish b/shell/key-bindings.fish index 2c8c8df6..e6fdb19f 100644 --- a/shell/key-bindings.fish +++ b/shell/key-bindings.fish @@ -32,27 +32,22 @@ function fzf_key_bindings set -lx dir $commandline[1] set -l fzf_query $commandline[2] set -l prefix $commandline[3] - set -l result - test -n "$FZF_TMUX_HEIGHT"; or set FZF_TMUX_HEIGHT 40% - begin - set -lx FZF_DEFAULT_OPTS (__fzf_defaults "--reverse --walker=file,dir,follow,hidden --scheme=path --walker-root=$dir" "$FZF_CTRL_T_OPTS") - set -lx FZF_DEFAULT_COMMAND "$FZF_CTRL_T_COMMAND" - set -lx FZF_DEFAULT_OPTS_FILE '' - set result (eval (__fzfcmd) -m --query=$fzf_query) - end - if test -z "$result" - commandline -f repaint - return - else + set -lx FZF_DEFAULT_OPTS (__fzf_defaults \ + "--reverse --walker=file,dir,follow,hidden --scheme=path --walker-root=$dir" \ + "$FZF_CTRL_T_OPTS --multi") + + set -lx FZF_DEFAULT_COMMAND "$FZF_CTRL_T_COMMAND" + set -lx FZF_DEFAULT_OPTS_FILE + + if set -l result (eval (__fzfcmd) --query=$fzf_query) # Remove last token from commandline. - commandline -t "" - end - for i in $result - commandline -it -- $prefix - commandline -it -- (string escape -- $i) - commandline -it -- ' ' + commandline -t '' + for i in $result + commandline -it -- $prefix(string escape -- $i)' ' + end end + commandline -f repaint end |
