From aa2f553023fbb5a909edcc431b6fbcda43a39c9b Mon Sep 17 00:00:00 2001 From: Irakli Gozalishvili Date: Sat, 9 Oct 2010 01:27:40 +0200 Subject: [PATCH 1/6] Improving git plugin so it can display much more data. --- lib/git.zsh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/lib/git.zsh b/lib/git.zsh index 889dd98..57a78e2 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -11,3 +11,31 @@ parse_git_dirty () { echo "$ZSH_THEME_GIT_PROMPT_CLEAN" fi } + +# get the status of the working tree +git_prompt_status() { + INDEX=$(git status --porcelain 2> /dev/null) + STATUS="" + if $(echo "$INDEX" | grep '^?? ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_UNTRACKED$STATUS" + fi + if $(echo "$INDEX" | grep '^A ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS" + elif $(echo "$INDEX" | grep '^M ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS" + fi + if $(echo "$INDEX" | grep '^ M ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS" + fi + if $(echo "$INDEX" | grep '^R ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_RENAMED$STATUS" + fi + if $(echo "$INDEX" | grep '^ D ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS" + fi + if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$STATUS" + fi + echo $STATUS +} + From c4322f2955a4ee9923fc8744ebec411053536d1e Mon Sep 17 00:00:00 2001 From: Irakli Gozalishvili Date: Sat, 9 Oct 2010 01:49:35 +0200 Subject: [PATCH 2/6] Adding new gozilla theme --- themes/gozilla.zsh-theme | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 themes/gozilla.zsh-theme diff --git a/themes/gozilla.zsh-theme b/themes/gozilla.zsh-theme new file mode 100644 index 0000000..3112b36 --- /dev/null +++ b/themes/gozilla.zsh-theme @@ -0,0 +1,15 @@ +PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p%{$fg[cyan]%}%c%{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' +RPROMPT='$(git_prompt_status)' + +ZSH_THEME_GIT_PROMPT_PREFIX="(%{%}" +ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[cyan]%} ✈%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[yellow]%} ✭%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✗%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%} ➦%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[magenta]%} ⚡%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[grey]%} ⚑%{$reset_color%}" + +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}" + From 3ce9bb3ef01be5057ec192a70ace8a8545f80861 Mon Sep 17 00:00:00 2001 From: Irakli Gozalishvili Date: Sat, 9 Oct 2010 02:16:10 +0200 Subject: [PATCH 3/6] Fixing some minor redrew issue --- themes/gozilla.zsh-theme | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/themes/gozilla.zsh-theme b/themes/gozilla.zsh-theme index 3112b36..97566e3 100644 --- a/themes/gozilla.zsh-theme +++ b/themes/gozilla.zsh-theme @@ -1,8 +1,12 @@ -PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p%{$fg[cyan]%}%c%{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' -RPROMPT='$(git_prompt_status)' +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="(%{%}" ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%}" + +RPROMPT='$(git_prompt_status)' + ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[cyan]%} ✈%{$reset_color%}" ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[yellow]%} ✭%{$reset_color%}" ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✗%{$reset_color%}" @@ -10,6 +14,3 @@ ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%} ➦%{$reset_color%}" ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[magenta]%} ⚡%{$reset_color%}" ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[grey]%} ⚑%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%}" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}" - From e7ddaaa2b06c75eb1cefc749cc8f9a44a8b22752 Mon Sep 17 00:00:00 2001 From: Brandon Philips Date: Fri, 8 Oct 2010 22:44:42 -0700 Subject: [PATCH 4/6] functions: fix title() to not match any $TERM On my linux virtual terminals, where TERM="linux", I was getting annoying output that was messing up my prompt. It turns out the title function was always matching on the elif statement for xterm/rxvt no matter what and the linux vt doesn't know what to do with the title special control sequence and thus was printing out garbage. Through experimentation I figured out that the || inside of the [[ ]] did not work: export TERM=linux $ if [[ $TERM =~ "^xterm" || $TERM == "rxvt" ]]; then echo $TERM; fi linux $ if [[ $TERM =~ "^xterm" ]] || [[ $TERM == "rxvt" ]]; then echo $TERM; fi Signed-off-by: Brandon Philips openSUSE running zsh 4.3.10 --- lib/functions.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/functions.zsh b/lib/functions.zsh index 561586c..e494f1f 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -5,7 +5,7 @@ function title { print -nR $'\033k'$1$'\033'\\\ print -nR $'\033]0;'$2$'\a' - elif [[ $TERM =~ "^xterm" || $TERM == "rxvt" ]]; then + elif [[ ($TERM =~ "^xterm") ]] || [[ ($TERM == "rxvt") ]]; then # Use this one instead for XTerms: print -nR $'\033]0;'$*$'\a' fi From e0789782bcafe38d38698421443e6a1608ad8afc Mon Sep 17 00:00:00 2001 From: Brandon Philips Date: Fri, 8 Oct 2010 22:57:43 -0700 Subject: [PATCH 5/6] themes: add philips theme Theme based on clean that is more suitable for white background terminals. Signed-off-by: Brandon Philips --- themes/philips.zsh-theme | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 themes/philips.zsh-theme diff --git a/themes/philips.zsh-theme b/themes/philips.zsh-theme new file mode 100644 index 0000000..fa7c590 --- /dev/null +++ b/themes/philips.zsh-theme @@ -0,0 +1,14 @@ +if [ "$(whoami)" = "root" ]; then NCOLOR="red"; else NCOLOR="green"; fi + +PROMPT='%{$fg[$NCOLOR]%}%B%n%b%{$reset_color%}:%{$fg[blue]%}%B%c/%b%{$reset_color%} $(git_prompt_info)%(!.#.$) ' +RPROMPT='[%*]' + +# git theming +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}(%{$fg_no_bold[red]%}%B" +ZSH_THEME_GIT_PROMPT_SUFFIX="%b%{$fg_bold[blue]%})%{$reset_color%} " +ZSH_THEME_GIT_PROMPT_CLEAN="" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%}" + +# LS colors, made with http://geoff.greer.fm/lscolors/ +export LSCOLORS="Gxfxcxdxbxegedabagacad" +export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:' From ff33d69d00b2affa1613f197f11ef33cd2d7f8bd Mon Sep 17 00:00:00 2001 From: Irakli Gozalishvili Date: Sat, 9 Oct 2010 18:06:00 +0200 Subject: [PATCH 6/6] changeing unicode characters that were causing issues --- themes/gozilla.zsh-theme | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/themes/gozilla.zsh-theme b/themes/gozilla.zsh-theme index 97566e3..c6b752e 100644 --- a/themes/gozilla.zsh-theme +++ b/themes/gozilla.zsh-theme @@ -1,16 +1,15 @@ 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="(%{%}" -ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}" -ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%}" +ZSH_THEME_GIT_PROMPT_PREFIX="(" +ZSH_THEME_GIT_PROMPT_SUFFIX=")" +ZSH_THEME_GIT_PROMPT_DIRTY="" +ZSH_THEME_GIT_PROMPT_CLEAN="" -RPROMPT='$(git_prompt_status)' - -ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[cyan]%} ✈%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[yellow]%} ✭%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✗%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%} ➦%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[magenta]%} ⚡%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[grey]%} ⚑%{$reset_color%}" +RPROMPT='$(git_prompt_status)%{$reset_color%}' +ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[cyan]%} ✈" +ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[yellow]%} ✭" +ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✗" +ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%} ➦" +ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[magenta]%} ✂" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[grey]%} ✱"