This commit is contained in:
André Brás 2012-01-19 11:21:13 +00:00
commit 3fbf6139e1
7 changed files with 92 additions and 23 deletions

View file

@ -19,13 +19,19 @@ if [[ -z "$ZSH_CUSTOM" ]]; then
ZSH_CUSTOM="$ZSH/custom" ZSH_CUSTOM="$ZSH/custom"
fi fi
is_plugin() {
local base_dir=$1
local name=$2
test -f $base_dir/plugins/$name/$name.plugin.zsh \
|| test -f $base_dir/plugins/$name/_$name
}
# Add all defined plugins to fpath. This must be done # Add all defined plugins to fpath. This must be done
# before running compinit. # before running compinit.
plugin=${plugin:=()}
for plugin ($plugins); do for plugin ($plugins); do
if [ -f $ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh ]; then if is_plugin $ZSH_CUSTOM $plugin; then
fpath=($ZSH_CUSTOM/plugins/$plugin $fpath) fpath=($ZSH_CUSTOM/plugins/$plugin $fpath)
elif [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then elif is_plugin $ZSH $plugin; then
fpath=($ZSH/plugins/$plugin $fpath) fpath=($ZSH/plugins/$plugin $fpath)
fi fi
done done

View file

@ -1,7 +1,3 @@
fpath=($ZSH/plugins/bundler $fpath)
autoload -U compinit
compinit -i
alias be="bundle exec" alias be="bundle exec"
alias bi="bundle install" alias bi="bundle install"
alias bl="bundle list" alias bl="bundle list"
@ -10,7 +6,7 @@ alias bu="bundle update"
# The following is based on https://github.com/gma/bundler-exec # The following is based on https://github.com/gma/bundler-exec
bundled_commands=(annotate cap capify cucumber foreman guard heroku nanoc rackup rainbows rake rspec ruby shotgun spec spork thin unicorn unicorn_rails) bundled_commands=(annotate cap capify cucumber foreman guard heroku nanoc rackup rainbows rake rspec ruby shotgun spec spork thin thor unicorn unicorn_rails)
## Functions ## Functions

View file

@ -220,3 +220,4 @@ _managepy() {
compdef _managepy manage.py compdef _managepy manage.py
compdef _managepy django compdef _managepy django
compdef _managepy django-manage

View file

@ -78,8 +78,3 @@ function extract() {
alias x=extract alias x=extract
# add extract completion function to path
fpath=($ZSH/plugins/extract $fpath)
autoload -U compinit
compinit -i

View file

@ -0,0 +1,6 @@
alias rake="noglob rake" # allows square brackts for rake task invocation
alias brake='noglob bundle exec rake' # execute the bundled rake gem
alias srake='noglob sudo rake' # noglob must come before sudo
alias sbrake='noglob sudo bundle exec rake' # altogether now ...

View file

@ -0,0 +1,58 @@
function my_git_prompt() {
tester=$(git rev-parse --git-dir 2> /dev/null) || return
INDEX=$(git status --porcelain 2> /dev/null)
STATUS=""
# is branch ahead?
if $(echo "$(git log origin/$(current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_AHEAD"
fi
# is anything staged?
if $(echo "$INDEX" | grep -E -e '^(D[ M]|[MARC][ MD]) ' &> /dev/null); then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_STAGED"
fi
# is anything unstaged?
if $(echo "$INDEX" | grep -E -e '^[ MARC][MD] ' &> /dev/null); then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNSTAGED"
fi
# is anything untracked?
if $(echo "$INDEX" | grep '^?? ' &> /dev/null); then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED"
fi
# is anything unmerged?
if $(echo "$INDEX" | grep -E -e '^(A[AU]|D[DU]|U[ADU]) ' &> /dev/null); then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNMERGED"
fi
if [[ -n $STATUS ]]; then
STATUS=" $STATUS"
fi
echo "$ZSH_THEME_GIT_PROMPT_PREFIX$(my_current_branch)$STATUS$ZSH_THEME_GIT_PROMPT_SUFFIX"
}
function my_current_branch() {
echo $(current_branch || echo "(no branch)")
}
function ssh_connection() {
if [[ -n $SSH_CONNECTION ]]; then
echo "%{$fg_bold[red]%}(ssh) "
fi
}
PROMPT=$'\n$(ssh_connection)%{$fg_bold[green]%}%n@%m%{$reset_color%}$(my_git_prompt) : %~\n%# '
ZSH_THEME_PROMPT_RETURNCODE_PREFIX="%{$fg_bold[red]%}"
ZSH_THEME_GIT_PROMPT_PREFIX=" $fg[white] %{$fg_bold[yellow]%}"
ZSH_THEME_GIT_PROMPT_AHEAD="%{$fg_bold[magenta]%}↑"
ZSH_THEME_GIT_PROMPT_STAGED="%{$fg_bold[green]%}●"
ZSH_THEME_GIT_PROMPT_UNSTAGED="%{$fg_bold[red]%}●"
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg_bold[white]%}●"
ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg_bold[red]%}✕"
ZSH_THEME_GIT_PROMPT_SUFFIX=" $fg_bold[white]%{$reset_color%}"

View file

@ -1,12 +1,19 @@
current_path=`pwd` current_path=`pwd`
printf '\033[0;34m%s\033[0m\n' "Upgrading Oh My Zsh" printf '\033[0;34m%s\033[0m\n' "Upgrading Oh My Zsh"
( cd $ZSH && git pull origin master ) cd $ZSH
printf '\033[0;32m%s\033[0m\n' ' __ __ '
printf '\033[0;32m%s\033[0m\n' ' ____ / /_ ____ ___ __ __ ____ _____/ /_ ' if git pull origin master
printf '\033[0;32m%s\033[0m\n' ' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ ' then
printf '\033[0;32m%s\033[0m\n' '/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / ' printf '\033[0;32m%s\033[0m\n' ' __ __ '
printf '\033[0;32m%s\033[0m\n' '\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ ' printf '\033[0;32m%s\033[0m\n' ' ____ / /_ ____ ___ __ __ ____ _____/ /_ '
printf '\033[0;32m%s\033[0m\n' ' /____/ ' printf '\033[0;32m%s\033[0m\n' ' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '
printf '\033[0;34m%s\033[0m\n' 'Hooray! Oh My Zsh has been updated and/or is at the current version.' printf '\033[0;32m%s\033[0m\n' '/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '
printf '\033[0;34m%s\033[1m%s\033[0m\n' 'To keep up on the latest, be sure to follow Oh My Zsh on twitter: ' 'http://twitter.com/ohmyzsh' printf '\033[0;32m%s\033[0m\n' '\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '
cd "$current_path" printf '\033[0;32m%s\033[0m\n' ' /____/ '
printf '\033[0;34m%s\033[0m\n' 'Hooray! Oh My Zsh has been updated and/or is at the current version.'
printf '\033[0;34m%s\033[1m%s\033[0m\n' 'To keep up on the latest, be sure to follow Oh My Zsh on twitter: ' 'http://twitter.com/ohmyzsh'
else
printf '\033[0;31m%s\033[0m\n' 'There was an error updating. Try again later?'
fi
cd "$current_path"