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.zsh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'shell/key-bindings.zsh') diff --git a/shell/key-bindings.zsh b/shell/key-bindings.zsh index eccc8266..29721fc9 100644 --- a/shell/key-bindings.zsh +++ b/shell/key-bindings.zsh @@ -4,7 +4,7 @@ if [[ $- == *i* ]]; then # CTRL-T - Paste the selected file path(s) into the command line __fsel() { - 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-"}" @@ -27,8 +27,9 @@ bindkey '^T' fzf-file-widget # ALT-C - cd into the selected directory fzf-cd-widget() { - cd "${$(command \find -L . \( -path '*/\.*' -o -fstype 'dev' -o -fstype 'proc' \) -prune \ - -o -type d -print 2> /dev/null | sed 1d | cut -b3- | $(__fzfcmd) +m):-.}" + local 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-"}" + cd "${$(eval "$cmd" | $(__fzfcmd) +m):-.}" zle reset-prompt } zle -N fzf-cd-widget -- cgit v1.2.3