From 2db18cb0505068e782687c2eb40b9dbf4ac6dd93 Mon Sep 17 00:00:00 2001 From: Andy Fowler Date: Tue, 4 May 2010 16:18:57 -0400 Subject: [PATCH 01/10] makes git status prompt 4x faster (via git status -s, benchmarked) --- lib/git.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/git.zsh b/lib/git.zsh index 629a08b..1d1d24d 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -5,7 +5,7 @@ function git_prompt_info() { } parse_git_dirty () { - if [[ $((git status 2> /dev/null) | tail -n1) != "nothing to commit (working directory clean)" ]]; then + if [[ -n $(git status -s 2> /dev/null) ]]; then echo "$ZSH_THEME_GIT_PROMPT_DIRTY" else echo "$ZSH_THEME_GIT_PROMPT_CLEAN" From 5b7b5bc9d10b37e36e0c899419abf2cd03fe1dac Mon Sep 17 00:00:00 2001 From: canthiswait Date: Mon, 26 Apr 2010 16:02:19 -0700 Subject: [PATCH 02/10] Added scpectrum script for easy 256 color theaming --- lib/spectrum.zsh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 lib/spectrum.zsh diff --git a/lib/spectrum.zsh b/lib/spectrum.zsh new file mode 100644 index 0000000..4864654 --- /dev/null +++ b/lib/spectrum.zsh @@ -0,0 +1,20 @@ +#! /bin/zsh +# A script to make using 256 colors in zsh less painful. +# P.C. Shyamshankar +# Copied from http://github.com/sykora/etc/blob/master/zsh/functions/spectrum/ + +typeset -Ag FX FG BG + +FX=( + reset "" + bold "" no-bold "" + italic "" no-italic "" + underline "" no-underline "" + blink "" no-blink "" + reverse "" no-reverse "" +) + +for color in {000..255}; do + FG[$color]="[38;5;${color}m" + BG[$color]="[48;5;${color}m" +done From 32b8cedb7213e99ac73c046aa62d62814ded0ebe Mon Sep 17 00:00:00 2001 From: canthiswait Date: Mon, 26 Apr 2010 22:01:41 -0700 Subject: [PATCH 03/10] escape sequences so rprompt doesn't mess up --- lib/spectrum.zsh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/spectrum.zsh b/lib/spectrum.zsh index 4864654..4006a7f 100644 --- a/lib/spectrum.zsh +++ b/lib/spectrum.zsh @@ -6,15 +6,15 @@ typeset -Ag FX FG BG FX=( - reset "" - bold "" no-bold "" - italic "" no-italic "" - underline "" no-underline "" - blink "" no-blink "" - reverse "" no-reverse "" + reset "%{%}" + bold "%{%}" no-bold "%{%}" + italic "%{%}" no-italic "%{%}" + underline "%{%}" no-underline "%{%}" + blink "%{%}" no-blink "%{%}" + reverse "%{%}" no-reverse "%{%}" ) for color in {000..255}; do - FG[$color]="[38;5;${color}m" - BG[$color]="[48;5;${color}m" + FG[$color]="%{[38;5;${color}m%}" + BG[$color]="%{[48;5;${color}m%}" done From 96e33c6f6bb6f5a6610fbc7bba6775b039f1f254 Mon Sep 17 00:00:00 2001 From: canthiswait Date: Mon, 26 Apr 2010 22:27:32 -0700 Subject: [PATCH 04/10] 256 color theme with bright blue and orange --- themes/sporty_256.zsh-theme | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 themes/sporty_256.zsh-theme diff --git a/themes/sporty_256.zsh-theme b/themes/sporty_256.zsh-theme new file mode 100644 index 0000000..66c8698 --- /dev/null +++ b/themes/sporty_256.zsh-theme @@ -0,0 +1,13 @@ +# zsh theme requires 256 color enabled terminal +# i.e TERM=xterm-256color +# Preview - http://www.flickr.com/photos/adelcampo/4556482563/sizes/o/ +# based on robbyrussell's shell but louder! + +PROMPT='%{$fg_bold[blue]%}$(git_prompt_info) %F{208}%c%f +%{$fg_bold[white]%}%# %{$reset_color%}' +RPROMPT='%B%F{208}%n%f%{$fg_bold[white]%}@%F{039}%m%f%{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX="%F{154}±|%f%F{124}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}%B✘%b%F{154}|%f%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN=" %{$fg[green]%}✔%{$fg[blue]%}|" From f53b74bddb20333c834d9e2a31f9a80b0212de02 Mon Sep 17 00:00:00 2001 From: canthiswait Date: Tue, 27 Apr 2010 00:55:15 -0700 Subject: [PATCH 05/10] Fixed color in last character of clean git info --- themes/sporty_256.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/sporty_256.zsh-theme b/themes/sporty_256.zsh-theme index 66c8698..db0fc42 100644 --- a/themes/sporty_256.zsh-theme +++ b/themes/sporty_256.zsh-theme @@ -10,4 +10,4 @@ RPROMPT='%B%F{208}%n%f%{$fg_bold[white]%}@%F{039}%m%f%{$reset_color%}' ZSH_THEME_GIT_PROMPT_PREFIX="%F{154}±|%f%F{124}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}%B✘%b%F{154}|%f%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_CLEAN=" %{$fg[green]%}✔%{$fg[blue]%}|" +ZSH_THEME_GIT_PROMPT_CLEAN=" %{$fg[green]%}✔%F{154}|" From 2e1eaf4040c8fb233a3ab15fa074231131703507 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Thu, 6 May 2010 21:04:09 -0700 Subject: [PATCH 06/10] Removing rake autocompletion as this is apparently baked into recent versions of zsh --- lib/rake_completion.zsh | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/lib/rake_completion.zsh b/lib/rake_completion.zsh index c425a62..8336182 100644 --- a/lib/rake_completion.zsh +++ b/lib/rake_completion.zsh @@ -1,24 +1,3 @@ -_rake_does_task_list_need_generating () { - if [ ! -f .rake_tasks~ ]; then return 0; - else - accurate=$(stat -f%m .rake_tasks~) - changed=$(stat -f%m Rakefile) - return $(expr $accurate '>=' $changed) - fi -} - -_rake () { - if [ -f Rakefile ]; then - if _rake_does_task_list_need_generating; then - echo "\nGenerating .rake_tasks~..." > /dev/stderr - rake --silent --tasks | cut -d " " -f 2 > .rake_tasks~ - fi - compadd `cat .rake_tasks~` - fi -} - -compctl -K _rake rake - function _cap_does_task_list_need_generating () { if [ ! -f .cap_tasks~ ]; then return 0; else From 9ec6086282b0090f562c39285602e0a161aa7f3c Mon Sep 17 00:00:00 2001 From: kremso Date: Tue, 9 Mar 2010 14:09:08 +0100 Subject: [PATCH 07/10] Don't autoselect first completion entry (Fixes #14) The key here is not using MENU_COMPLETE which autoselects the first entry, but using AUTO_MENU which displays the menu but autoselects on successive tab hit. Also, do not use zstyle menu yes because that somehow overrides the setopts. --- lib/completion.zsh | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/completion.zsh b/lib/completion.zsh index 46b6d8f..619dc02 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -1,11 +1,11 @@ ## fixme - the load process here seems a bit bizarre -setopt noautomenu +unsetopt menu_complete # do not autoselect the first completion entry +unsetopt flowcontrol +setopt auto_menu # show completion menu on succesive tab press setopt complete_in_word setopt always_to_end -unsetopt flowcontrol - WORDCHARS='' autoload -U compinit @@ -23,14 +23,10 @@ fi zstyle ':completion:*' list-colors '' - -unsetopt MENU_COMPLETE -#setopt AUTO_MENU - # should this be in keybindings? bindkey -M menuselect '^o' accept-and-infer-next-history -zstyle ':completion:*:*:*:*:*' menu yes select +zstyle ':completion:*:*:*:*:*' menu select # zstyle ':completion:*:*:*:*:processes' force-list always zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01' From bd481dd34641afb2095b4739e72632ead3ca023d Mon Sep 17 00:00:00 2001 From: Dallas Reedy Date: Wed, 17 Mar 2010 11:25:17 -0700 Subject: [PATCH 08/10] added my personal theme: the dallas them --- themes/dallas.zsh-theme | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 themes/dallas.zsh-theme diff --git a/themes/dallas.zsh-theme b/themes/dallas.zsh-theme new file mode 100644 index 0000000..10e019b --- /dev/null +++ b/themes/dallas.zsh-theme @@ -0,0 +1,14 @@ +# Personalized! +# [red][normal][purple][yellow][normal] +# dallas@lappy ~/Sites % +# PROMPT="%{$fg[red]%}%n%{$reset_color%}@%{$fg[blue]%}%m %{$fg[yellow]%}%~ %{$reset_color%}%% " +# PROMPT="{white}\{{yellow}{time}{white}\}{green}{host}{white}:{cyan}{pwd} {red,bold}{user}{white}%{normal} " + +DALLAS_CURRENT_TIME_="%{$fg[white]%}{%{$fg[yellow]%}%T%{$fg[white]%}}%{$reset_color%}" +DALLAS_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[magenta]%}\$(~/.rvm/bin/rvm-prompt i v)%{$fg[white]%}]%{$reset_color%}" +DALLAS_CURRENT_MACH_="%{$fg[green]%}%m%{$fg[white]%}:%{$reset_color%}" +DALLAS_CURRENT_LOCA_="%{$fg[cyan]%}%~%{$reset_color%}" +DALLAS_CURRENT_USER_="%{$fg[red]%}%n%{$reset_color%}" +DALLAS_PROMPT_CHAR_="%{$fg[white]%}%%%{$reset_color%}" + +PROMPT="$DALLAS_CURRENT_TIME_$DALLAS_CURRENT_RUBY_$DALLAS_CURRENT_MACH_$DALLAS_CURRENT_LOCA_ $DALLAS_CURRENT_USER_$DALLAS_PROMPT_CHAR_ " From 91c98643260c9a5535871106c20c27493a80fe87 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Thu, 6 May 2010 21:13:59 -0700 Subject: [PATCH 09/10] Unsetting config_file after loading config --- oh-my-zsh.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index fa2738e..a41f3d8 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -17,3 +17,5 @@ then else /usr/bin/env zsh $ZSH/tools/check_for_upgrade.sh fi + +unset config_file \ No newline at end of file From f2c600a709aa18c860cb326e2747167fa694fafb Mon Sep 17 00:00:00 2001 From: Dallas Reedy Date: Fri, 7 May 2010 11:17:12 -0700 Subject: [PATCH 10/10] updated my theme with the date and git branch (+ dirty or not) --- themes/dallas.zsh-theme | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/themes/dallas.zsh-theme b/themes/dallas.zsh-theme index 10e019b..eef32e9 100644 --- a/themes/dallas.zsh-theme +++ b/themes/dallas.zsh-theme @@ -1,14 +1,26 @@ # Personalized! -# [red][normal][purple][yellow][normal] -# dallas@lappy ~/Sites % -# PROMPT="%{$fg[red]%}%n%{$reset_color%}@%{$fg[blue]%}%m %{$fg[yellow]%}%~ %{$reset_color%}%% " -# PROMPT="{white}\{{yellow}{time}{white}\}{green}{host}{white}:{cyan}{pwd} {red,bold}{user}{white}%{normal} " -DALLAS_CURRENT_TIME_="%{$fg[white]%}{%{$fg[yellow]%}%T%{$fg[white]%}}%{$reset_color%}" +# Grab the current date (%D) and time (%T) wrapped in {}: {%D %T} +DALLAS_CURRENT_TIME_="%{$fg[white]%}{%{$fg[yellow]%}%D %T%{$fg[white]%}}%{$reset_color%}" +# Grab the current version of ruby in use (via RVM): [ruby-1.8.7] DALLAS_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[magenta]%}\$(~/.rvm/bin/rvm-prompt i v)%{$fg[white]%}]%{$reset_color%}" +# Grab the current machine name: muscato DALLAS_CURRENT_MACH_="%{$fg[green]%}%m%{$fg[white]%}:%{$reset_color%}" -DALLAS_CURRENT_LOCA_="%{$fg[cyan]%}%~%{$reset_color%}" +# Grab the current filepath, use shortcuts: ~/Desktop +# Append the current git branch, if in a git repository: ~aw@master +DALLAS_CURRENT_LOCA_="%{$fg[cyan]%}%~\$(git_prompt_info)%{$reset_color%}" +# Grab the current username: dallas DALLAS_CURRENT_USER_="%{$fg[red]%}%n%{$reset_color%}" -DALLAS_PROMPT_CHAR_="%{$fg[white]%}%%%{$reset_color%}" +# Use a % for normal users and a # for privelaged (root) users. +DALLAS_PROMPT_CHAR_="%{$fg[white]%}%(!.#.%%)%{$reset_color%}" +# For the git prompt, use a white @ and blue text for the branch name +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[white]%}@%{$fg[blue]%}" +# Close it all off by resetting the color and styles. +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +# Do nothing if the branch is clean (no changes). +ZSH_THEME_GIT_PROMPT_CLEAN="" +# Add 3 cyan ✗s if this branch is diiirrrty! Dirty branch! +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[cyan]%}✗✗✗" +# Put it all together! PROMPT="$DALLAS_CURRENT_TIME_$DALLAS_CURRENT_RUBY_$DALLAS_CURRENT_MACH_$DALLAS_CURRENT_LOCA_ $DALLAS_CURRENT_USER_$DALLAS_PROMPT_CHAR_ "