updated mercurial plugin

This commit is contained in:
Gregory Liras 2012-02-05 15:59:33 +02:00
commit 5f9a4373e6
2 changed files with 14 additions and 3 deletions

View file

@ -12,3 +12,9 @@ alias hgp='hg push'
alias hgs='hg status'
# this is the 'git commit --amend' equivalent
alias hgca='hg qimport -r tip ; hg qrefresh -e ; hg qfinish tip'
function current_branch_hg() {
ref=$(hg branch 2> /dev/null) || return
echo ${ref#refs/heads/}
}

View file

@ -14,6 +14,7 @@ YELLOW=$fg[yellow]
GREEN=$fg[green]
WHITE=$fg[white]
BLUE=$fg[blue]
GREY_BOLD=$fg_bold[grey]
RED_BOLD=$fg_bold[red]
YELLOW_BOLD=$fg_bold[yellow]
GREEN_BOLD=$fg_bold[green]
@ -41,9 +42,13 @@ ZSH_THEME_GIT_PROMPT_UNTRACKED=" %{$GREEN%}unt"
# Prompt format
function rprompt_char() {
git branch >/dev/null 2>/dev/null && echo "%{$fg[green]%}±%{$reset_color%}" && return
hg root >/dev/null 2>/dev/null && echo "%{$fg_bold[blue]%}☿%{$reset_color%}" && return
}
if [ $UID -eq 0 ]; then CARETCOLOR="red"; else CARETCOLOR="green"; fi
if [ $UID -eq 0 ]; then CARETCOLOR="red"; else CARETCOLOR="white"; fi
PROMPT='%{${GREEN}%}%n%{$RESET_COLOR%}@%{${RED}%}%m%{$RESET_COLOR%}:%{${BLUE}%}%3~$(parse_git_dirty)$(git_prompt_ahead) %{${fg_bold[$CARETCOLOR]}%}%#%{${RESET_COLOR}%} '
PROMPT=$'┌─%{${BLUE}%}%n%{$RESET_COLOR%}@%{${GREEN}%}%m%{$RESET_COLOR%}:%{${GREY_BOLD}%}%3~$(parse_git_dirty)$(git_prompt_ahead) %{${RESET_COLOR}%} \n└─%{${fg_bold[$CARETCOLOR]}%}>>=%{${RESET_COLOR}%} '
RPROMPT='%{$RED%}$(current_branch)$(git_prompt_status)%{$RESET_COLOR%}'
RPROMPT='$(rprompt_char) %{$RED%}$(current_branch)$(current_branch_hg)$(git_prompt_status)%{$RESET_COLOR%}'