Skip to content
This repository
Browse code

Custom theme with Git support

This is my personal oh-my-zsh theme. It has Git support through
methods found in Git lib file of oh-my-zsh. It uses:

- parse_git_dirty()
- git_prompt_ahead()
- current_branch()
- git_prompt_short_sha()
- git_prompt_status()

It also shows user name, machine name and current path. You can
take a look at a screenshot at http://goo.gl/ZVoyk
  • Loading branch information...
commit 208b225a2f12076099255c329abbb3569723b39b 1 parent 077baa7
Juan G. Hurtado juanghurtado authored

Showing 1 changed file with 46 additions and 0 deletions. Show diff stats Hide diff stats

  1. +46 0 themes/juanghurtado.zsh-theme
46 themes/juanghurtado.zsh-theme
... ... @@ -0,0 +1,46 @@
  1 +# ------------------------------------------------------------------------
  2 +# Juan G. Hurtado oh-my-zsh theme
  3 +# (Needs Git plugin for current_branch method)
  4 +# ------------------------------------------------------------------------
  5 +
  6 +# Color shortcuts
  7 +RED=$fg[red]
  8 +YELLOW=$fg[yellow]
  9 +GREEN=$fg[green]
  10 +WHITE=$fg[white]
  11 +BLUE=$fg[blue]
  12 +RED_BOLD=$fg_bold[red]
  13 +YELLOW_BOLD=$fg_bold[yellow]
  14 +GREEN_BOLD=$fg_bold[green]
  15 +WHITE_BOLD=$fg_bold[white]
  16 +BLUE_BOLD=$fg_bold[blue]
  17 +RESET_COLOR=$reset_color
  18 +
  19 +# Format for git_prompt_info()
  20 +ZSH_THEME_GIT_PROMPT_PREFIX=""
  21 +ZSH_THEME_GIT_PROMPT_SUFFIX=""
  22 +
  23 +# Format for parse_git_dirty()
  24 +ZSH_THEME_GIT_PROMPT_DIRTY=" %{$RED%}(*)"
  25 +ZSH_THEME_GIT_PROMPT_CLEAN=""
  26 +
  27 +# Format for git_prompt_status()
  28 +ZSH_THEME_GIT_PROMPT_UNMERGED=" %{$RED%}unmerged"
  29 +ZSH_THEME_GIT_PROMPT_DELETED=" %{$RED%}deleted"
  30 +ZSH_THEME_GIT_PROMPT_RENAMED=" %{$YELLOW%}renamed"
  31 +ZSH_THEME_GIT_PROMPT_MODIFIED=" %{$YELLOW%}modified"
  32 +ZSH_THEME_GIT_PROMPT_ADDED=" %{$GREEN%}added"
  33 +ZSH_THEME_GIT_PROMPT_UNTRACKED=" %{$WHITE%}untracked"
  34 +
  35 +# Format for git_prompt_ahead()
  36 +ZSH_THEME_GIT_PROMPT_AHEAD=" %{$RED%}(!)"
  37 +
  38 +# Format for git_prompt_long_sha() and git_prompt_short_sha()
  39 +ZSH_THEME_GIT_PROMPT_SHA_BEFORE=" %{$WHITE%}[%{$YELLOW%}"
  40 +ZSH_THEME_GIT_PROMPT_SHA_AFTER="%{$WHITE%}]"
  41 +
  42 +# Prompt format
  43 +PROMPT='
  44 +%{$GREEN_BOLD%}%n@%m%{$WHITE%}:%{$YELLOW%}%~%u$(parse_git_dirty)$(git_prompt_ahead)%{$RESET_COLOR%}
  45 +%{$BLUE%}>%{$RESET_COLOR%} '
  46 +RPROMPT='%{$GREEN_BOLD%}$(current_branch)$(git_prompt_short_sha)$(git_prompt_status)%{$RESET_COLOR%}'

0 comments on commit 208b225

Please sign in to comment.
Something went wrong with that request. Please try again.