From 2cd0d4a9f7a0a0a86c1ee70da9fb970ec18eac50 Mon Sep 17 00:00:00 2001 From: Aaron Jensen Date: Mon, 13 Nov 2017 19:43:52 -0800 Subject: [PATCH] [zsh] Fire zsh precmd functions after cd (#1136) Fixes #915 --- shell/key-bindings.zsh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/shell/key-bindings.zsh b/shell/key-bindings.zsh index aabe53a..c25368c 100644 --- a/shell/key-bindings.zsh +++ b/shell/key-bindings.zsh @@ -36,6 +36,16 @@ fzf-file-widget() { zle -N fzf-file-widget bindkey '^T' fzf-file-widget +# Ensure precmds are run after cd +fzf-redraw-prompt() { + local precmd + for precmd in $precmd_functions; do + $precmd + done + zle reset-prompt +} +zle -N fzf-redraw-prompt + # ALT-C - cd into the selected directory fzf-cd-widget() { local cmd="${FZF_ALT_C_COMMAND:-"command find -L . -mindepth 1 \\( -path '*/\\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \\) -prune \ @@ -48,7 +58,7 @@ fzf-cd-widget() { fi cd "$dir" local ret=$? - zle reset-prompt + zle fzf-redraw-prompt typeset -f zle-line-init >/dev/null && zle zle-line-init return $ret }