diff --git a/functions b/functions index e1189eb..296b7b9 100755 --- a/functions +++ b/functions @@ -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);; diff --git a/prompt b/prompt index 8054dbe..a5e62fa 100644 --- a/prompt +++ b/prompt @@ -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%}" }