From afa25d8c57f8ffc1ba54623360456baa9321abd7 Mon Sep 17 00:00:00 2001 From: Daniel Gray Date: Wed, 8 Feb 2017 23:05:02 -0600 Subject: [PATCH] [zsh] Do not cd when cancelling alt+c keybind (#840) --- shell/key-bindings.zsh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/shell/key-bindings.zsh b/shell/key-bindings.zsh index abf7559..6ac38d2 100644 --- a/shell/key-bindings.zsh +++ b/shell/key-bindings.zsh @@ -41,7 +41,12 @@ fzf-cd-widget() { local cmd="${FZF_ALT_C_COMMAND:-"command find -L . \\( -path '*/\\.*' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \\) -prune \ -o -type d -print 2> /dev/null | sed 1d | cut -b3-"}" setopt localoptions pipefail 2> /dev/null - cd "${$(eval "$cmd" | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse $FZF_DEFAULT_OPTS $FZF_ALT_C_OPTS" $(__fzfcmd) +m):-.}" + local dir="$(eval "$cmd" | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse $FZF_DEFAULT_OPTS $FZF_ALT_C_OPTS" $(__fzfcmd) +m)" + if [[ -z "$dir" ]]; then + zle redisplay + return 0 + fi + cd "$dir" local ret=$? zle reset-prompt typeset -f zle-line-init >/dev/null && zle zle-line-init