From 0fa08b2e004bd1a841e506f767f6035e493aa363 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Thu, 27 May 2021 18:09:23 +0900 Subject: Update .zshrc: refresh vcs_info when prompt is redrawn --- .zshrc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.zshrc b/.zshrc index 0436ad1..2bc8b70 100644 --- a/.zshrc +++ b/.zshrc @@ -219,6 +219,7 @@ bindkey "^U" backward-kill-line # C-j To go to the parent directory. function __cd_parent_dir() { pushd .. > /dev/null + __update_vcs_info zle reset-prompt } zle -N __cd_parent_dir @@ -227,6 +228,7 @@ bindkey "^J" __cd_parent_dir # C-o To go to the previous directory. function __cd_prev_dir() { popd > /dev/null + __update_vcs_info zle reset-prompt } zle -N __cd_prev_dir @@ -257,7 +259,7 @@ zstyle ':vcs_info:*' formats " (%b)%u" zstyle ':vcs_info:*' actionformats ' (%b %a)%u' -function precmd() { +function __update_vcs_info() { psvar=() LANG=en_US.UTF-8 vcs_info if [[ -n "$vcs_info_msg_0_" ]]; then @@ -265,6 +267,10 @@ function precmd() { fi } +function precmd() { + __update_vcs_info +} + PROMPT=" -- cgit v1.2.3-70-g09d2