137b45672dd182e798f7bd0c580aa9b634657990

Author
Romain Failliot <romain.failliot@foolstep.com>
Committer
Marc Cornellà <hello@mcornella.com>
Date

Message

feat(bira): improve theme and add support for mercurial (#6631)

Added the red dot (instead of the default `*`) if the branch is dirty.

The bira theme only supported git, now it supports mercurial as well. It
needed ito call `hg_prompt_info` and the `ZSH_THEME_HG_PROMPT_`
variables.

Closes #6631

Diff

 1diff --git a/themes/bira.zsh-theme b/themes/bira.zsh-theme
 2index cdae68d6c33f7c8d7a8fd67898a181dab833b068..4a05bf3bbe7ac6b88f23c1cd397189d02c4c24ba 100644
 3--- a/themes/bira.zsh-theme
 4+++ b/themes/bira.zsh-theme
 5@@ -1,32 +1,32 @@
 6-# ZSH Theme - Preview: https://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png
 7 local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
 8+local user_host="%B%(!.%F{red}.%F{green})%n@%m %{$reset_color%}"
 9+local user_symbol='%(!.#.$)'
10+local current_dir="%B%{$fg[blue]%}%~ %{$reset_color%}"
11 
12-if [[ $UID -eq 0 ]]; then
13-    local user_host='%{$terminfo[bold]$fg[red]%}%n@%m %{$reset_color%}'
14-    local user_symbol='#'
15-else
16-    local user_host='%{$terminfo[bold]$fg[green]%}%n@%m %{$reset_color%}'
17-    local user_symbol='$'
18-fi
19-
20-local current_dir='%{$terminfo[bold]$fg[blue]%}%~ %{$reset_color%}'
21-local git_branch='$(git_prompt_info)'
22+local vcs_branch='$(git_prompt_info)$(hg_prompt_info)'
23 local rvm_ruby='$(ruby_prompt_info)'
24 local venv_prompt='$(virtualenv_prompt_info)'
25 
26 ZSH_THEME_RVM_PROMPT_OPTIONS="i v g"
27 
28-PROMPT="╭─${user_host}${current_dir}${rvm_ruby}${git_branch}${venv_prompt}
29+PROMPT="╭─${user_host}${current_dir}${rvm_ruby}${vcs_branch}${venv_prompt}
30 ╰─%B${user_symbol}%b "
31 RPROMPT="%B${return_code}%b"
32 
33 ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹"
34 ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}"
35+ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}●%{$fg[yellow]%}"
36+ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[yellow]%}"
37+
38+ZSH_THEME_HG_PROMPT_PREFIX="$ZSH_THEME_GIT_PROMPT_PREFIX"
39+ZSH_THEME_HG_PROMPT_SUFFIX="$ZSH_THEME_GIT_PROMPT_SUFFIX"
40+ZSH_THEME_HG_PROMPT_DIRTY="$ZSH_THEME_GIT_PROMPT_DIRTY"
41+ZSH_THEME_HG_PROMPT_CLEAN="$ZSH_THEME_GIT_PROMPT_CLEAN"
42 
43 ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg[red]%}‹"
44 ZSH_THEME_RUBY_PROMPT_SUFFIX="› %{$reset_color%}"
45 
46 ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX="%{$fg[green]%}‹"
47 ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX="› %{$reset_color%}"
48-ZSH_THEME_VIRTUALENV_PREFIX=$ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX
49-ZSH_THEME_VIRTUALENV_SUFFIX=$ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX
50+ZSH_THEME_VIRTUALENV_PREFIX="$ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX"
51+ZSH_THEME_VIRTUALENV_SUFFIX="$ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX"