diff --git a/README.md b/README.md index 52e0b74bd4f410de410d28152fee88fab0a8eee4..a7aeefaa26e5eabce44757b550211b4ea23445d8 100644 --- a/README.md +++ b/README.md @@ -12,9 +12,11 @@ Info ### VCS caption -| Color | State | -|:-----:|:-----:| -| green | any | +| Color | State | Variable | +|:------:|:--------------------------:|:-----------------------------:| +| red | there are unstaged files | `OHMYVIA_VCS_UNSTAGED_COLOR` | +| yellow | there are staged files | `OHMYVIA_VCS_STAGED_COLOR` | +| green | working directory is clean | `OHMYVIA_VCS_CLEAN_COLOR` | Usage diff --git a/via.zsh-theme b/via.zsh-theme index df7c1729b849c5e463eeb5c25711caae27c5b259..0b84e8c9efc01ff4570d54e95f5b2f95b07fa6bf 100644 --- a/via.zsh-theme +++ b/via.zsh-theme @@ -28,6 +28,10 @@ autoload -Uz vcs_info zstyle ':vcs_info:*' enable git zstyle ':vcs_info:*' check-for-changes true +local vcs_unstaged_color=${OHMYVIA_VCS_UNSTAGED_COLOR:-"$fg[red]"} +local vcs_staged_color=${OHMYVIA_VCS_STAGED_COLOR:-"$fg[yellow]"} +local vcs_clean_color=${OHMYVIA_VCS_CLEAN_COLOR:-"$fg[green]"} + # In normal formats and actionformats the following replacements are done: # %s : The VCS in use (git, hg, svn, etc.). # %b : Information about the current branch. @@ -39,10 +43,12 @@ zstyle ':vcs_info:*' check-for-changes true # %r : The repository name. If %R is /foo/bar/repoXY, %r is repoXY. # %S : A subdirectory within a repository. If $PWD is /foo/bar/repoXY/beer/tasty, %S is beer/tasty. # %m : A "misc" replacement. It is at the discretion of the backend to decide what this replacement expands to. +zstyle ':vcs_info:*' stagedstr "%{$vcs_staged_color%}" +zstyle ':vcs_info:*' unstagedstr "%{$vcs_unstaged_color%}" zstyle ':vcs_info:*' formats \ - "%{$fg[magenta]%}(%{$fg[white]%}%s%{$fg[magenta]%})%{$fg[yellow]%}-%{$fg[magenta]%}[%{$fg[green]%}%b%{$fg[magenta]%}]%{$reset_color%}" + " %{$fg[magenta]%}(%{$fg[white]%}%s%{$fg[magenta]%})%{$fg[yellow]%}-%{$fg[magenta]%}[%{$vcs_clean_color%}%c%u%b%{$fg[magenta]%}]%{$reset_color%}" zstyle ':vcs_info:*' actionformats \ - "%{$fg[magenta]%}(%{$fg[white]%}%s%{$fg[magenta]%})%{$fg[yellow]%}-%{$fg[magenta]%}[%{$fg[green]%}%b%{$fg[yellow]%}:%{$fg[red]%}%a%{$fg[magenta]%}]%{$reset_color%}" + " %{$fg[magenta]%}(%{$fg[white]%}%s%{$fg[magenta]%})%{$fg[yellow]%}-%{$fg[magenta]%}[%{$vcs_clean_color%}%c%u%b%{$fg[yellow]%}:%{$fg[red]%}%a%{$fg[magenta]%}]%{$reset_color%}" precmd () { vcs_info } RPROMPT='${vcs_info_msg_0_}'