From 36e06e0e539f89f6ca8ce88e8b137840c28736ce Mon Sep 17 00:00:00 2001 From: Gregory Liras Date: Sat, 31 Dec 2011 22:25:22 +0200 Subject: [PATCH 1/4] added my theme --- themes/master.zsh-theme | 49 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 themes/master.zsh-theme diff --git a/themes/master.zsh-theme b/themes/master.zsh-theme new file mode 100644 index 000000000..a51106138 --- /dev/null +++ b/themes/master.zsh-theme @@ -0,0 +1,49 @@ +# Found on the ZshWiki +# http://zshwiki.org/home/config/prompt +# + +# ------------------------------------------------------------------------ +# Juan G. Hurtado oh-my-zsh theme +# (Needs Git plugin for current_branch method) +# ------------------------------------------------------------------------ +# copied from juanghurtado, and afowler themes + +# Color shortcuts +RED=$fg[red] +YELLOW=$fg[yellow] +GREEN=$fg[green] +WHITE=$fg[white] +BLUE=$fg[blue] +RED_BOLD=$fg_bold[red] +YELLOW_BOLD=$fg_bold[yellow] +GREEN_BOLD=$fg_bold[green] +WHITE_BOLD=$fg_bold[white] +BLUE_BOLD=$fg_bold[blue] +RESET_COLOR=$reset_color + +# Format for git_prompt_info() +ZSH_THEME_GIT_PROMPT_PREFIX="" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$RESET_COLOR}" + +# Format for parse_git_dirty() +ZSH_THEME_GIT_PROMPT_DIRTY=" %{$RED%}(⚡)" +ZSH_THEME_GIT_PROMPT_CLEAN="" +# Format for git_prompt_ahead() +ZSH_THEME_GIT_PROMPT_AHEAD=" %{$YELLOW%}(↑)" + +# Format for git_prompt_status() +ZSH_THEME_GIT_PROMPT_UNMERGED=" %{$RED_BOLD%}unm" +ZSH_THEME_GIT_PROMPT_DELETED=" %{$RED%}del" +ZSH_THEME_GIT_PROMPT_RENAMED=" %{$BLUE%}ren" +ZSH_THEME_GIT_PROMPT_MODIFIED=" %{$YELLOW%}mod" +ZSH_THEME_GIT_PROMPT_ADDED=" %{$BLUE_BOLD%}add" +ZSH_THEME_GIT_PROMPT_UNTRACKED=" %{$GREEN%}unt" + + +# Prompt format + +if [ $UID -eq 0 ]; then CARETCOLOR="red"; else CARETCOLOR="blue"; fi + +PROMPT='%{${BLUE}%}%n%{$RESET_COLOR%}:%{${GREEN}%}%3~$(parse_git_dirty)$(git_prompt_ahead) %{${fg_bold[$CARETCOLOR]}%}%#%{${RESET_COLOR}%} ' + +RPROMPT='%{$RED%}$(current_branch)$(git_prompt_status)%{$RESET_COLOR%}' From 4511e86bc4f60bd60cca4c505c654d841ba58506 Mon Sep 17 00:00:00 2001 From: Gregory Liras Date: Sun, 15 Jan 2012 22:41:58 +0200 Subject: [PATCH 2/4] updated colors in theme, showing hostname as well --- themes/master.zsh-theme | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/master.zsh-theme b/themes/master.zsh-theme index a51106138..10011a02a 100644 --- a/themes/master.zsh-theme +++ b/themes/master.zsh-theme @@ -42,8 +42,8 @@ ZSH_THEME_GIT_PROMPT_UNTRACKED=" %{$GREEN%}unt" # Prompt format -if [ $UID -eq 0 ]; then CARETCOLOR="red"; else CARETCOLOR="blue"; fi +if [ $UID -eq 0 ]; then CARETCOLOR="red"; else CARETCOLOR="green"; fi -PROMPT='%{${BLUE}%}%n%{$RESET_COLOR%}:%{${GREEN}%}%3~$(parse_git_dirty)$(git_prompt_ahead) %{${fg_bold[$CARETCOLOR]}%}%#%{${RESET_COLOR}%} ' +PROMPT='%{${GREEN}%}%n%{$RESET_COLOR%}:%{${YELLOW}%}%m%{${BLUE}%}%3~$(parse_git_dirty)$(git_prompt_ahead) %{${fg_bold[$CARETCOLOR]}%}%#%{${RESET_COLOR}%} ' RPROMPT='%{$RED%}$(current_branch)$(git_prompt_status)%{$RESET_COLOR%}' From f3052c60c91cd866a106d62fb43982cf80673324 Mon Sep 17 00:00:00 2001 From: Gregory Liras Date: Fri, 27 Jan 2012 13:19:01 +0200 Subject: [PATCH 3/4] updated color theme --- themes/master.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/master.zsh-theme b/themes/master.zsh-theme index 10011a02a..83e776798 100644 --- a/themes/master.zsh-theme +++ b/themes/master.zsh-theme @@ -44,6 +44,6 @@ ZSH_THEME_GIT_PROMPT_UNTRACKED=" %{$GREEN%}unt" if [ $UID -eq 0 ]; then CARETCOLOR="red"; else CARETCOLOR="green"; fi -PROMPT='%{${GREEN}%}%n%{$RESET_COLOR%}:%{${YELLOW}%}%m%{${BLUE}%}%3~$(parse_git_dirty)$(git_prompt_ahead) %{${fg_bold[$CARETCOLOR]}%}%#%{${RESET_COLOR}%} ' +PROMPT='%{${GREEN}%}%n%{$RESET_COLOR%}@%{${RED}%}%m%{$RESET_COLOR%}:%{${BLUE}%}%3~$(parse_git_dirty)$(git_prompt_ahead) %{${fg_bold[$CARETCOLOR]}%}%#%{${RESET_COLOR}%} ' RPROMPT='%{$RED%}$(current_branch)$(git_prompt_status)%{$RESET_COLOR%}' From 5f9a4373e6d08349c070600c48e98f454088694e Mon Sep 17 00:00:00 2001 From: Gregory Liras Date: Sun, 5 Feb 2012 15:59:33 +0200 Subject: [PATCH 4/4] updated mercurial plugin --- plugins/mercurial/mercurial.plugin.zsh | 6 ++++++ themes/master.zsh-theme | 11 ++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/plugins/mercurial/mercurial.plugin.zsh b/plugins/mercurial/mercurial.plugin.zsh index caf0d9efc..de83cf927 100644 --- a/plugins/mercurial/mercurial.plugin.zsh +++ b/plugins/mercurial/mercurial.plugin.zsh @@ -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/} +} + diff --git a/themes/master.zsh-theme b/themes/master.zsh-theme index 83e776798..6fb7b1a1e 100644 --- a/themes/master.zsh-theme +++ b/themes/master.zsh-theme @@ -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%}'