aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2021-05-27 18:09:23 +0900
committernsfisis <nsfisis@gmail.com>2021-05-27 18:09:23 +0900
commit0fa08b2e004bd1a841e506f767f6035e493aa363 (patch)
treecccc9636dcc707286ae73bdd70e7afdd8ab20504
parent01406b99e32fa6209506b4b04bea89449cb408f7 (diff)
downloaddotfiles-0fa08b2e004bd1a841e506f767f6035e493aa363.tar.gz
dotfiles-0fa08b2e004bd1a841e506f767f6035e493aa363.tar.zst
dotfiles-0fa08b2e004bd1a841e506f767f6035e493aa363.zip
Update .zshrc: refresh vcs_info when prompt is redrawn
-rw-r--r--.zshrc8
1 files changed, 7 insertions, 1 deletions
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="