85a4e3028990b6583253308ada3d456c291487d7

Author
Christopher Sexton <csexton@gmail.com>
Committer
Christopher Sexton <csexton@gmail.com>
Date

Message

Added risto theme and made git.zsh themable

 * git.zsh is now themable:
   * git_prompt_info() now will look in the following variables for
     formatting strings:
     * ZSH_THEME_GIT_PROMPT_PREFIX - Prefix for the prompt (before the
       branch name)
     * ZSH_THEME_GIT_PROMPT_SUFFIX - The very end of the prompt
     * ZSH_THEME_GIT_PROMPT_DIRTY - Displayed when the branch is dirty
     * ZSH_THEME_GIT_PROMPT_CLEAN - Displayed when the branch is clean
 * Updated geoffgarside, robbyrussell, and maran to work with new git
   theme
 * Added the Risto theme, which is very similar to a number of bash
   prompts, and allows me to use zsh in with out my co-workers knowing I
   have the advantage. Think of it as a ninja theme.

Diff

 1diff --git a/git.zsh b/git.zsh
 2index b8fd1f08e2b2d3f20cde92ccf0740dde8a7dcd4c..591b77895be9d2d1af52668daddf7a275e9fc797 100644
 3--- a/git.zsh
 4+++ b/git.zsh
 5@@ -1,16 +1,26 @@
 6+#
 7+ZSH_THEME_GIT_PROMPT_PREFIX="git:("
 8+ZSH_THEME_GIT_PROMPT_SUFFIX=")"
 9+ZSH_THEME_GIT_PROMPT_DIRTY="*"
10+ZSH_THEME_GIT_PROMPT_CLEAN=""
11+
12 # get the name of the branch we are on
13 function git_prompt_info() {
14   if [[ -d .git ]]; then
15     ref=$(git symbolic-ref HEAD 2> /dev/null) || return
16     branch=${ref#refs/heads/}
17-    CURRENT_BRANCH="git:(%{$fg[red]%}${branch}%{$fg[blue]%})%{$reset_color%}$(parse_git_dirty)"
18+    CURRENT_BRANCH="$ZSH_THEME_GIT_PROMPT_PREFIX${branch}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX"
19   else
20     CURRENT_BRANCH=''
21   fi
22 
23   echo $CURRENT_BRANCH
24 }
25-
26 parse_git_dirty () {
27-  [[ $(git status | tail -n1) != "nothing to commit (working directory clean)" ]] && echo " %{$fg[yellow]%}✗%{$reset_color%}"
28+  if [[ $(git status  | tail -n1) != "nothing to commit (working directory clean)" ]]; then
29+    echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
30+  else
31+    echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
32+  fi
33 }
34+
35diff --git a/themes/geoffgarside.zsh-theme b/themes/geoffgarside.zsh-theme
36index 38733d95c2666f1de270abf1cd6901d10271c963..675ec7206f9934522a5c49a6c63b4ca563947547 100644
37--- a/themes/geoffgarside.zsh-theme
38+++ b/themes/geoffgarside.zsh-theme
39@@ -1,2 +1,5 @@
40 # PROMPT="[%*] %n:%c $(git_prompt_info)%(!.#.$) "
41 PROMPT='[%*] %{$fg[cyan]%}%n%{$reset_color%}:%{$fg[green]%}%c%{$reset_color%}$(git_prompt_info) %(!.#.$) '
42+
43+ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[yellow]%}git:("
44+ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}"
45diff --git a/themes/maran.zsh-theme b/themes/maran.zsh-theme
46index 7523696f4438c616c4e4fec0e7c333319a2af162..0f6e3b6bd99c0448362866ff609d9a1083a87a26 100644
47--- a/themes/maran.zsh-theme
48+++ b/themes/maran.zsh-theme
49@@ -1,3 +1,6 @@
50 # Theme with full path names and hostname
51 # Handy if you work on different servers all the time;
52-PROMPT='%{$fg[cyan]%}%n%{$reset_color%}@$fg[yellow]%}%M:%{$fg[green]%}%/%{$reset_color%} $(git_prompt_info) %(!.#.$) '
53+PROMPT='%{$fg[cyan]%}%n%{$reset_color%}@$fg[yellow]%}%M:%{$fg[green]%}%/%{$reset_color%} $(git_prompt_info) %(!.#.$) '
54+
55+ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[cyan]%}git:("
56+ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}"
57diff --git a/themes/risto.zsh-theme b/themes/risto.zsh-theme
58new file mode 100644
59index 0000000000000000000000000000000000000000..cb773a64ed204e8cad793b7963a36eeab70fc231
60--- /dev/null
61+++ b/themes/risto.zsh-theme
62@@ -0,0 +1,6 @@
63+# -*- sh -*- vim:set ft=sh ai et sw=4 sts=4:
64+# It might be bash like, but I can't have my co-workers knowing I use zsh
65+PROMPT='%{$fg[green]%}%n@%m:%{$fg_bold[blue]%}%2~ $(git_prompt_info)%{$reset_color%}%(!.#.$) '
66+
67+ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[red]%}‹"
68+ZSH_THEME_GIT_PROMPT_SUFFIX="›%{$reset_color%}"
69diff --git a/themes/robbyrussell.zsh-theme b/themes/robbyrussell.zsh-theme
70index d45796f7c7df793ed7b2aaf471cc9f9b3b90cc1c..7b524e82d8803c2cc75504cd87227c2d1384264a 100644
71--- a/themes/robbyrussell.zsh-theme
72+++ b/themes/robbyrussell.zsh-theme
73@@ -1 +1,6 @@
74 PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
75+
76+ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}"
77+ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
78+ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}"
79+ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"