From 2209f79d80fa59c258a82897edfd7b05f53f341b Mon Sep 17 00:00:00 2001 From: srdusr Date: Thu, 25 May 2023 18:03:52 +0200 Subject: Fixed prompt not always showing mode accurately --- .config/zsh/.zshrc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to '.config/zsh') diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index 9c1f961..b5e9659 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -139,10 +139,20 @@ function set-prompt() { %{%{$terminfo_down_sc$VI_MODE$terminfo[rc]%}%{└─%{["%{$(tput setaf 226)%}""%{$(tput blink)%}"%{$%}"%{$(tput sgr0)%}"%{%G]%}%}%}%}" } +#function update-mode-file() { +# set-prompt +# echo "$VI_MODE" >| ~/.vi-mode +# tmux refresh-client -S +#} function update-mode-file() { set-prompt - echo "$VI_MODE" >| ~/.vi-mode - tmux refresh-client -S + local current_mode=$(cat ~/.vi-mode) + local new_mode="$VI_MODE" + + if [[ "$new_mode" != "$current_mode" ]]; then + echo "$new_mode" >| ~/.vi-mode + tmux refresh-client -S + fi } function zle-line-init() { -- cgit v1.2.3