1
0
Fork 0

Fix ZSH VCS dirty

main
Ambrose Chua 2021-02-25 23:24:40 +08:00
parent 0719d9cedb
commit 392eb80d40
3 changed files with 10 additions and 12 deletions

View File

@ -4,6 +4,7 @@
" - :noh to clear highlighting
" - gd to go to definition
" - g* to search for current word
" - gq to reformat line into column
"
call plug#begin()

View File

@ -18,6 +18,9 @@ Host pricklypear
User ambrose
Port 26779
Host makerforce.io
Port 26779
Host raspi
Hostname raspi.cacti.makerforce.io
User pi

18
.zshrc
View File

@ -129,8 +129,11 @@ setopt prompt_subst
# prompt: vcs
setup_prompt_vcs() {
autoload -Uz vcs_info
zstyle ':vcs_info:git:*' formats $' %b %u%c'
zstyle ':vcs_info:git:*' actionformats $'%(u..%B)%(c..%B) %b (%a) %u%c'
zstyle ':vcs_info:git:*' stagedstr $'%B'
zstyle ':vcs_info:git:*' unstagedstr $'%B'
#zstyle ':vcs_info:git:*' unstagedstr "$(tput smul)"
zstyle ':vcs_info:git:*' formats $'%u%c%m %b %%b'
zstyle ':vcs_info:git:*' actionformats $'%u%c%m %b (%a) %%b'
zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:*' check-for-changes true
prompt_vcs_enabled=false
@ -140,16 +143,7 @@ setup_prompt_vcs() {
}
format_vcs_info() {
text="$1"
dirty=false
while [[ "${text[-2]}" == " " ]]; do
dirty=true
text="${text[0,-2]}"
done
if $dirty; then
echo "%B$text%b"
else
echo "$text"
fi
echo "$text"
}
slower_functions+=( setup_prompt_vcs )
# prompt: return code