From 69c528842a9373f964c28ef0397bb3df512751e5 Mon Sep 17 00:00:00 2001 From: tastytea Date: Sun, 24 Apr 2022 19:35:03 +0200 Subject: [PATCH] Move VCS function in prompt --- .config/zsh/functions/prompt_tastytea_setup | 36 ++++++++++----------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/.config/zsh/functions/prompt_tastytea_setup b/.config/zsh/functions/prompt_tastytea_setup index b1e4a70..d3d07d1 100644 --- a/.config/zsh/functions/prompt_tastytea_setup +++ b/.config/zsh/functions/prompt_tastytea_setup @@ -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 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"