summaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorAaron Jensen <aaronjensen@gmail.com>2017-11-13 19:43:52 -0800
committerJunegunn Choi <junegunn.c@gmail.com>2017-11-14 12:43:52 +0900
commit2cd0d4a9f7a0a0a86c1ee70da9fb970ec18eac50 (patch)
tree71648df371d1e8eb1b519f73b0351b7f9cf1cd84 /shell
parentfd03aabeb2364924ee6bbdf993a3ba8f927855de (diff)
[zsh] Fire zsh precmd functions after cd (#1136)
Fixes #915
Diffstat (limited to 'shell')
-rw-r--r--shell/key-bindings.zsh12
1 files changed, 11 insertions, 1 deletions
diff --git a/shell/key-bindings.zsh b/shell/key-bindings.zsh
index aabe53ab..c25368cb 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
}