diff --git a/git.zsh b/git.zsh index b8fd1f08..591b7789 100644 --- a/git.zsh +++ b/git.zsh @@ -1,16 +1,26 @@ +# +ZSH_THEME_GIT_PROMPT_PREFIX="git:(" +ZSH_THEME_GIT_PROMPT_SUFFIX=")" +ZSH_THEME_GIT_PROMPT_DIRTY="*" +ZSH_THEME_GIT_PROMPT_CLEAN="" + # get the name of the branch we are on function git_prompt_info() { if [[ -d .git ]]; then ref=$(git symbolic-ref HEAD 2> /dev/null) || return branch=${ref#refs/heads/} - CURRENT_BRANCH="git:(%{$fg[red]%}${branch}%{$fg[blue]%})%{$reset_color%}$(parse_git_dirty)" + CURRENT_BRANCH="$ZSH_THEME_GIT_PROMPT_PREFIX${branch}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX" else CURRENT_BRANCH='' fi echo $CURRENT_BRANCH } - parse_git_dirty () { - [[ $(git status | tail -n1) != "nothing to commit (working directory clean)" ]] && echo " %{$fg[yellow]%}✗%{$reset_color%}" + if [[ $(git status | tail -n1) != "nothing to commit (working directory clean)" ]]; then + echo "$ZSH_THEME_GIT_PROMPT_DIRTY" + else + echo "$ZSH_THEME_GIT_PROMPT_CLEAN" + fi } + diff --git a/themes/geoffgarside.zsh-theme b/themes/geoffgarside.zsh-theme index 38733d95..675ec720 100644 --- a/themes/geoffgarside.zsh-theme +++ b/themes/geoffgarside.zsh-theme @@ -1,2 +1,5 @@ # PROMPT="[%*] %n:%c $(git_prompt_info)%(!.#.$) " PROMPT='[%*] %{$fg[cyan]%}%n%{$reset_color%}:%{$fg[green]%}%c%{$reset_color%}$(git_prompt_info) %(!.#.$) ' + +ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[yellow]%}git:(" +ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}" diff --git a/themes/maran.zsh-theme b/themes/maran.zsh-theme index 7523696f..0f6e3b6b 100644 --- a/themes/maran.zsh-theme +++ b/themes/maran.zsh-theme @@ -1,3 +1,6 @@ # Theme with full path names and hostname # Handy if you work on different servers all the time; -PROMPT='%{$fg[cyan]%}%n%{$reset_color%}@$fg[yellow]%}%M:%{$fg[green]%}%/%{$reset_color%} $(git_prompt_info) %(!.#.$) ' \ No newline at end of file +PROMPT='%{$fg[cyan]%}%n%{$reset_color%}@$fg[yellow]%}%M:%{$fg[green]%}%/%{$reset_color%} $(git_prompt_info) %(!.#.$) ' + +ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[cyan]%}git:(" +ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}" diff --git a/themes/risto.zsh-theme b/themes/risto.zsh-theme new file mode 100644 index 00000000..cb773a64 --- /dev/null +++ b/themes/risto.zsh-theme @@ -0,0 +1,6 @@ +# -*- sh -*- vim:set ft=sh ai et sw=4 sts=4: +# It might be bash like, but I can't have my co-workers knowing I use zsh +PROMPT='%{$fg[green]%}%n@%m:%{$fg_bold[blue]%}%2~ $(git_prompt_info)%{$reset_color%}%(!.#.$) ' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[red]%}‹" +ZSH_THEME_GIT_PROMPT_SUFFIX="›%{$reset_color%}" diff --git a/themes/robbyrussell.zsh-theme b/themes/robbyrussell.zsh-theme index d45796f7..7b524e82 100644 --- a/themes/robbyrussell.zsh-theme +++ b/themes/robbyrussell.zsh-theme @@ -1 +1,6 @@ PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"