summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.textile2
-rw-r--r--oh-my-zsh.sh12
-rw-r--r--plugins/bundler/bundler.plugin.zsh6
-rw-r--r--plugins/django/django.plugin.zsh1
-rw-r--r--plugins/extract/extract.plugin.zsh5
-rw-r--r--plugins/git/git.plugin.zsh2
-rw-r--r--plugins/mercurial/mercurial.plugin.zsh10
-rw-r--r--plugins/rake/rake.plugin.zsh6
-rw-r--r--plugins/rvm/rvm.plugin.zsh2
-rw-r--r--plugins/taskwarrior/_task162
-rw-r--r--plugins/terminalapp/terminalapp.plugin.zsh11
-rw-r--r--themes/mortalscumbag.zsh-theme58
-rw-r--r--tools/upgrade.sh27
13 files changed, 177 insertions, 127 deletions
diff --git a/README.textile b/README.textile
index eca968089..bf6776665 100644
--- a/README.textile
+++ b/README.textile
@@ -56,7 +56,7 @@ 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 @custom/plugins/@ directory and then enable this plugin.
+If you have many functions which go well 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/@.
diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh
index aeeaa3daf..732a403b7 100644
--- a/oh-my-zsh.sh
+++ b/oh-my-zsh.sh
@@ -19,13 +19,19 @@ if [[ -z "$ZSH_CUSTOM" ]]; then
ZSH_CUSTOM="$ZSH/custom"
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
# before running compinit.
-plugin=${plugin:=()}
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)
- elif [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then
+ elif is_plugin $ZSH $plugin; then
fpath=($ZSH/plugins/$plugin $fpath)
fi
done
diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh
index 7b73c8fed..74a3adaf8 100644
--- a/plugins/bundler/bundler.plugin.zsh
+++ b/plugins/bundler/bundler.plugin.zsh
@@ -1,7 +1,3 @@
-fpath=($ZSH/plugins/bundler $fpath)
-autoload -U compinit
-compinit -i
-
alias be="bundle exec"
alias bi="bundle install"
alias bl="bundle list"
@@ -10,7 +6,7 @@ alias bu="bundle update"
# The following is based on https://github.com/gma/bundler-exec
-bundled_commands=(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 middleman nanoc rackup rainbows rake rspec ruby shotgun spec spork thin thor unicorn unicorn_rails)
## Functions
diff --git a/plugins/django/django.plugin.zsh b/plugins/django/django.plugin.zsh
index 1d72a2f2c..0bbd031fe 100644
--- a/plugins/django/django.plugin.zsh
+++ b/plugins/django/django.plugin.zsh
@@ -220,3 +220,4 @@ _managepy() {
compdef _managepy manage.py
compdef _managepy django
+compdef _managepy django-manage
diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh
index 8cc17f7d4..5c125e98b 100644
--- a/plugins/extract/extract.plugin.zsh
+++ b/plugins/extract/extract.plugin.zsh
@@ -78,8 +78,3 @@ function extract() {
alias x=extract
-# add extract completion function to path
-fpath=($ZSH/plugins/extract $fpath)
-autoload -U compinit
-compinit -i
-
diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh
index c1b382b2c..ae080662f 100644
--- a/plugins/git/git.plugin.zsh
+++ b/plugins/git/git.plugin.zsh
@@ -36,6 +36,8 @@ alias ga='git add'
compdef _git ga=git-add
alias gm='git merge'
compdef _git gm=git-merge
+alias grh='git reset HEAD'
+alias grhh='git reset HEAD --hard'
# Git and svn mix
alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk'
diff --git a/plugins/mercurial/mercurial.plugin.zsh b/plugins/mercurial/mercurial.plugin.zsh
index 2988f0a46..caf0d9efc 100644
--- a/plugins/mercurial/mercurial.plugin.zsh
+++ b/plugins/mercurial/mercurial.plugin.zsh
@@ -1,14 +1,14 @@
# Mercurial
-alias hgc='hg commit -v'
-alias hgb='hg branch -v'
+alias hgc='hg commit'
+alias hgb='hg branch'
alias hgba='hg branches'
alias hgco='hg checkout'
alias hgd='hg diff'
alias hged='hg diffmerge'
# pull and update
-alias hgl='hg pull -u -v'
-alias hgp='hg push -v'
-alias hgs='hg status -v'
+alias hgl='hg pull -u'
+alias hgp='hg push'
+alias hgs='hg status'
# this is the 'git commit --amend' equivalent
alias hgca='hg qimport -r tip ; hg qrefresh -e ; hg qfinish tip'
diff --git a/plugins/rake/rake.plugin.zsh b/plugins/rake/rake.plugin.zsh
new file mode 100644
index 000000000..16b933c14
--- /dev/null
+++ b/plugins/rake/rake.plugin.zsh
@@ -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 ...
+
+
diff --git a/plugins/rvm/rvm.plugin.zsh b/plugins/rvm/rvm.plugin.zsh
index 24621fe0b..604c00713 100644
--- a/plugins/rvm/rvm.plugin.zsh
+++ b/plugins/rvm/rvm.plugin.zsh
@@ -37,7 +37,7 @@ function gems {
local current_gemset=`rvm-prompt g`
gem list $@ | sed \
- -Ee "s/\([0-9\.]+( .+)?\)/$fg[blue]&$reset_color/g" \
+ -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"
diff --git a/plugins/taskwarrior/_task b/plugins/taskwarrior/_task
index 5bffa9119..0bda738bb 100644
--- a/plugins/taskwarrior/_task
+++ b/plugins/taskwarrior/_task
@@ -1,37 +1,37 @@
#compdef task
-#
# zsh completion for taskwarrior
#
+# taskwarrior - a command line task list manager.
+#
# Copyright 2010 - 2011 Johannes Schlatow
# Copyright 2009 P.C. Shyamshankar
-# All rights reserved.
-#
-# This script is part of the taskwarrior project.
#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-# details.
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
#
-# Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor,
-# Boston, MA
-# 02110-1301
-# USA
+# http://www.opensource.org/licenses/mit-license.php
#
typeset -g _task_cmds _task_projects _task_tags _task_config _task_modifiers
_task_projects=($(task _projects))
_task_tags=($(task _tags))
_task_ids=($(task _ids))
_task_config=($(task _config))
+_task_columns=($(task _columns))
_task_modifiers=(
'before' \
'after' \
@@ -46,39 +46,19 @@ _task_modifiers=(
'word' \
'noword'
)
+_task_conjunctions=(
+ 'and' \
+ 'or' \
+ 'xor' \
+ '\)'
+ '\('
+)
_task_cmds=($(task _commands))
_task_zshcmds=( ${(f)"$(task _zshcommands)"} )
-
-_task_idCmds=(
- 'append' \
- 'prepend' \
- 'annotate' \
- 'denotate' \
- 'edit' \
- 'duplicate' \
- 'info' \
- 'start' \
- 'stop' \
- 'done'
-)
-
-_task_idCmdsDesc=(
- 'append:Appends more description to an existing task.' \
- 'prepend:Prepends more description to an existing task.' \
- 'annotate:Adds an annotation to an existing task.' \
- 'denotate:Deletes an annotation of an existing task.' \
- 'edit:Launches an editor to let you modify a task directly.' \
- 'duplicate:Duplicates the specified task, and allows modifications.' \
- 'info:Shows all data, metadata for specified task.' \
- 'start:Marks specified task as started.' \
- 'stop:Removes the start time from a task.' \
- 'done:Marks the specified task as completed.'
-)
-
_task() {
_arguments -s -S \
- "*::task command:_task_commands"
+ "*::task default:_task_default"
return 0
}
@@ -148,6 +128,7 @@ _regex_words values 'task frequencies' \
'weekly:Every week' \
'biweekly:Every two weeks' \
'fortnight:Every two weeks' \
++ 'monthly:Every month' \
'quarterly:Every three months' \
'semiannual:Every six months' \
'annual:Every year' \
@@ -196,22 +177,13 @@ _regex_arguments _task_attributes "${args[@]}"
## task commands
-# default completion
-(( $+functions[_task_default] )) ||
-_task_default() {
+# filter completion
+(( $+functions[_task_filter] )) ||
+_task_filter() {
_task_attributes "$@"
-}
-# commands expecting an ID
-(( $+functions[_task_id] )) ||
-_task_id() {
- if (( CURRENT < 3 )); then
- # update IDs
- _task_zshids=( ${(f)"$(task _zshids)"} )
- _describe -t values 'task IDs' _task_zshids
- else
- _task_attributes "$@"
- fi
+ # TODO complete conjunctions only if the previous word is a filter expression, i.e. attribute, ID, any non-command
+ _describe -t default 'task conjunctions' _task_conjunctions
}
# merge completion
@@ -235,46 +207,42 @@ _task_pull() {
_files
}
+# execute completion
+(( $+functions[_task_execute] )) ||
+_task_execute() {
+ _files
+}
-# modify (task [0-9]* ...) completion
-(( $+functions[_task_modify] )) ||
-_task_modify() {
- _describe -t commands 'task command' _task_idCmdsDesc
- _task_attributes "$@"
+# id-only completion
+(( $+functions[_task_id] )) ||
+_task_id() {
+ _describe -t values 'task IDs' _task_zshids
}
## first level completion => task sub-command completion
-(( $+functions[_task_commands] )) ||
-_task_commands() {
+(( $+functions[_task_default] )) ||
+_task_default() {
local cmd ret=1
- if (( CURRENT == 1 )); then
- # update IDs
- _task_zshids=( ${(f)"$(task _zshids)"} )
-
- _describe -t commands 'task command' _task_zshcmds
- _describe -t values 'task IDs' _task_zshids
- # TODO match more than one ID
- elif [[ $words[1] =~ ^[0-9]*$ ]] then
- _call_function ret _task_modify
- return ret
- else
-# local curcontext="${curcontext}"
-# cmd="${_task_cmds[(r)$words[1]:*]%%:*}"
- cmd="${_task_cmds[(r)$words[1]]}"
- idCmd="${(M)_task_idCmds[@]:#$words[1]}"
- if (( $#cmd )); then
-# curcontext="${curcontext%:*:*}:task-${cmd}"
- if (( $#idCmd )); then
- _call_function ret _task_id
- else
- _call_function ret _task_${cmd} ||
- _call_function ret _task_default ||
- _message "No command remaining."
- fi
- else
- _message "Unknown subcommand ${cmd}"
- fi
- return ret
- fi
+ integer i=1
+ while (( i < $#words ))
+ do
+ cmd="${_task_cmds[(r)$words[$i]]}"
+ if (( $#cmd )); then
+ _call_function ret _task_${cmd} ||
+ _call_function ret _task_filter ||
+ _message "No command remaining."
+ return ret
+ fi
+ (( i++ ))
+ done
+
+ # update IDs
+ _task_zshids=( ${(f)"$(task _zshids)"} )
+
+ _describe -t commands 'task command' _task_zshcmds
+ _describe -t values 'task IDs' _task_zshids
+ _call_function ret _task_filter
+
+ return ret
}
diff --git a/plugins/terminalapp/terminalapp.plugin.zsh b/plugins/terminalapp/terminalapp.plugin.zsh
new file mode 100644
index 000000000..4695ad055
--- /dev/null
+++ b/plugins/terminalapp/terminalapp.plugin.zsh
@@ -0,0 +1,11 @@
+# Set Apple Terminal.app resume directory
+# based on this answer: http://superuser.com/a/315029
+
+function chpwd {
+ local SEARCH=' '
+ local REPLACE='%20'
+ local PWD_URL="file://$HOSTNAME${PWD//$SEARCH/$REPLACE}"
+ printf '\e]7;%s\a' "$PWD_URL"
+}
+
+chpwd \ No newline at end of file
diff --git a/themes/mortalscumbag.zsh-theme b/themes/mortalscumbag.zsh-theme
new file mode 100644
index 000000000..7e25b149f
--- /dev/null
+++ b/themes/mortalscumbag.zsh-theme
@@ -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%}"
diff --git a/tools/upgrade.sh b/tools/upgrade.sh
index 6ffe56f4c..b2a1c06c4 100644
--- a/tools/upgrade.sh
+++ b/tools/upgrade.sh
@@ -1,12 +1,19 @@
current_path=`pwd`
printf '\033[0;34m%s\033[0m\n' "Upgrading Oh My Zsh"
-( cd $ZSH && git pull origin master )
-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;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'
-cd "$current_path"
+cd $ZSH
+
+if git pull origin master
+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;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" \ No newline at end of file