From e99731ea852d1faac5390594cd980708edf826cf Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Sun, 8 Nov 2015 00:11:46 +0900 Subject: [shell] Add FZF_ALT_C_COMMAND for ALT-C (#408) --- shell/key-bindings.bash | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'shell/key-bindings.bash') diff --git a/shell/key-bindings.bash b/shell/key-bindings.bash index 0bfd50d6..e9bea78d 100644 --- a/shell/key-bindings.bash +++ b/shell/key-bindings.bash @@ -1,7 +1,7 @@ # Key bindings # ------------ __fzf_select__() { - local cmd="${FZF_CTRL_T_COMMAND:-"command \\find -L . \\( -path '*/\\.*' -o -fstype 'dev' -o -fstype 'proc' \\) -prune \ + local cmd="${FZF_CTRL_T_COMMAND:-"command find -L . \\( -path '*/\\.*' -o -fstype 'dev' -o -fstype 'proc' \\) -prune \ -o -type f -print \ -o -type d -print \ -o -type l -print 2> /dev/null | sed 1d | cut -b3-"}" @@ -29,9 +29,10 @@ __fzf_select_tmux__() { } __fzf_cd__() { - local dir - dir=$(command \find -L ${1:-.} \( -path '*/\.*' -o -fstype 'dev' -o -fstype 'proc' \) -prune \ - -o -type d -print 2> /dev/null | sed 1d | cut -b3- | $(__fzfcmd) +m) && printf 'cd %q' "$dir" + local cmd dir + cmd="${FZF_ALT_C_COMMAND:-"command find -L . \\( -path '*/\\.*' -o -fstype 'dev' -o -fstype 'proc' \\) -prune \ + -o -type d -print 2> /dev/null | sed 1d | cut -b3-"}" + dir=$(eval "$cmd" | $(__fzfcmd) +m) && printf 'cd %q' "$dir" } __fzf_history__() ( -- cgit v1.2.3