[zsh] Fix cursor breakage caused by bg rc update

This commit is contained in:
lara 2020-11-10 23:24:46 +01:00
parent 5722fc0250
commit c9ec334c48
2 changed files with 9 additions and 9 deletions

View file

@ -22,14 +22,14 @@ fi
check_rc_update () {
# Get rc dir path
RC_PATH=$(dirname "$(readlink -f ${(%):-%x})")
RC_PATH=$(dirname "$(realpath -- "${(%):-%x}")")
CUR_DIR=`pwd`
CUR_DIR="$(pwd)"
cd $RC_PATH
# In case the network is down, don't lock the terminal
timeout 6 git fetch > /dev/null 2>&1
#
GIT_SSH_COMMAND='ssh -oBatchMode=yes' GIT_TERMINAL_PROMPT=0 timeout 6 git fetch > /dev/null 2>&1
# Timeout returns 124 on timeout
if [ "$?" -ge "124" ]; then
echo 'git_network_unreachable' >> /dev/shm/prompt_msg
@ -37,9 +37,9 @@ check_rc_update () {
# Check if the repo is clean
git_st=$(command git status --porcelain -b 2> /dev/null)
if $(echo "$git_st" | grep '^## .*ahead' &> /dev/null); then
if $(echo "$git_st" | grep '^## .*ahead' > /dev/null 2>&1); then
echo 'git_unpushed' >> /dev/shm/prompt_msg
elif $(echo "$git_st" | grep '^## .*behind' &> /dev/null); then
elif $(echo "$git_st" | grep '^## .*behind' > /dev/null 2>&1); then
echo 'update_rc' >> /dev/shm/prompt_msg
fi
@ -48,7 +48,7 @@ check_rc_update () {
check_sys_update () {
case $(lsb_release -i | awk -F ':\t' '/Distributor ID/{print $2}') in
Arch)
Arch|Artix)
nb_maj=$(checkupdates | wc -l);;
Debian|Ubuntu)
nb_maj=$(aptitude search '~U' | wc -l);;

4
prompt
View file

@ -118,8 +118,8 @@ prompt_msg () {
# Display vim mode while using zle line editing
# https://dougblack.io/words/zsh-vi-mode.html
vim_mode () {
VIM_NORMAL="%{$fg_bold[red]%}[% N]% "
VIM_INSERT="%{$fg_bold[blue]%}[% I]% "
VIM_NORMAL="%{$fg_bold[red]%}[N]"
VIM_INSERT="%{$fg_bold[blue]%}[I]"
VIM_PROMPT="${${KEYMAP/vicmd/$VIM_NORMAL}/(main|viins)/$VIM_INSERT}"
echo "$VIM_PROMPT%{$reset_color%}"
}