diff --git a/lib/appearance.zsh b/lib/appearance.zsh index ffee52b5e..258de7d69 100644 --- a/lib/appearance.zsh +++ b/lib/appearance.zsh @@ -31,8 +31,14 @@ ZSH_THEME_GIT_PROMPT_SUFFIX=")" # At the very end of the prompt ZSH_THEME_GIT_PROMPT_DIRTY="*" # Text to display if the branch is dirty ZSH_THEME_GIT_PROMPT_CLEAN="" # Text to display if the branch is clean +# vcs theming default: Variables for theming the vcs info prompt +ZSH_THEME_VCS_PROMPT_PREFIX="" +ZSH_THEME_VCS_PROMPT_SUFFIX="" +ZSH_THEME_VCS_PROMPT_STAGED="!" +ZSH_THEME_VCS_PROMPT_UNSTAGED="*" + # Setup the prompt with pretty colors setopt prompt_subst # Load the theme -source "$ZSH/themes/$ZSH_THEME.zsh-theme" \ No newline at end of file +source "$ZSH/themes/$ZSH_THEME.zsh-theme" diff --git a/lib/vcs.zsh b/lib/vcs.zsh new file mode 100644 index 000000000..a44abe5d5 --- /dev/null +++ b/lib/vcs.zsh @@ -0,0 +1,24 @@ +autoload -Uz vcs_info + +VCS_BRANCH="%b%u%c" +VCS_ACTION="%a" + +zstyle ':vcs_info:*:prompt:*' check-for-changes true +zstyle ':vcs_info:*:prompt:*' unstagedstr "${ZSH_THEME_VCS_PROMPT_UNSTAGED}" +zstyle ':vcs_info:*:prompt:*' stagedstr "${ZSH_THEME_VCS_PROMPT_STAGED}" +zstyle ':vcs_info:*:prompt:*' actionformats "${VCS_BRANCH}:${VCS_ACTION}" "" +zstyle ':vcs_info:*:prompt:*' formats "${VCS_BRANCH}" "" +zstyle ':vcs_info:*:prompt:*' nvcsformats "" "" + +function vcs_info_prompt() +{ + vcs_info prompt + case $vcs_info_msg_0_ in + "") + return + ;; + *) + echo "$ZSH_THEME_VCS_PROMPT_PREFIX${vcs_info_msg_0_}$ZSH_THEME_VCS_PROMPT_SUFFIX" + ;; + esac +}