Move VCS function in prompt
This commit is contained in:
parent
cff0899edb
commit
69c528842a
|
@ -51,24 +51,6 @@ function prompt_tastytea_shrunkpwd() {
|
|||
print -n ${out}
|
||||
}
|
||||
|
||||
function prompt_tastytea_vcs() {
|
||||
autoload -U vcs_info
|
||||
zmodload zsh/zutil
|
||||
|
||||
zstyle ':vcs_info:*' formats "%F{${prompt_tastytea_colours[vcs]}}(%b)%u%c%f "
|
||||
zstyle ':vcs_info:*' actionformats "%F{${prompt_tastytea_colours[vcs]}}(%b|%F{${prompt_tastytea_colours[highlight]}}%a%F{${prompt_tastytea_colours[vcs]}})%u%c%f "
|
||||
zstyle ':vcs_info:*' stagedstr "%F{${prompt_tastytea_colours[highlight]}}●"
|
||||
zstyle ':vcs_info:*' unstagedstr "%F{${prompt_tastytea_colours[highlight]}}○"
|
||||
|
||||
# Use asynchronous VCS prompt if zsh-async is available
|
||||
if [[ -v ASYNC_VERSION ]]; then
|
||||
[[ ${ASYNC_INIT_DONE} -eq 0 ]] && async_init
|
||||
prompt_tastytea_vcs_async
|
||||
else
|
||||
add-zsh-hook precmd vcs_info
|
||||
fi
|
||||
}
|
||||
|
||||
# Needs <https://github.com/mafredri/zsh-async>
|
||||
function prompt_tastytea_vcs_async() {
|
||||
# From https://vincent.bernat.ch/en/blog/2019-zsh-async-vcs-info
|
||||
|
@ -113,6 +95,24 @@ function prompt_tastytea_vcs_async() {
|
|||
add-zsh-hook chpwd prompt_tastytea_vcs_chpwd
|
||||
}
|
||||
|
||||
function prompt_tastytea_vcs() {
|
||||
autoload -U vcs_info
|
||||
zmodload zsh/zutil
|
||||
|
||||
zstyle ':vcs_info:*' formats "%F{${prompt_tastytea_colours[vcs]}}(%b)%u%c%f "
|
||||
zstyle ':vcs_info:*' actionformats "%F{${prompt_tastytea_colours[vcs]}}(%b|%F{${prompt_tastytea_colours[highlight]}}%a%F{${prompt_tastytea_colours[vcs]}})%u%c%f "
|
||||
zstyle ':vcs_info:*' stagedstr "%F{${prompt_tastytea_colours[highlight]}}●"
|
||||
zstyle ':vcs_info:*' unstagedstr "%F{${prompt_tastytea_colours[highlight]}}○"
|
||||
|
||||
# Use asynchronous VCS prompt if zsh-async is available
|
||||
if [[ -v ASYNC_VERSION ]]; then
|
||||
[[ ${ASYNC_INIT_DONE} -eq 0 ]] && async_init
|
||||
prompt_tastytea_vcs_async
|
||||
else
|
||||
add-zsh-hook precmd vcs_info
|
||||
fi
|
||||
}
|
||||
|
||||
function prompt_tastytea_setup() {
|
||||
if [[ ${ZSH_VERSION[1]} -lt 5 ]]; then
|
||||
print -u2 "This theme needs Zsh >= 5"
|
||||
|
|
Loading…
Reference in New Issue
Block a user