From cd7b12b4acce07bd6f30c6e528f83cba03fa24e6 Mon Sep 17 00:00:00 2001 From: Jake Bell Date: Thu, 26 May 2011 12:34:37 -0500 Subject: [PATCH 01/18] Adding ability to override plugins from the custom directory. --- .gitignore | 1 + README.textile | 6 ++++-- custom/example/example.plugin.zsh | 2 ++ oh-my-zsh.sh | 4 +++- 4 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 custom/example/example.plugin.zsh diff --git a/.gitignore b/.gitignore index 4b55506..8fdfae2 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,6 @@ locals.zsh log/.zsh_history projects.zsh custom/* +!custom/example !custom/example.zsh cache diff --git a/README.textile b/README.textile index d01c331..2dbfbe5 100644 --- a/README.textile +++ b/README.textile @@ -48,7 +48,9 @@ the "refcard":http://www.bash2zsh.com/zsh_refcard/refcard.pdf is pretty tasty fo h3. Customization If you want to override any of the default behavior, just add a new file (ending in @.zsh@) into the @custom/@ directory. -If you have many functions which go good together you can put them as a *.plugin.zsh file in the @plugin/@ directory and then enable this plugin. +If you have many functions which go good together you can put them as a *.plugin.zsh file in the @custom/plugins/@ directory and then enable this plugin. +If you would like to override the functionality of a plugin distributed with oh-my-zsh, create a plugin of the same name in the @custom/plugins/@ directory and it will be loaded instead of the one in @plugins/@. + h3. Uninstalling @@ -68,4 +70,4 @@ This project wouldn't exist without all of our awesome users and contributors. * "View our growing list of contributors":https://github.com/robbyrussell/oh-my-zsh/contributors -Thank you so much! \ No newline at end of file +Thank you so much! diff --git a/custom/example/example.plugin.zsh b/custom/example/example.plugin.zsh new file mode 100644 index 0000000..406f274 --- /dev/null +++ b/custom/example/example.plugin.zsh @@ -0,0 +1,2 @@ +# Add your own custom plugins in the custom/plugins directory. Plugins placed +# here will override ones with the same name in the main plugins directory. diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index c8f1a33..dbff1ce 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -17,7 +17,9 @@ compinit -i # Load all of the plugins that were defined in ~/.zshrc for plugin ($plugins); do - if [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then + if [ -f $ZSH/custom/plugins/$plugin/$plugin.plugin.zsh ]; then + source $ZSH/custom/plugins/$plugin/$plugin.plugin.zsh + elif [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then source $ZSH/plugins/$plugin/$plugin.plugin.zsh fi done From b52668fa804bf8c11e66e81cff7f8e708df646b4 Mon Sep 17 00:00:00 2001 From: Martin Thurau Date: Fri, 27 May 2011 16:58:14 +0200 Subject: [PATCH 02/18] Added compatibility for the linux 'stat' command for the ant plugin --- plugins/ant/ant.plugin.zsh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/plugins/ant/ant.plugin.zsh b/plugins/ant/ant.plugin.zsh index 0544ac9..23bc775 100644 --- a/plugins/ant/ant.plugin.zsh +++ b/plugins/ant/ant.plugin.zsh @@ -1,8 +1,15 @@ +stat -f%m . > /dev/null 2>&1 +if [ "$?" = 0 ]; then + stat_cmd=(stat -f%m) +else + stat_cmd=(stat -L --format=%y) +fi + _ant_does_target_list_need_generating () { if [ ! -f .ant_targets ]; then return 0; else - accurate=$(stat -f%m .ant_targets) - changed=$(stat -f%m build.xml) + accurate=$($stat_cmd -f%m .ant_targets) + changed=$($stat_cmd -f%m build.xml) return $(expr $accurate '>=' $changed) fi } From df5345fd8afd2581beda44359ce44a7d92b67293 Mon Sep 17 00:00:00 2001 From: Andrew Hodges Date: Sat, 28 May 2011 10:16:06 -0400 Subject: [PATCH 03/18] Ruby Switching Helpers Add helper functions to switch gemsets on ruby-1.8.7-p334 and ruby-1.9.2-p180. Add completion definitions for helper functions. --- plugins/rvm/rvm.plugin.zsh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/plugins/rvm/rvm.plugin.zsh b/plugins/rvm/rvm.plugin.zsh index ef934d5..2741238 100644 --- a/plugins/rvm/rvm.plugin.zsh +++ b/plugins/rvm/rvm.plugin.zsh @@ -1,3 +1,28 @@ fpath=($ZSH/plugins/rvm $fpath) autoload -U compinit compinit -i + +local ruby18='ruby-1.8.7-p334' +local ruby19='ruby-1.9.2-p180' + +function rb18 { + if [ -z "$1" ]; then + rvm use "$ruby18" + else + rvm use "$ruby18@$1" + fi +} + +_rb18() {compadd `ls -1 $rvm_path/gems | grep "^$ruby18@" | sed -e "s/^$ruby18@//" | awk '{print $1}'`} +compdef _rb18 rb18 + +function rb19 { + if [ -z "$1" ]; then + rvm use "$ruby19" + else + rvm use "$ruby19@$1" + fi +} + +_rb19() {compadd `ls -1 $rvm_path/gems | grep "^$ruby19@" | sed -e "s/^$ruby19@//" | awk '{print $1}'`} +compdef _rb19 rb19 From 8bc3f278e5400d83dfd7b67c26229506e6d70232 Mon Sep 17 00:00:00 2001 From: Andrew Hodges Date: Sat, 28 May 2011 10:23:06 -0400 Subject: [PATCH 04/18] Helpful Listing Aliases Add alias to list installed rubies. Add alias to list gemsets in active ruby. --- plugins/rvm/rvm.plugin.zsh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/rvm/rvm.plugin.zsh b/plugins/rvm/rvm.plugin.zsh index 2741238..ba780c9 100644 --- a/plugins/rvm/rvm.plugin.zsh +++ b/plugins/rvm/rvm.plugin.zsh @@ -2,6 +2,9 @@ fpath=($ZSH/plugins/rvm $fpath) autoload -U compinit compinit -i +alias rubies='rvm list rubies' +alias gemsets='rvm gemset list' + local ruby18='ruby-1.8.7-p334' local ruby19='ruby-1.9.2-p180' From acac0a2a47899e988e849a89981078cbe990c1a4 Mon Sep 17 00:00:00 2001 From: Andrew Hodges Date: Sat, 28 May 2011 10:35:54 -0400 Subject: [PATCH 05/18] RVM Update Helpers Add helper function to get rvm head. Add helper function to link zsh completion that comes with rvm into om-my-zsh plugin directory, but don't overwrite the completion that comes with oh-my-zsh (oh-my-zsh's completion is better, but I want to be able to compare). --- plugins/rvm/rvm.plugin.zsh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plugins/rvm/rvm.plugin.zsh b/plugins/rvm/rvm.plugin.zsh index ba780c9..509dcbd 100644 --- a/plugins/rvm/rvm.plugin.zsh +++ b/plugins/rvm/rvm.plugin.zsh @@ -29,3 +29,12 @@ function rb19 { _rb19() {compadd `ls -1 $rvm_path/gems | grep "^$ruby19@" | sed -e "s/^$ruby19@//" | awk '{print $1}'`} compdef _rb19 rb19 + +function rvm-update { + rvm get head + rvm reload # TODO: Reload rvm completion? +} + +function rvm-link-completion { + ln -s "$rvm_path/scripts/zsh/Completion/_rvm" "$ZSH/plugins/rvm/_rvm.official" +} From 7b8290a4e1c9229ba66795897344114cc20d9e98 Mon Sep 17 00:00:00 2001 From: Andrew Hodges Date: Sat, 28 May 2011 10:50:06 -0400 Subject: [PATCH 06/18] Gem List Helper Add helper function to list gems in a pretty way (only with rvm, for now). Add missng EOF newline and a todo to the ruby plugin. --- plugins/ruby/ruby.plugin.zsh | 4 +++- plugins/rvm/rvm.plugin.zsh | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/plugins/ruby/ruby.plugin.zsh b/plugins/ruby/ruby.plugin.zsh index 82bf5d4..08ca9c6 100644 --- a/plugins/ruby/ruby.plugin.zsh +++ b/plugins/ruby/ruby.plugin.zsh @@ -1,4 +1,6 @@ +# TODO: Make this compatible with rvm. +# Run sudo gem on the system ruby, not the active ruby. alias sgem='sudo gem' # Find ruby file -alias rfind='find . -name *.rb | xargs grep -n' \ No newline at end of file +alias rfind='find . -name *.rb | xargs grep -n' diff --git a/plugins/rvm/rvm.plugin.zsh b/plugins/rvm/rvm.plugin.zsh index 509dcbd..8a3ec78 100644 --- a/plugins/rvm/rvm.plugin.zsh +++ b/plugins/rvm/rvm.plugin.zsh @@ -38,3 +38,15 @@ function rvm-update { function rvm-link-completion { ln -s "$rvm_path/scripts/zsh/Completion/_rvm" "$ZSH/plugins/rvm/_rvm.official" } + +# TODO: Make this usable w/o rvm. +function gems { + local current_ruby=`rvm-prompt i v p` + local current_gemset=`rvm-prompt g` + + gem list $@ | sed \ + -Ee "s/\([0-9\.]+( .+)?\)/$fg[blue]&$reset_color/g" \ + -Ee "s|$(echo $rvm_path)|$fg[magenta]\$rvm_path$reset_color|g" \ + -Ee "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \ + -Ee "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g" +} From c6688047f7588a70b9fa413a971fe9414ef41bbe Mon Sep 17 00:00:00 2001 From: Andrew Hodges Date: Sat, 28 May 2011 10:57:48 -0400 Subject: [PATCH 07/18] Brew Plugin Merge completion with official brew completion. Add a helper to link official completion into oh-my-zsh plugin (without overwriting). Add an alias to list installed brews. Add brews to the path (in a somewhat strange way). --- plugins/brew/_brew | 24 +++++++++++++++++------- plugins/brew/brew.plugin.zsh | 13 +++++++++++++ 2 files changed, 30 insertions(+), 7 deletions(-) create mode 100644 plugins/brew/brew.plugin.zsh diff --git a/plugins/brew/_brew b/plugins/brew/_brew index cee1e25..1dcf0a4 100644 --- a/plugins/brew/_brew +++ b/plugins/brew/_brew @@ -25,10 +25,12 @@ _1st_arguments=( 'link:link a formula' 'list:list files in a formula or not-installed formulae' 'log:git commit log for a formula' + 'missing:check all installed formuale for missing dependencies.' 'outdated:list formulas for which a newer version is available' 'prune:remove dead links' 'remove:remove a formula' 'search:search for a formula (/regex/ or string)' + 'server:start a local web app that lets you browse formulae (requires Sinatra)' 'unlink:unlink a formula' 'update:freshen up links' 'upgrade:upgrade outdated formulae' @@ -36,10 +38,14 @@ _1st_arguments=( ) local expl -local -a formula installed_formulae +local -a formulae installed_formulae _arguments \ - '(-v --verbose)'{-v,--verbose}'[verbose]' \ + '(-v)-v[verbose]' \ + '(--cellar)--cellar[brew cellar]' \ + '(--config)--config[brew configuration]' \ + '(--env)--env[brew environment]' \ + '(--repository)--repository[brew repository]' \ '(--version)--version[version information]' \ '(--prefix)--prefix[where brew lives on this system]' \ '(--cache)--cache[brew cache]' \ @@ -51,20 +57,24 @@ if (( CURRENT == 1 )); then fi case "$words[1]" in - list) + search|-S) + _arguments \ + '(--macports)--macports[search the macports repository]' \ + '(--fink)--fink[search the fink repository]' ;; + list|ls) _arguments \ '(--unbrewed)--unbrewed[files in brew --prefix not controlled by brew]' \ + '(--versions)--versions[list all installed versions of a formula]' \ '1: :->forms' && return 0 if [[ "$state" == forms ]]; then _brew_installed_formulae - _requested installed_formulae expl 'installed formulae' compadd -a installed_formulae + _wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae fi ;; - install|home|log|info|uses|cat|deps) + install|home|homepage|log|info|abv|uses|cat|deps|edit|options) _brew_all_formulae _wanted formulae expl 'all formulae' compadd -a formulae ;; - remove|edit|xo) + remove|rm|uninstall|unlink|cleanup|link|ln) _brew_installed_formulae _wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae ;; esac - diff --git a/plugins/brew/brew.plugin.zsh b/plugins/brew/brew.plugin.zsh new file mode 100644 index 0000000..f584a46 --- /dev/null +++ b/plugins/brew/brew.plugin.zsh @@ -0,0 +1,13 @@ +# Move /usr/local/bin (path where brews are linked) to the front of the path +# This will allow us to override system binaries like ruby with our brews +# TODO: Do this in a more compatible way. +# What if someone doesn't have /usr/bin in their path? +export PATH=`echo $PATH | sed -e 's|/usr/local/bin||' -e 's|::|:|g'` # Remove /usr/local/bin +export PATH=`echo $PATH | sed -e 's|/usr/bin|/usr/local/bin:&|'` # Add it in front of /usr/bin +export PATH=`echo $PATH | sed -e 's|/usr/bin|/usr/local/sbin:&|'` # Add /usr/local/sbin + +alias brews='brew list -1' + +function brew-link-completion { + ln -s "$(brew --prefix)/Library/Contributions/brew_zsh_completion.zsh" "$ZSH/plugins/brew/_brew.official" +} From 513938e5c358a37f960cf7206938335d5c7d29fc Mon Sep 17 00:00:00 2001 From: Andrew Hodges Date: Sat, 28 May 2011 11:09:37 -0400 Subject: [PATCH 08/18] Pow! Restart Helper Add helper function to restart an app running on Pow! --- plugins/pow/pow.plugin.zsh | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 plugins/pow/pow.plugin.zsh diff --git a/plugins/pow/pow.plugin.zsh b/plugins/pow/pow.plugin.zsh new file mode 100644 index 0000000..6b2a6f2 --- /dev/null +++ b/plugins/pow/pow.plugin.zsh @@ -0,0 +1,10 @@ +# Thanks to Christopher Sexton +# https://gist.github.com/965032 +function kapow { + touch ~/.pow/$1/tmp/restart.txt + if [ $? -eq 0 ]; then + echo "$fg[yellow]Pow restarting $1...$reset_color" + fi +} + +compctl -W ~/.pow -/ kapow From f14b00808d531bc1195e9ad23e12182834156a36 Mon Sep 17 00:00:00 2001 From: Andrew Hodges Date: Sat, 28 May 2011 11:20:48 -0400 Subject: [PATCH 09/18] Node.js Helpers Add helper function to open node api in browser. Add binaries installed via npm to path. Tell node where to find things (what things?). --- plugins/node/node.plugin.zsh | 8 ++++++++ plugins/npm/npm.plugin.zsh | 2 ++ 2 files changed, 10 insertions(+) create mode 100644 plugins/node/node.plugin.zsh create mode 100644 plugins/npm/npm.plugin.zsh diff --git a/plugins/node/node.plugin.zsh b/plugins/node/node.plugin.zsh new file mode 100644 index 0000000..18f3533 --- /dev/null +++ b/plugins/node/node.plugin.zsh @@ -0,0 +1,8 @@ +# This works if you installed node via homebrew. +export NODE_PATH="/usr/local/lib/node" + +# Open the node api for your current version to the optional section. +# TODO: Make the section part easier to use. +function node-api { + open "http://nodejs.org/docs/$(node --version)/api/all.html#$1" +} diff --git a/plugins/npm/npm.plugin.zsh b/plugins/npm/npm.plugin.zsh new file mode 100644 index 0000000..0b0a30e --- /dev/null +++ b/plugins/npm/npm.plugin.zsh @@ -0,0 +1,2 @@ +# TODO: Don't do this in such a weird way. +export PATH=`echo $PATH | sed -e 's|/usr/bin|/usr/local/share/npm/bin:&|'` From 8e7fa7cefcff63f78df434fa96b636281e629cba Mon Sep 17 00:00:00 2001 From: Andrew Hodges Date: Sat, 28 May 2011 11:27:50 -0400 Subject: [PATCH 10/18] OS X Helpers Add helper aliases for show/hide files. Add helper alias to recursively delete .DS_Store files. --- plugins/osx/osx.plugin.zsh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh index 81eed5e..a65ca64 100644 --- a/plugins/osx/osx.plugin.zsh +++ b/plugins/osx/osx.plugin.zsh @@ -1,3 +1,9 @@ +alias showfiles='defaults write com.apple.finder AppleShowAllFiles TRUE; killall Finder' +alias hidefiles='defaults write com.apple.finder AppleShowAllFiles FALSE; killall Finder' + +# Recursively delete .DS_Store files +alias rm-dsstore="find . -name '*.DS_Store' -type f -delete" + function savepath() { pwd > ~/.current_path~ } From 2bab02829c4c60a1e123e5eb96bddc8cecc45dc8 Mon Sep 17 00:00:00 2001 From: brian tse Date: Sat, 28 May 2011 23:57:32 +0800 Subject: [PATCH 11/18] Add new 'minimal' theme --- themes/minimal.zsh-theme | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 themes/minimal.zsh-theme diff --git a/themes/minimal.zsh-theme b/themes/minimal.zsh-theme new file mode 100644 index 0000000..ee3ab6b --- /dev/null +++ b/themes/minimal.zsh-theme @@ -0,0 +1,15 @@ +ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[white]%}[" +ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}●%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="" + +#Customized git status, oh-my-zsh currently does not allow render dirty status before branch +git_custom_status() { + local cb=$(current_branch) + if [ -n "$cb" ]; then + echo "- $ZSH_THEME_GIT_PROMPT_PREFIX$(current_branch)$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX" + fi +} + + +PROMPT='%2~ $(git_custom_status) »%b ' \ No newline at end of file From bcfa9b192098db3fc56b6fdd6b904e35db33ef68 Mon Sep 17 00:00:00 2001 From: Andrew Hodges Date: Sat, 28 May 2011 13:06:03 -0400 Subject: [PATCH 12/18] Cleanup Add missing newlines at EOF. Remove redundant comment. Fix grammar in comment. --- plugins/cap/cap.plugin.zsh | 2 +- plugins/compleat/compleat.plugin.zsh | 2 -- plugins/github/github.plugin.zsh | 1 - plugins/textmate/textmate.plugin.zsh | 4 +--- 4 files changed, 2 insertions(+), 7 deletions(-) diff --git a/plugins/cap/cap.plugin.zsh b/plugins/cap/cap.plugin.zsh index a0fa21d..8336182 100644 --- a/plugins/cap/cap.plugin.zsh +++ b/plugins/cap/cap.plugin.zsh @@ -18,4 +18,4 @@ function _cap () { fi } -compctl -K _cap cap \ No newline at end of file +compctl -K _cap cap diff --git a/plugins/compleat/compleat.plugin.zsh b/plugins/compleat/compleat.plugin.zsh index 8d16a56..38f1b39 100644 --- a/plugins/compleat/compleat.plugin.zsh +++ b/plugins/compleat/compleat.plugin.zsh @@ -5,7 +5,6 @@ # VERSION: 1.0.0 # ------------------------------------------------------------------------------ - if (( ${+commands[compleat]} )); then local prefix="${commands[compleat]:h:h}" local setup="${prefix}/share/compleat-1.0/compleat_setup" @@ -19,4 +18,3 @@ if (( ${+commands[compleat]} )); then source "$setup" fi fi - diff --git a/plugins/github/github.plugin.zsh b/plugins/github/github.plugin.zsh index df7053b..1eb3381 100644 --- a/plugins/github/github.plugin.zsh +++ b/plugins/github/github.plugin.zsh @@ -4,4 +4,3 @@ if [ "$commands[(I)hub]" ]; then # eval `hub alias -s zsh` function git(){hub "$@"} fi - diff --git a/plugins/textmate/textmate.plugin.zsh b/plugins/textmate/textmate.plugin.zsh index 7c4c14a..aa2f75f 100644 --- a/plugins/textmate/textmate.plugin.zsh +++ b/plugins/textmate/textmate.plugin.zsh @@ -1,11 +1,9 @@ - -# TextMate alias et='mate .' alias ett='mate app config lib db public spec test Rakefile Capfile Todo' alias etp='mate app config lib db public spec test vendor/plugins vendor/gems Rakefile Capfile Todo' alias etts='mate app config lib db public script spec test vendor/plugins vendor/gems Rakefile Capfile Todo' -# Editor Ruby file in TextMate +# Edit Ruby app in TextMate alias mr='mate CHANGELOG app config db lib public script spec test' function tm() { From 92ba1f5737aea661e336e035e7a41e44f4d74a59 Mon Sep 17 00:00:00 2001 From: Andrew Hodges Date: Sat, 28 May 2011 13:12:03 -0400 Subject: [PATCH 13/18] Thor Add plugin with completion for thor. --- plugins/thor/_thor | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 plugins/thor/_thor diff --git a/plugins/thor/_thor b/plugins/thor/_thor new file mode 100644 index 0000000..9f7ed5a --- /dev/null +++ b/plugins/thor/_thor @@ -0,0 +1,4 @@ +#compdef thor +#autoload + +compadd `thor list | grep thor | cut -d " " -f 2` From edfa673b6fd5f07a0595a4fafa43d7602db5677c Mon Sep 17 00:00:00 2001 From: Magnus Woldrich Date: Sun, 29 May 2011 11:55:24 +0200 Subject: [PATCH 14/18] add trapd00r theme --- themes/trapd00r.zsh-theme | 95 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 themes/trapd00r.zsh-theme diff --git a/themes/trapd00r.zsh-theme b/themes/trapd00r.zsh-theme new file mode 100644 index 0000000..cba14c4 --- /dev/null +++ b/themes/trapd00r.zsh-theme @@ -0,0 +1,95 @@ +# Name: trapd00r zsh theme +# Author: Magnus Woldrich +# +# This theme needs a terminal supporting 256 colors as well as unicode. It also +# needs the script that splits up the current path and makes it fancy as located +# here: https://github.com/trapd00r/utils/blob/master/zsh_path +# +# By default it spans over two lines like so: +# +# scp1@shiva:pts/9-> /home » scp1 (0) +# > +# +# that's user@host:pts/-> splitted path (return status) +# +# If the current directory is a git repository, we span 3 lines; +# +# git❨ master ❩ DIRTY +# scp1@shiva:pts/4-> /home » scp1 » dev » utils (0) +# > + +autoload -U add-zsh-hook +autoload -Uz vcs_info + +local c0=$( printf "\e[m") +local c1=$( printf "\e[38;5;245m") +local c2=$( printf "\e[38;5;250m") +local c3=$( printf "\e[38;5;242m") +local c4=$( printf "\e[38;5;197m") +local c5=$( printf "\e[38;5;225m") +local c6=$( printf "\e[38;5;240m") +local c7=$( printf "\e[38;5;242m") +local c8=$( printf "\e[38;5;244m") +local c9=$( printf "\e[38;5;162m") +local c10=$(printf "\e[1m") +local c11=$(printf "\e[38;5;208m\e[1m") +local c12=$(printf "\e[38;5;142m\e[1m") +local c13=$(printf "\e[38;5;196m\e[1m") + + +# We dont want to use the extended colorset in the TTY / VC. +if [ "$TERM" = "linux" ]; then + c1=$( printf "\e[34;1m") + c2=$( printf "\e[35m") + c3=$( printf "\e[31m") + c4=$( printf "\e[31;1m") + c5=$( printf "\e[32m") + c6=$( printf "\e[32;1m") + c7=$( printf "\e[33m") + c8=$( printf "\e[33;1m") + c9=$( printf "\e[34m") + + c11=$(printf "\e[35;1m") + c12=$(printf "\e[36m") + c13=$(printf "\e[31;1m") +fi + +zstyle ':vcs_info:*' actionformats \ + '%{$c8%}(%f%s)%{$c7%}-%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f ' + +zstyle ':vcs_info:*' formats \ + "%{$c8%}%s%%{$c7%}❨ %{$c9%}%{$c11%}%b%{$c7%} ❩%{$reset_color%}%f " + +zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r' +zstyle ':vcs_info:*' enable git + +add-zsh-hook precmd prompt_jnrowe_precmd + +prompt_jnrowe_precmd () { + vcs_info + if [ "${vcs_info_msg_0_}" = "" ]; then + dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})" + PROMPT='%{$fg_bold[green]%}%p%{$reset_color%}${vcs_info_msg_0_}${dir_status} ${ret_status}%{$reset_color%} +> ' + +# modified, to be commited + elif [[ $(git diff --cached --name-status 2>/dev/null ) != "" ]]; then + dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})" + PROMPT='${vcs_info_msg_0_}%{$30%} %{$bg_bold[red]%}%{$fg_bold[cyan]%}C%{$fg_bold[black]%}OMMIT%{$reset_color%} +%{$fg_bold[green]%}%p%{$reset_color%}${dir_status}%{$reset_color%} +> ' + + elif [[ $(git diff --name-status 2>/dev/null ) != "" ]]; then + dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})" + PROMPT='${vcs_info_msg_0_}%{$bg_bold[red]%}%{$fg_bold[blue]%}D%{$fg_bold[black]%}IRTY%{$reset_color%} +%{$fg_bold[green]%}%p%{$reset_color%}${dir_status}%{$reset_color%} +%{$c13%}>%{$c0%} ' + else + dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})" + PROMPT='${vcs_info_msg_0_} +%{$fg_bold[green]%}%p%{$reset_color%}${dir_status} ${vcs_info_msg_0_}%{$reset_color%} +> ' +fi +} + +# vim: set ft=zsh sw=2 et tw=0: From 80ed1cbc5dd9a82dfa54e5381d75210280246f6f Mon Sep 17 00:00:00 2001 From: Andrew Hodges Date: Mon, 30 May 2011 10:07:15 -0400 Subject: [PATCH 15/18] Rollback of Pull #366 sorin-ionescu had some good points. --- plugins/brew/brew.plugin.zsh | 12 ------------ plugins/node/node.plugin.zsh | 5 +---- plugins/npm/npm.plugin.zsh | 2 -- plugins/rvm/rvm.plugin.zsh | 9 ++------- 4 files changed, 3 insertions(+), 25 deletions(-) delete mode 100644 plugins/npm/npm.plugin.zsh diff --git a/plugins/brew/brew.plugin.zsh b/plugins/brew/brew.plugin.zsh index f584a46..c2e9588 100644 --- a/plugins/brew/brew.plugin.zsh +++ b/plugins/brew/brew.plugin.zsh @@ -1,13 +1 @@ -# Move /usr/local/bin (path where brews are linked) to the front of the path -# This will allow us to override system binaries like ruby with our brews -# TODO: Do this in a more compatible way. -# What if someone doesn't have /usr/bin in their path? -export PATH=`echo $PATH | sed -e 's|/usr/local/bin||' -e 's|::|:|g'` # Remove /usr/local/bin -export PATH=`echo $PATH | sed -e 's|/usr/bin|/usr/local/bin:&|'` # Add it in front of /usr/bin -export PATH=`echo $PATH | sed -e 's|/usr/bin|/usr/local/sbin:&|'` # Add /usr/local/sbin - alias brews='brew list -1' - -function brew-link-completion { - ln -s "$(brew --prefix)/Library/Contributions/brew_zsh_completion.zsh" "$ZSH/plugins/brew/_brew.official" -} diff --git a/plugins/node/node.plugin.zsh b/plugins/node/node.plugin.zsh index 18f3533..519bc18 100644 --- a/plugins/node/node.plugin.zsh +++ b/plugins/node/node.plugin.zsh @@ -1,8 +1,5 @@ -# This works if you installed node via homebrew. -export NODE_PATH="/usr/local/lib/node" - # Open the node api for your current version to the optional section. # TODO: Make the section part easier to use. -function node-api { +function node-docs { open "http://nodejs.org/docs/$(node --version)/api/all.html#$1" } diff --git a/plugins/npm/npm.plugin.zsh b/plugins/npm/npm.plugin.zsh deleted file mode 100644 index 0b0a30e..0000000 --- a/plugins/npm/npm.plugin.zsh +++ /dev/null @@ -1,2 +0,0 @@ -# TODO: Don't do this in such a weird way. -export PATH=`echo $PATH | sed -e 's|/usr/bin|/usr/local/share/npm/bin:&|'` diff --git a/plugins/rvm/rvm.plugin.zsh b/plugins/rvm/rvm.plugin.zsh index 8a3ec78..40fd88c 100644 --- a/plugins/rvm/rvm.plugin.zsh +++ b/plugins/rvm/rvm.plugin.zsh @@ -1,6 +1,5 @@ -fpath=($ZSH/plugins/rvm $fpath) -autoload -U compinit -compinit -i +# What does this really do? +# fpath=($ZSH/plugins/rvm $fpath) alias rubies='rvm list rubies' alias gemsets='rvm gemset list' @@ -35,10 +34,6 @@ function rvm-update { rvm reload # TODO: Reload rvm completion? } -function rvm-link-completion { - ln -s "$rvm_path/scripts/zsh/Completion/_rvm" "$ZSH/plugins/rvm/_rvm.official" -} - # TODO: Make this usable w/o rvm. function gems { local current_ruby=`rvm-prompt i v p` From 932d3fc90269443852d14650c7815218a2c64f2f Mon Sep 17 00:00:00 2001 From: Andrew Hodges Date: Mon, 30 May 2011 11:10:08 -0400 Subject: [PATCH 16/18] Remove Uneeded Lines --- plugins/rvm/rvm.plugin.zsh | 3 --- 1 file changed, 3 deletions(-) diff --git a/plugins/rvm/rvm.plugin.zsh b/plugins/rvm/rvm.plugin.zsh index 40fd88c..24621fe 100644 --- a/plugins/rvm/rvm.plugin.zsh +++ b/plugins/rvm/rvm.plugin.zsh @@ -1,6 +1,3 @@ -# What does this really do? -# fpath=($ZSH/plugins/rvm $fpath) - alias rubies='rvm list rubies' alias gemsets='rvm gemset list' From a3505c448f43a38d5483d048cb520ee557db3a35 Mon Sep 17 00:00:00 2001 From: Michael Hanson Date: Tue, 31 May 2011 15:13:23 -0700 Subject: [PATCH 17/18] Fix deleted in git.zsh --- lib/git.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/git.zsh b/lib/git.zsh index 2ace3d0..ce4de55 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -52,11 +52,11 @@ git_prompt_status() { if $(echo "$INDEX" | grep '^R ' &> /dev/null); then STATUS="$ZSH_THEME_GIT_PROMPT_RENAMED$STATUS" fi - if $(echo "$INDEX" | grep '^ D ' &> /dev/null); then + 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 -} \ No newline at end of file +} From 5298cbbabf8bd6ff754b7131416a20a76128d804 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Wed, 1 Jun 2011 09:33:12 +0200 Subject: [PATCH 18/18] Revert "Added my zsh theme file, heavily based on sjl's" as it relies on a dotfile to be in ~/bin. This reverts commit f2f34f5404e8ab674a0e345a709783b6c56a3b72. --- themes/thomasjbradley.zsh-theme | 29 ----------------------------- 1 file changed, 29 deletions(-) delete mode 100644 themes/thomasjbradley.zsh-theme diff --git a/themes/thomasjbradley.zsh-theme b/themes/thomasjbradley.zsh-theme deleted file mode 100644 index 857301d..0000000 --- a/themes/thomasjbradley.zsh-theme +++ /dev/null @@ -1,29 +0,0 @@ -function prompt_char { - git branch >/dev/null 2>/dev/null && echo '±' && return - hg root >/dev/null 2>/dev/null && echo '☿' && return - echo '○' -} - -function virtualenv_info { - [ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') ' -} - -function hg_prompt_info { - hg prompt --angle-brackets "\ -< on %{$fg[magenta]%}%{$reset_color%}>\ -< at %{$fg[yellow]%}%{$reset_color%}>\ -%{$fg[green]%}%{$reset_color%}< -patches: >" 2>/dev/null -} - -PROMPT=' -%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$(hg_prompt_info)$(git_prompt_info) -$(virtualenv_info)$(prompt_char) ' - -ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%}" -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%}!" -ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[green]%}?" -ZSH_THEME_GIT_PROMPT_CLEAN="" - -. ~/bin/dotfiles/zsh/aliases