mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-12-18 10:22:00 +00:00
Merge branch 'master' of github.com:robbyrussell/oh-my-zsh
This commit is contained in:
commit
13998bb2cc
6 changed files with 56 additions and 45 deletions
|
@ -11,7 +11,9 @@ fpath=($ZSH/functions $ZSH/completions $fpath)
|
||||||
|
|
||||||
# Load all of the config files in ~/oh-my-zsh that end in .zsh
|
# 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
|
# 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
|
# Set ZSH_CUSTOM to the path where your custom config files
|
||||||
# and plugins exists, or else we will use the default custom/
|
# and plugins exists, or else we will use the default custom/
|
||||||
|
@ -51,7 +53,9 @@ for plugin ($plugins); do
|
||||||
done
|
done
|
||||||
|
|
||||||
# Load all of your custom configurations from custom/
|
# 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
|
# Load the theme
|
||||||
if [ "$ZSH_THEME" = "random" ]
|
if [ "$ZSH_THEME" = "random" ]
|
||||||
|
|
|
@ -3,6 +3,8 @@ if [ $commands[autojump] ]; then # check if autojump is installed
|
||||||
. /usr/share/autojump/autojump.zsh
|
. /usr/share/autojump/autojump.zsh
|
||||||
elif [ -f /etc/profile.d/autojump.zsh ]; then # manual installation
|
elif [ -f /etc/profile.d/autojump.zsh ]; then # manual installation
|
||||||
. /etc/profile.d/autojump.zsh
|
. /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
|
elif [ -f /opt/local/etc/profile.d/autojump.zsh ]; then # mac os x with ports
|
||||||
. /opt/local/etc/profile.d/autojump.zsh
|
. /opt/local/etc/profile.d/autojump.zsh
|
||||||
elif [ $commands[brew] -a -f `brew --prefix`/etc/autojump.zsh ]; then # mac os x with brew
|
elif [ $commands[brew] -a -f `brew --prefix`/etc/autojump.zsh ]; then # mac os x with brew
|
||||||
|
|
|
@ -4,7 +4,7 @@ alias rubies='rvm list rubies'
|
||||||
alias gemsets='rvm gemset list'
|
alias gemsets='rvm gemset list'
|
||||||
|
|
||||||
local ruby18='ruby-1.8.7-p334'
|
local ruby18='ruby-1.8.7-p334'
|
||||||
local ruby19='ruby-1.9.2-p180'
|
local ruby19='ruby-1.9.3-p194'
|
||||||
|
|
||||||
function rb18 {
|
function rb18 {
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
|
@ -44,3 +44,8 @@ function gems {
|
||||||
-Ee "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \
|
-Ee "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \
|
||||||
-Ee "s/$current_ruby$current_gemset$/$fg[green]&$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
|
||||||
|
|
|
@ -1,46 +1,40 @@
|
||||||
WRAPPER_FOUND=0
|
wrapsource=`which virtualenvwrapper.sh`
|
||||||
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
|
|
||||||
|
|
||||||
if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then
|
if [[ -f "$wrapsource" ]]; then
|
||||||
# Automatically activate Git projects' virtual environments based on the
|
source $wrapsource
|
||||||
# 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
|
|
||||||
}
|
|
||||||
|
|
||||||
# New cd function that does the virtualenv magic
|
if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then
|
||||||
function cd {
|
# Automatically activate Git projects' virtual environments based on the
|
||||||
builtin cd "$@" && workon_cwd
|
# 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
|
||||||
fi
|
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
|
fi
|
||||||
done
|
else
|
||||||
|
print "zsh virtualenvwrapper plugin: Cannot find virtualenvwrapper.sh. Please install with \`pip install virtualenvwrapper\`."
|
||||||
if [ $WRAPPER_FOUND -eq 0 ] ; then
|
|
||||||
print "zsh virtualenvwrapper plugin: Couldn't activate virtualenvwrapper. Please run \`pip install virtualenvwrapper\`."
|
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
# ZSH Theme emulating the Fish shell's default prompt.
|
# 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'
|
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%}'
|
PROMPT2='%{$fg[red]%}\ %{$reset_color%}'
|
||||||
|
|
||||||
local return_status="%{$fg_bold[red]%}%(?..%?)%{$reset_color%}"
|
local return_status="%{$fg_bold[red]%}%(?..%?)%{$reset_color%}"
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
functions rbenv_prompt_info >& /dev/null || rbenv_prompt_info(){}
|
||||||
|
|
||||||
function theme_precmd {
|
function theme_precmd {
|
||||||
local TERMWIDTH
|
local TERMWIDTH
|
||||||
(( TERMWIDTH = ${COLUMNS} - 1 ))
|
(( TERMWIDTH = ${COLUMNS} - 1 ))
|
||||||
|
|
Loading…
Reference in a new issue