mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-23 00:29:50 +00:00
Merge branch 'master' of https://github.com/robbyrussell/oh-my-zsh
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
if [ -f /opt/local/etc/profile.d/autojump.sh ]; then
|
||||
. /opt/local/etc/profile.d/autojump.sh
|
||||
elif [ -f `brew --prefix`/etc/autojump ]; then
|
||||
. `brew --prefix`/etc/autojump
|
||||
if [ $commands[autojump] ]; then # check if autojump is installed
|
||||
if [ -f /usr/share/autojump/autojump.zsh ]; then # debian and ubuntu package
|
||||
. /usr/share/autojump/autojump.zsh
|
||||
elif [ -f /etc/profile.d/autojump.zsh ]; then # manual installation
|
||||
. /etc/profile.d/autojump.zsh
|
||||
elif [ $commands[brew] -a -f `brew --prefix`/etc/autojump ]; then # mac os x with brew
|
||||
. `brew --prefix`/etc/autojump
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -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=(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 ey foreman guard heroku middleman nanoc rackup rainbows rake rspec ruby shotgun spec spork thin thor unicorn unicorn_rails)
|
||||
|
||||
## Functions
|
||||
|
||||
@@ -20,7 +16,7 @@ _bundler-installed() {
|
||||
|
||||
_within-bundled-project() {
|
||||
local check_dir=$PWD
|
||||
while [ "$(dirname $check_dir)" != "/" ]; do
|
||||
while [ $check_dir != "/" ]; do
|
||||
[ -f "$check_dir/Gemfile" ] && return
|
||||
check_dir="$(dirname $check_dir)"
|
||||
done
|
||||
|
||||
@@ -220,3 +220,4 @@ _managepy() {
|
||||
|
||||
compdef _managepy manage.py
|
||||
compdef _managepy django
|
||||
compdef _managepy django-manage
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ alias gup='git fetch && git rebase'
|
||||
compdef _git gup=git-fetch
|
||||
alias gp='git push'
|
||||
compdef _git gp=git-push
|
||||
gdv() { git-diff -w "$@" | view - }
|
||||
gdv() { git diff -w "$@" | view - }
|
||||
compdef _git gdv=git-diff
|
||||
alias gc='git commit -v'
|
||||
compdef _git gc=git-commit
|
||||
@@ -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'
|
||||
@@ -58,4 +60,4 @@ compdef ggpull=git
|
||||
alias ggpush='git push origin $(current_branch)'
|
||||
compdef ggpush=git
|
||||
alias ggpnp='git pull origin $(current_branch) && git push origin $(current_branch)'
|
||||
compdef ggpnp=git
|
||||
compdef ggpnp=git
|
||||
@@ -1,7 +1,17 @@
|
||||
# Setup hub function for git, if it is available; http://github.com/defunkt/hub
|
||||
if [ "$commands[(I)hub]" ] && [ "$commands[(I)ruby]" ]; then
|
||||
# eval `hub alias -s zsh`
|
||||
function git(){hub "$@"}
|
||||
function git(){
|
||||
if ! (( $+_has_working_hub )); then
|
||||
hub --version &> /dev/null
|
||||
_has_working_hub=$(($? == 0))
|
||||
fi
|
||||
if (( $_has_working_hub )) ; then
|
||||
hub "$@"
|
||||
else
|
||||
command git "$@"
|
||||
fi
|
||||
}
|
||||
fi
|
||||
|
||||
# Functions #################################################################
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -1,10 +1,66 @@
|
||||
# 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
|
||||
# Restart a rack app running under pow
|
||||
# http://pow.cx/
|
||||
#
|
||||
# Adds a kapow command that will restart an app
|
||||
#
|
||||
# $ kapow myapp
|
||||
#
|
||||
# Supports command completion.
|
||||
#
|
||||
# If you are not already using completion you might need to enable it with
|
||||
#
|
||||
# autoload -U compinit compinit
|
||||
#
|
||||
# Changes:
|
||||
#
|
||||
# Defaults to the current application, and will walk up the tree to find
|
||||
# a config.ru file and restart the corresponding app
|
||||
#
|
||||
# Will Detect if a app does not exist in pow and print a (slightly) helpful
|
||||
# error message
|
||||
|
||||
rack_root_detect(){
|
||||
setopt chaselinks
|
||||
local orgdir=$(pwd)
|
||||
local basedir=$(pwd)
|
||||
|
||||
while [[ $basedir != '/' ]]; do
|
||||
test -e "$basedir/config.ru" && break
|
||||
builtin cd ".." 2>/dev/null
|
||||
basedir="$(pwd)"
|
||||
done
|
||||
|
||||
builtin cd $orgdir 2>/dev/null
|
||||
[[ ${basedir} == "/" ]] && return 1
|
||||
echo `basename $basedir | sed -E "s/.(com|net|org)//"`
|
||||
}
|
||||
|
||||
kapow(){
|
||||
local vhost=$1
|
||||
[ ! -n "$vhost" ] && vhost=$(rack_root_detect)
|
||||
if [ ! -h ~/.pow/$vhost ]
|
||||
then
|
||||
echo "pow: This domain isn’t set up yet. Symlink your application to ${vhost} first."
|
||||
return 1
|
||||
fi
|
||||
|
||||
[ ! -d ~/.pow/${vhost}/tmp ] && mkdir -p ~/.pow/$vhost/tmp
|
||||
touch ~/.pow/$vhost/tmp/restart.txt;
|
||||
[ $? -eq 0 ] && echo "pow: restarting $vhost.dev"
|
||||
}
|
||||
compctl -W ~/.pow -/ kapow
|
||||
|
||||
powit(){
|
||||
local basedir=$(pwd)
|
||||
local vhost=$1
|
||||
[ ! -n "$vhost" ] && vhost=$(rack_root_detect)
|
||||
if [ ! -h ~/.pow/$vhost ]
|
||||
then
|
||||
echo "pow: Symlinking your app with pow. ${vhost}"
|
||||
[ ! -d ~/.pow/${vhost} ] && ln -s $basedir ~/.pow/$vhost
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# View the standard out (puts) from any pow app
|
||||
alias kaput="tail -f ~/Library/Logs/Pow/apps/*"
|
||||
|
||||
@@ -2,6 +2,7 @@ alias ss='thin --stats "/thin/stats" start'
|
||||
alias sg='ruby script/generate'
|
||||
alias sd='ruby script/destroy'
|
||||
alias sp='ruby script/plugin'
|
||||
alias sr='ruby script/runner'
|
||||
alias ssp='ruby script/spec'
|
||||
alias rdbm='rake db:migrate'
|
||||
alias sc='ruby script/console'
|
||||
|
||||
@@ -14,6 +14,7 @@ alias rdb='_rails_command dbconsole'
|
||||
alias rdbm='rake db:migrate db:test:clone'
|
||||
alias rg='_rails_command generate'
|
||||
alias rp='_rails_command plugin'
|
||||
alias ru='_rails_command runner'
|
||||
alias rs='_rails_command server'
|
||||
alias rsd='_rails_command server --debugger'
|
||||
alias devlog='tail -f log/development.log'
|
||||
|
||||
6
plugins/rake/rake.plugin.zsh
Normal file
6
plugins/rake/rake.plugin.zsh
Normal 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 ...
|
||||
|
||||
|
||||
@@ -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.
|
||||
# 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 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.
|
||||
# The above copyright notice and this permission notice shall be included
|
||||
# in all copies or substantial portions of the Software.
|
||||
#
|
||||
# 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 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.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along with
|
||||
# this program; if not, write to the
|
||||
#
|
||||
# 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}"
|
||||
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
|
||||
|
||||
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
|
||||
# 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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user