Browse code

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.

Christopher Sexton authored on 14/09/2009 at 16:42:53
Showing 5 changed files
... ...
@@ -1,16 +1,26 @@
1
+#
2
+ZSH_THEME_GIT_PROMPT_PREFIX="git:("
3
+ZSH_THEME_GIT_PROMPT_SUFFIX=")"
4
+ZSH_THEME_GIT_PROMPT_DIRTY="*"
5
+ZSH_THEME_GIT_PROMPT_CLEAN=""
6
+
1 7
 # get the name of the branch we are on
2 8
 function git_prompt_info() {
3 9
   if [[ -d .git ]]; then
4 10
     ref=$(git symbolic-ref HEAD 2> /dev/null) || return
5 11
     branch=${ref#refs/heads/}
6
-    CURRENT_BRANCH="git:(%{$fg[red]%}${branch}%{$fg[blue]%})%{$reset_color%}$(parse_git_dirty)"
12
+    CURRENT_BRANCH="$ZSH_THEME_GIT_PROMPT_PREFIX${branch}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX"
7 13
   else
8 14
     CURRENT_BRANCH=''
9 15
   fi
10 16
 
11 17
   echo $CURRENT_BRANCH
12 18
 }
13
-
14 19
 parse_git_dirty () {
15
-  [[ $(git status | tail -n1) != "nothing to commit (working directory clean)" ]] && echo " %{$fg[yellow]%}✗%{$reset_color%}"
20
+  if [[ $(git status  | tail -n1) != "nothing to commit (working directory clean)" ]]; then
21
+    echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
22
+  else
23
+    echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
24
+  fi
16 25
 }
26
+
... ...
@@ -1,2 +1,5 @@
1 1
 # PROMPT="[%*] %n:%c $(git_prompt_info)%(!.#.$) "
2 2
 PROMPT='[%*] %{$fg[cyan]%}%n%{$reset_color%}:%{$fg[green]%}%c%{$reset_color%}$(git_prompt_info) %(!.#.$) '
3
+
4
+ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[yellow]%}git:("
5
+ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}"
... ...
@@ -1,3 +1,6 @@
1 1
 # Theme with full path names and hostname
2 2
 # Handy if you work on different servers all the time;
3
-PROMPT='%{$fg[cyan]%}%n%{$reset_color%}@$fg[yellow]%}%M:%{$fg[green]%}%/%{$reset_color%} $(git_prompt_info) %(!.#.$) '
4 3
\ No newline at end of file
4
+PROMPT='%{$fg[cyan]%}%n%{$reset_color%}@$fg[yellow]%}%M:%{$fg[green]%}%/%{$reset_color%} $(git_prompt_info) %(!.#.$) '
5
+
6
+ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[cyan]%}git:("
7
+ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}"
5 8
new file mode 100644
... ...
@@ -0,0 +1,6 @@
0
+# -*- sh -*- vim:set ft=sh ai et sw=4 sts=4:
1
+# It might be bash like, but I can't have my co-workers knowing I use zsh
2
+PROMPT='%{$fg[green]%}%n@%m:%{$fg_bold[blue]%}%2~ $(git_prompt_info)%{$reset_color%}%(!.#.$) '
3
+
4
+ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[red]%}‹"
5
+ZSH_THEME_GIT_PROMPT_SUFFIX="›%{$reset_color%}"
... ...
@@ -1 +1,6 @@
1 1
 PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
2
+
3
+ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}"
4
+ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
5
+ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}"
6
+ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"