Skip to content
Myr

[fish] Refactor fzf-file-widget

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

- 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.

authored by bitraid · committed by Junegunn Choi · parent cbbd939 · Browse files · 1 file+13 added−18 removed
This commit

State

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

Diff stats

1 file+13 added−18 removed

  • other:+13 added−18 removed

1 file+13 added−18 removed

modified:shell/key-bindings.fish+13 added-18 removed
30 unmodified lines
31 set -l commandline (__fzf_parse_commandline)32 set -lx dir $commandline[1]33 set -l fzf_query $commandline[2]34 set -l prefix $commandline[3]35 set -l result3537 test -n "$FZF_TMUX_HEIGHT"; or set FZF_TMUX_HEIGHT 40%38 begin39 set -lx FZF_DEFAULT_OPTS (__fzf_defaults "--reverse --walker=file,dir,follow,hidden --scheme=path --walker-root=$dir" "$FZF_CTRL_T_OPTS")40 set -lx FZF_DEFAULT_COMMAND "$FZF_CTRL_T_COMMAND"41 set -lx FZF_DEFAULT_OPTS_FILE ''42 set result (eval (__fzfcmd) -m --query=$fzf_query)43 end44 if test -z "$result"45 commandline -f repaint46 return47 else36 set -lx FZF_DEFAULT_OPTS (__fzf_defaults \37 "--reverse --walker=file,dir,follow,hidden --scheme=path --walker-root=$dir" \38 "$FZF_CTRL_T_OPTS --multi")3940 set -lx FZF_DEFAULT_COMMAND "$FZF_CTRL_T_COMMAND"41 set -lx FZF_DEFAULT_OPTS_FILE4243 if set -l result (eval (__fzfcmd) --query=$fzf_query)44 # Remove last token from commandline.49 commandline -t ""45 commandline -t ''46 for i in $result47 commandline -it -- $prefix(string escape -- $i)' '48 end49 end51 for i in $result52 commandline -it -- $prefix53 commandline -it -- (string escape -- $i)54 commandline -it -- ' '55 end5051 commandline -f repaint52 end5354 function fzf-history-widget -d "Show command history"
125 unmodified lines