浏览代码

Merge branch 'master' of github.com:robbyrussell/oh-my-zsh

Robby Russell 12 年之前
父节点
当前提交
13998bb2cc

+ 6 - 2
oh-my-zsh.sh

@@ -11,7 +11,9 @@ fpath=($ZSH/functions $ZSH/completions $fpath)
 
 # Load all of the config files in ~/oh-my-zsh that end in .zsh
 # TIP: Add files you don't want in git to .gitignore
-for config_file ($ZSH/lib/*.zsh) source $config_file
+for config_file ($ZSH/lib/*.zsh); do
+  source $config_file
+done
 
 # Set ZSH_CUSTOM to the path where your custom config files
 # and plugins exists, or else we will use the default custom/
@@ -51,7 +53,9 @@ for plugin ($plugins); do
 done
 
 # Load all of your custom configurations from custom/
-for config_file ($ZSH_CUSTOM/*.zsh(N)) source $config_file
+for config_file ($ZSH_CUSTOM/*.zsh(N)); do
+  source $config_file
+done
 
 # Load the theme
 if [ "$ZSH_THEME" = "random" ]

+ 2 - 0
plugins/autojump/autojump.plugin.zsh

@@ -3,6 +3,8 @@ if [ $commands[autojump] ]; then # check if autojump is installed
     . /usr/share/autojump/autojump.zsh
   elif [ -f /etc/profile.d/autojump.zsh ]; then # manual installation
     . /etc/profile.d/autojump.zsh
+  elif [ -f $HOME/.autojump/etc/profile.d/autojump.zsh ]; then # manual user-local installation
+    . $HOME/.autojump/etc/profile.d/autojump.zsh
   elif [ -f /opt/local/etc/profile.d/autojump.zsh ]; then # mac os x with ports
     . /opt/local/etc/profile.d/autojump.zsh
   elif [ $commands[brew] -a -f `brew --prefix`/etc/autojump.zsh ]; then # mac os x with brew

+ 6 - 1
plugins/rvm/rvm.plugin.zsh

@@ -4,7 +4,7 @@ alias rubies='rvm list rubies'
 alias gemsets='rvm gemset list'
 
 local ruby18='ruby-1.8.7-p334'
-local ruby19='ruby-1.9.2-p180'
+local ruby19='ruby-1.9.3-p194'
 
 function rb18 {
 	if [ -z "$1" ]; then
@@ -44,3 +44,8 @@ function gems {
 		-Ee "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \
 		-Ee "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g"
 }
+
+function _rvm_completion {
+  source $rvm_path"/scripts/zsh/Completion/_rvm"
+}
+compdef _rvm_completion rvm

+ 35 - 41
plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh

@@ -1,46 +1,40 @@
-WRAPPER_FOUND=0
-for wrapsource in "/usr/bin/virtualenvwrapper.sh" "/usr/local/bin/virtualenvwrapper.sh" "/etc/bash_completion.d/virtualenvwrapper" ; do
-  if [[ -e $wrapsource ]] ; then
-    WRAPPER_FOUND=1
-    source $wrapsource
+wrapsource=`which virtualenvwrapper.sh`
 
-    if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then
-      # Automatically activate Git projects' virtual environments based on the
-      # directory name of the project. Virtual environment name can be overridden
-      # by placing a .venv file in the project root with a virtualenv name in it
-      function workon_cwd {
-          # Check that this is a Git repo
-          PROJECT_ROOT=`git rev-parse --show-toplevel 2> /dev/null`
-          if (( $? == 0 )); then
-              # Check for virtualenv name override
-              ENV_NAME=`basename "$PROJECT_ROOT"`
-              if [[ -f "$PROJECT_ROOT/.venv" ]]; then
-                  ENV_NAME=`cat "$PROJECT_ROOT/.venv"`
-              fi
-              # Activate the environment only if it is not already active
-              if [[ "$VIRTUAL_ENV" != "$WORKON_HOME/$ENV_NAME" ]]; then
-                  if [[ -e "$WORKON_HOME/$ENV_NAME/bin/activate" ]]; then
-                      workon "$ENV_NAME" && export CD_VIRTUAL_ENV="$ENV_NAME"
-                  fi
-              fi
-          elif [ $CD_VIRTUAL_ENV ]; then
-              # We've just left the repo, deactivate the environment
-              # Note: this only happens if the virtualenv was activated automatically
-              deactivate && unset CD_VIRTUAL_ENV
-          fi
-          unset PROJECT_ROOT
-      }
+if [[ -f "$wrapsource" ]]; then
+  source $wrapsource
 
-      # New cd function that does the virtualenv magic
-      function cd {
-          builtin cd "$@" && workon_cwd
-      }
-    fi
+  if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then
+    # Automatically activate Git projects' virtual environments based on the
+    # directory name of the project. Virtual environment name can be overridden
+    # by placing a .venv file in the project root with a virtualenv name in it
+    function workon_cwd {
+        # Check that this is a Git repo
+        PROJECT_ROOT=`git rev-parse --show-toplevel 2> /dev/null`
+        if (( $? == 0 )); then
+            # Check for virtualenv name override
+            ENV_NAME=`basename "$PROJECT_ROOT"`
+            if [[ -f "$PROJECT_ROOT/.venv" ]]; then
+                ENV_NAME=`cat "$PROJECT_ROOT/.venv"`
+            fi
+            # Activate the environment only if it is not already active
+            if [[ "$VIRTUAL_ENV" != "$WORKON_HOME/$ENV_NAME" ]]; then
+                if [[ -e "$WORKON_HOME/$ENV_NAME/bin/activate" ]]; then
+                    workon "$ENV_NAME" && export CD_VIRTUAL_ENV="$ENV_NAME"
+                fi
+            fi
+        elif [ $CD_VIRTUAL_ENV ]; then
+            # We've just left the repo, deactivate the environment
+            # Note: this only happens if the virtualenv was activated automatically
+            deactivate && unset CD_VIRTUAL_ENV
+        fi
+        unset PROJECT_ROOT
+    }
 
-    break
+    # New cd function that does the virtualenv magic
+    function cd {
+        builtin cd "$@" && workon_cwd
+    }
   fi
-done
-
-if [ $WRAPPER_FOUND -eq 0 ] ; then
-  print "zsh virtualenvwrapper plugin: Couldn't activate virtualenvwrapper. Please run \`pip install virtualenvwrapper\`."
+else
+  print "zsh virtualenvwrapper plugin: Cannot find virtualenvwrapper.sh. Please install with \`pip install virtualenvwrapper\`."
 fi

+ 5 - 1
themes/fishy.zsh-theme

@@ -1,7 +1,11 @@
 # ZSH Theme emulating the Fish shell's default prompt.
 
+_fishy_collapsed_wd() {
+  echo $(pwd | perl -pe "s|^$HOME|~|g; s|/([^/])[^/]*(?=/)|/\$1|g")
+}
+
 local user_color='green'; [ $UID -eq 0 ] && user_color='red'
-PROMPT='%n@%m %{$fg[$user_color]%}%~%{$reset_color%}%(!.#.>) '
+PROMPT='%n@%m %{$fg[$user_color]%}$(_fishy_collapsed_wd)%{$reset_color%}%(!.#.>) '
 PROMPT2='%{$fg[red]%}\ %{$reset_color%}'
 
 local return_status="%{$fg_bold[red]%}%(?..%?)%{$reset_color%}"

+ 2 - 0
themes/jonathan.zsh-theme

@@ -1,3 +1,5 @@
+functions rbenv_prompt_info >& /dev/null || rbenv_prompt_info(){}
+
 function theme_precmd {
     local TERMWIDTH
     (( TERMWIDTH = ${COLUMNS} - 1 ))