From afa2c4e0afff5c370df4881bd7317a3a439af83f Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Fri, 28 Feb 2020 17:50:36 +0900 Subject: [PATCH] [fish] Ignore empty environment variables --- shell/key-bindings.fish | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/shell/key-bindings.fish b/shell/key-bindings.fish index 035ba55e..c4bad838 100644 --- a/shell/key-bindings.fish +++ b/shell/key-bindings.fish @@ -10,13 +10,13 @@ function fzf_key_bindings # "-path \$dir'*/\\.*'" matches hidden files/folders inside $dir but not # $dir itself, even if hidden. - set -q FZF_CTRL_T_COMMAND; or set -l FZF_CTRL_T_COMMAND " + test -n "$FZF_CTRL_T_COMMAND"; or set -l FZF_CTRL_T_COMMAND " command find -L \$dir -mindepth 1 \\( -path \$dir'*/\\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' \\) -prune \ -o -type f -print \ -o -type d -print \ -o -type l -print 2> /dev/null | sed 's@^\./@@'" - set -q FZF_TMUX_HEIGHT; or set FZF_TMUX_HEIGHT 40% + test -n "$FZF_TMUX_HEIGHT"; or set FZF_TMUX_HEIGHT 40% begin set -lx FZF_DEFAULT_OPTS "--height $FZF_TMUX_HEIGHT --reverse $FZF_DEFAULT_OPTS $FZF_CTRL_T_OPTS" eval "$FZF_CTRL_T_COMMAND | "(__fzfcmd)' -m --query "'$fzf_query'"' | while read -l r; set result $result $r; end @@ -36,7 +36,7 @@ function fzf_key_bindings end function fzf-history-widget -d "Show command history" - set -q FZF_TMUX_HEIGHT; or set FZF_TMUX_HEIGHT 40% + test -n "$FZF_TMUX_HEIGHT"; or set FZF_TMUX_HEIGHT 40% begin set -lx FZF_DEFAULT_OPTS "--height $FZF_TMUX_HEIGHT $FZF_DEFAULT_OPTS --tiebreak=index --bind=ctrl-r:toggle-sort $FZF_CTRL_R_OPTS +m" @@ -62,10 +62,10 @@ function fzf_key_bindings set -l dir $commandline[1] set -l fzf_query $commandline[2] - set -q FZF_ALT_C_COMMAND; or set -l FZF_ALT_C_COMMAND " + test -n "$FZF_ALT_C_COMMAND"; or set -l FZF_ALT_C_COMMAND " command find -L \$dir -mindepth 1 \\( -path \$dir'*/\\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' \\) -prune \ -o -type d -print 2> /dev/null | sed 's@^\./@@'" - set -q FZF_TMUX_HEIGHT; or set FZF_TMUX_HEIGHT 40% + test -n "$FZF_TMUX_HEIGHT"; or set FZF_TMUX_HEIGHT 40% begin set -lx FZF_DEFAULT_OPTS "--height $FZF_TMUX_HEIGHT --reverse $FZF_DEFAULT_OPTS $FZF_ALT_C_OPTS" eval "$FZF_ALT_C_COMMAND | "(__fzfcmd)' +m --query "'$fzf_query'"' | read -l result @@ -82,8 +82,8 @@ function fzf_key_bindings end function __fzfcmd - set -q FZF_TMUX; or set FZF_TMUX 0 - set -q FZF_TMUX_HEIGHT; or set FZF_TMUX_HEIGHT 40% + test -n "$FZF_TMUX"; or set FZF_TMUX 0 + test -n "$FZF_TMUX_HEIGHT"; or set FZF_TMUX_HEIGHT 40% if [ $FZF_TMUX -eq 1 ] echo "fzf-tmux -d$FZF_TMUX_HEIGHT" else