From 87adeca4fe0d33c2c52b013c7566ec98a69a30ee Mon Sep 17 00:00:00 2001 From: Ayaz Badouraly <ayaz.badouraly@via.ecp.fr> Date: Thu, 15 Dec 2016 02:59:38 +0100 Subject: [PATCH] Fixing unused values of %m in vcs prompt --- via.zsh-theme | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/via.zsh-theme b/via.zsh-theme index 9d15161..0198f9e 100644 --- a/via.zsh-theme +++ b/via.zsh-theme @@ -40,7 +40,7 @@ zstyle ':vcs_info:*' unstagedstr $vcs_unstaged_color zstyle ':vcs_info:*' stagedstr $vcs_staged_color # Thanks to https://github.com/sunaku/home/ -function +vi-git-untracked(){ +function +vi-git-untracked() { if [[ $(git rev-parse --is-inside-work-tree 2> /dev/null) == 'true' ]] && \ git status --porcelain | fgrep '??' &> /dev/null ; then # This will show the marker if there are any untracked files in repo. @@ -58,7 +58,13 @@ function +vi-git-stash() { fi } -zstyle ':vcs_info:git*+set-message:*' hooks git-stash git-untracked +# Erase hook_com[misc] ( ie. %m ) to avoid dealing with backends info outputs +# Add $vcs_clean_color to setup default %b coloring in vcs prompt +function +vi-misc-init() { + hook_com[misc]=$vcs_clean_color +} + +zstyle ':vcs_info:git*+set-message:*' hooks misc-init git-stash git-untracked # In normal formats and actionformats the following replacements are done: # %s : The VCS in use (git, hg, svn, etc.). @@ -73,8 +79,8 @@ zstyle ':vcs_info:git*+set-message:*' hooks git-stash git-untracked # %m : A "misc" replacement. It is at the discretion of the backend to decide what this replacement expands to. local vcs_formats_prefix="%F{magenta}(%F{white}%s%F{magenta})%f" local vcs_formats_hyphen="%F{yellow}-%f" -local vcs_formats_normal="%F{magenta}[$vcs_clean_color%m%c%u%b%F{magenta}]%f" -local vcs_formats_action="%F{magenta}[$vcs_clean_color%m%c%u%b%F{yellow}:%F{red}%a%F{magenta}]%f" +local vcs_formats_normal="%F{magenta}[%m%c%u%b%F{magenta}]%f" +local vcs_formats_action="%F{magenta}[%m%c%u%b%F{yellow}:%F{red}%a%F{magenta}]%f" zstyle ':vcs_info:*' formats " $vcs_formats_prefix$vcs_formats_hyphen$vcs_formats_normal" zstyle ':vcs_info:*' actionformats " $vcs_formats_prefix$vcs_formats_hyphen$vcs_formats_action" -- GitLab