Skip to content
Myr

[fish] Refactor fzf-cd-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. - Set the command line using a single call to commandline.

authored by bitraid · committed by Junegunn Choi · parent 1cf7c0f · Browse files · 1 file+8 added−12 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+8 added−12 removed

  • other:+8 added−12 removed

1 file+8 added−12 removed

modified:shell/key-bindings.fish+8 added-12 removed
87 unmodified lines
88 set -lx dir $commandline[1]89 set -l fzf_query $commandline[2]90 set -l prefix $commandline[3]9192 test -n "$FZF_TMUX_HEIGHT"; or set FZF_TMUX_HEIGHT 40%93 begin94 set -lx FZF_DEFAULT_OPTS (__fzf_defaults "--reverse --walker=dir,follow,hidden --scheme=path --walker-root=$dir" "$FZF_ALT_C_OPTS")95 set -lx FZF_DEFAULT_OPTS_FILE ''96 set -lx FZF_DEFAULT_COMMAND "$FZF_ALT_C_COMMAND"97 set -l result (eval (__fzfcmd) +m --query=$fzf_query)92 set -lx FZF_DEFAULT_OPTS (__fzf_defaults \93 "--reverse --walker=dir,follow,hidden --scheme=path --walker-root=$dir" \94 "$FZF_ALT_C_OPTS --no-multi")9599 if test -n "$result"100 cd -- $result96 set -lx FZF_DEFAULT_OPTS_FILE97 set -lx FZF_DEFAULT_COMMAND "$FZF_ALT_C_COMMAND"98102 # Remove last token from commandline.103 commandline -t ""104 commandline -it -- $prefix105 end99 if set -l result (eval (__fzfcmd) --query=$fzf_query)100 cd -- $result101 commandline -rt -- $prefix102 end103104 commandline -f repaint105 end
75 unmodified lines