[#23] Prevent errors when completion is disabled

This commit is contained in:
Sorin Ionescu 2012-04-03 20:14:08 -04:00
parent d5a94dda74
commit e2859daba4
4 changed files with 113 additions and 113 deletions

View File

@ -130,7 +130,7 @@ if zstyle -t ':omz:alias:diff' color; then
if (( $+commands[colormake] )); then
alias make='colormake'
compdef colormake=make
compdef colormake=make 2> /dev/null
fi
fi

View File

@ -7,108 +7,108 @@
# Git
alias g='git'
compdef g=git
compdef g=git 2> /dev/null
# Branch (b)
alias gb='git branch'
compdef _git gb=git-branch
compdef _git gb=git-branch 2> /dev/null
alias gbc='git checkout -b'
compdef _git gbc=git-checkout
compdef _git gbc=git-checkout 2> /dev/null
alias gbl='git branch -v'
compdef _git gbl=git-branch
compdef _git gbl=git-branch 2> /dev/null
alias gbL='git branch -av'
compdef _git gbL=git-branch
compdef _git gbL=git-branch 2> /dev/null
alias gbx='git branch -d'
compdef _git gbx=git-branch
compdef _git gbx=git-branch 2> /dev/null
alias gbX='git branch -D'
compdef _git gbX=git-branch
compdef _git gbX=git-branch 2> /dev/null
alias gbm='git branch -m'
compdef _git gbm=git-branch
compdef _git gbm=git-branch 2> /dev/null
alias gbM='git branch -M'
compdef _git gbM=git-branch
compdef _git gbM=git-branch 2> /dev/null
# Commit (c)
alias gc='git commit'
compdef _git gc=git-commit
compdef _git gc=git-commit 2> /dev/null
alias gca='git commit --all'
compdef _git gca=git-commit
compdef _git gca=git-commit 2> /dev/null
alias gcm='git commit --message'
compdef _git gcm=git-commit
compdef _git gcm=git-commit 2> /dev/null
alias gco='git checkout'
compdef _git gco=git-checkout
compdef _git gco=git-checkout 2> /dev/null
alias gcO='git checkout HEAD --'
compdef _git gcO=git-checkout
compdef _git gcO=git-checkout 2> /dev/null
alias gcf='git commit --amend --reuse-message HEAD'
compdef _git gcf=git-commit
compdef _git gcf=git-commit 2> /dev/null
alias gcp='git cherry-pick --ff'
compdef _git gcp=git-cherry-pick
compdef _git gcp=git-cherry-pick 2> /dev/null
alias gcP='git cherry-pick --no-commit'
compdef _git gcP=git-cherry-pick
compdef _git gcP=git-cherry-pick 2> /dev/null
alias gcr='git revert'
compdef _git gcr=git-revert
compdef _git gcr=git-revert 2> /dev/null
alias gcR='git reset "HEAD^"'
compdef _git gcR=git-reset
compdef _git gcR=git-reset 2> /dev/null
alias gcs='git show'
compdef _git gcs=git-show
compdef _git gcs=git-show 2> /dev/null
alias gcv='git fsck | awk '\''/dangling commit/ {print $3}'\'' | git show --format="SHA1: %C(green)%h%C(reset) %f" --stdin | awk '\''/SHA1/ {sub("SHA1: ", ""); print}'\'''
# Data (d)
alias gd='git ls-files'
compdef _git gd=git-ls-files
compdef _git gd=git-ls-files 2> /dev/null
alias gdc='git ls-files --cached'
compdef _git gdc=git-ls-files
compdef _git gdc=git-ls-files 2> /dev/null
alias gdx='git ls-files --deleted'
compdef _git gdx=git-ls-files
compdef _git gdx=git-ls-files 2> /dev/null
alias gdm='git ls-files --modified'
compdef _git gdm=git-ls-files
compdef _git gdm=git-ls-files 2> /dev/null
alias gdu='git ls-files --other --exclude-standard'
compdef _git gdu=git-ls-files
compdef _git gdu=git-ls-files 2> /dev/null
alias gdk='git ls-files --killed'
compdef _git gdk=git-ls-files
compdef _git gdk=git-ls-files 2> /dev/null
alias gdi='git status --porcelain --short --ignored | sed -n "s/^!! //p"'
# Fetch (f)
alias gf='git fetch'
compdef _git gf=git-fetch
compdef _git gf=git-fetch 2> /dev/null
alias gfc='git clone'
compdef _git gfc=git-clone
compdef _git gfc=git-clone 2> /dev/null
alias gfm='git pull'
compdef _git gfm=git-pull
compdef _git gfm=git-pull 2> /dev/null
alias gfr='git pull --rebase'
compdef _git gfr=git-pull
compdef _git gfr=git-pull 2> /dev/null
# Index (i)
alias gia='git add'
compdef _git gia=git-add
compdef _git gia=git-add 2> /dev/null
alias giA='git add --patch'
compdef _git giA=git-add
compdef _git giA=git-add 2> /dev/null
alias giu='git add --update'
compdef _git giu=git-add
compdef _git giu=git-add 2> /dev/null
alias gid='git diff --no-ext-diff --cached'
compdef _git gid=git-diff
compdef _git gid=git-diff 2> /dev/null
alias giD='git diff --no-ext-diff --cached --word-diff'
compdef _git giD=git-diff
compdef _git giD=git-diff 2> /dev/null
alias gir='git reset --mixed'
compdef _git gir=git-reset
compdef _git gir=git-reset 2> /dev/null
alias giR='git reset --keep'
compdef _git giR=git-reset
compdef _git giR=git-reset 2> /dev/null
alias gix='git rm -r --cached'
compdef _git gix=git-rm
compdef _git gix=git-rm 2> /dev/null
alias giX='git rm -rf --cached'
compdef _git giX=git-rm
compdef _git giX=git-rm 2> /dev/null
alias gig='git grep --cached'
compdef _git gig=git-grep
compdef _git gig=git-grep 2> /dev/null
# Konflict (k)
alias gkl='git status | sed -n "s/^.*both [a-z]*ed: *//p"'
alias gka='git add $(gkl)'
compdef _git gka=git-add
compdef _git gka=git-add 2> /dev/null
alias gke='git mergetool $(gkl)'
alias gko='git checkout --ours --'
compdef _git gko=git-checkout
compdef _git gko=git-checkout 2> /dev/null
alias gkO='gko $(gkl)'
alias gkt='git checkout --theirs --'
compdef _git gkt=git-checkout
compdef _git gkt=git-checkout 2> /dev/null
alias gkT='gkt $(gkl)'
# Log (l)
@ -117,138 +117,138 @@ git_log_format_oneline='--pretty=format:%C(green)%h%C(reset) %s%n'
git_log_format_brief='--pretty=format:%C(green)%h%C(reset) %s%n%C(blue)(%ar by %an)%C(red)%d%C(reset)%n'
alias gl='git log --topo-order ${git_log_format_medium}'
compdef _git gl=git-log
compdef _git gl=git-log 2> /dev/null
alias gls='git log --topo-order --stat ${git_log_format_medium}'
compdef _git gls=git-log
compdef _git gls=git-log 2> /dev/null
alias gld='git log --topo-order --stat --patch --full-diff ${git_log_format_medium}'
compdef _git gld=git-log
compdef _git gld=git-log 2> /dev/null
alias glo='git log --topo-order ${git_log_format_oneline}'
compdef _git glo=git-log
compdef _git glo=git-log 2> /dev/null
alias glg='git log --topo-order --all --graph ${git_log_format_oneline}'
compdef _git glg=git-log
compdef _git glg=git-log 2> /dev/null
alias glb='git log --topo-order ${git_log_format_brief}'
compdef _git glb=git-log
compdef _git glb=git-log 2> /dev/null
alias glc='git shortlog --summary --numbered'
compdef _git glc=git-shortlog
compdef _git glc=git-shortlog 2> /dev/null
# Merge (m)
alias gm='git merge'
compdef _git gm=git-merge
compdef _git gm=git-merge 2> /dev/null
alias gmC='git merge --no-commit'
compdef _git gmC=git-merge
compdef _git gmC=git-merge 2> /dev/null
alias gmF='git merge --no-ff'
compdef _git gmF=git-merge
compdef _git gmF=git-merge 2> /dev/null
alias gma='git merge --abort'
compdef _git gma=git-merge
compdef _git gma=git-merge 2> /dev/null
alias gmt='git mergetool'
compdef _git gmt=git-mergetool
compdef _git gmt=git-mergetool 2> /dev/null
# Push (p)
alias gp='git push'
compdef _git gp=git-push
compdef _git gp=git-push 2> /dev/null
alias gpf='git push --force'
compdef _git gpf=git-push
compdef _git gpf=git-push 2> /dev/null
alias gpa='git push --all'
compdef _git gpa=git-push
compdef _git gpa=git-push 2> /dev/null
alias gpA='git push --all && git push --tags'
compdef _git gpA=git-push
compdef _git gpA=git-push 2> /dev/null
alias gpt='git push --tags'
compdef _git gpt=git-push
compdef _git gpt=git-push 2> /dev/null
alias gpc='git push --set-upstream origin "$(git-current-branch)"'
compdef _git gpc=git-push
compdef _git gpc=git-push 2> /dev/null
alias gpp='git pull origin "$(git-current-branch)" && git push origin "$(git-branch)"'
# Rebase (r)
alias gr='git rebase'
compdef _git gr=git-rebase
compdef _git gr=git-rebase 2> /dev/null
alias gra='git rebase --abort'
compdef _git gra=git-rebase
compdef _git gra=git-rebase 2> /dev/null
alias grc='git rebase --continue'
compdef _git grc=git-rebase
compdef _git grc=git-rebase 2> /dev/null
alias gri='git rebase --interactive'
compdef _git gri=git-rebase
compdef _git gri=git-rebase 2> /dev/null
alias grs='git rebase --skip'
compdef _git grs=git-rebase
compdef _git grs=git-rebase 2> /dev/null
# Remote (R)
alias gR='git remote'
compdef _git gh=git-remote
compdef _git gh=git-remote 2> /dev/null
alias gRl='git remote --verbose'
compdef _git gRl=git-remote
compdef _git gRl=git-remote 2> /dev/null
alias gRa='git remote add'
compdef _git gRa=git-remote
compdef _git gRa=git-remote 2> /dev/null
alias gRx='git remote rm'
compdef _git gRx=git-remote
compdef _git gRx=git-remote 2> /dev/null
alias gRm='git remote rename'
compdef _git gRm=git-remote
compdef _git gRm=git-remote 2> /dev/null
alias gRu='git remote update'
compdef _git gRu=git-remote
compdef _git gRu=git-remote 2> /dev/null
alias gRc='git remote prune'
compdef _git gRc=git-remote
compdef _git gRc=git-remote 2> /dev/null
alias gRs='git remote show'
compdef _git gRs=git-remote
compdef _git gRs=git-remote 2> /dev/null
alias gRb='git-hub'
compdef _git-hub gRb=git-hub
compdef _git-hub gRb=git-hub 2> /dev/null
# Stash (s)
alias gs='git stash'
compdef _git gs=git-stash
compdef _git gs=git-stash 2> /dev/null
alias gsa='git stash apply'
compdef _git gsa=git-stash
compdef _git gsa=git-stash 2> /dev/null
alias gsc='git stash clear'
compdef _git gsc=git-stash
compdef _git gsc=git-stash 2> /dev/null
alias gsx='git stash drop'
compdef _git gsx=git-stash
compdef _git gsx=git-stash 2> /dev/null
alias gsl='git stash list'
compdef _git gsl=git-stash
compdef _git gsl=git-stash 2> /dev/null
alias gsL='git stash show --patch --stat'
compdef _git gsL=git-stash
compdef _git gsL=git-stash 2> /dev/null
alias gsp='git stash pop'
compdef _git gsp=git-stash
compdef _git gsp=git-stash 2> /dev/null
alias gss='git stash save --include-untracked'
compdef _git gss=git-stash
compdef _git gss=git-stash 2> /dev/null
alias gsS='git stash save --patch --no-keep-index'
compdef _git gsS=git-stash
compdef _git gsS=git-stash 2> /dev/null
# Submodule (S)
alias gS='git submodule'
compdef _git gS=git-submodule
compdef _git gS=git-submodule 2> /dev/null
alias gSa='git submodule add'
compdef _git gSa=git-submodule
compdef _git gSa=git-submodule 2> /dev/null
alias gSf='git submodule foreach'
compdef _git gSf=git-submodule
compdef _git gSf=git-submodule 2> /dev/null
alias gSi='git submodule init'
compdef _git gSi=git-submodule
compdef _git gSi=git-submodule 2> /dev/null
alias gSl='git submodule status'
compdef _git gSl=git-submodule
compdef _git gSl=git-submodule 2> /dev/null
alias gSs='git submodule sync'
compdef _git gSs=git-submodule
compdef _git gSs=git-submodule 2> /dev/null
alias gSu='git submodule update'
compdef _git gSu=git-submodule
compdef _git gSu=git-submodule 2> /dev/null
alias gSU='git submodule update --init --recursive'
compdef _git gSU=git-submdoule
compdef _git gSU=git-submdoule 2> /dev/null
# Working Copy (w)
alias gws='git status --short'
compdef _git gws=git-status
compdef _git gws=git-status 2> /dev/null
alias gwS='git status'
compdef _git gwS=git-status
compdef _git gwS=git-status 2> /dev/null
alias gwd='git diff --no-ext-diff'
compdef _git gwd=git-diff
compdef _git gwd=git-diff 2> /dev/null
alias gwD='git diff --no-ext-diff --word-diff'
compdef _git gwD=git-diff
compdef _git gwD=git-diff 2> /dev/null
alias gwr='git reset --soft'
compdef _git gwr=git-reset
compdef _git gwr=git-reset 2> /dev/null
alias gwR='git reset --hard'
compdef _git gwR=git-reset
compdef _git gwR=git-reset 2> /dev/null
alias gwc='git clean -n'
compdef _git gwc=git-clean
compdef _git gwc=git-clean 2> /dev/null
alias gwC='git clean -f'
compdef _git gwC=git-clean
compdef _git gwC=git-clean 2> /dev/null
alias gwx='git rm -r'
compdef _git gwx=git-rm
compdef _git gwx=git-rm 2> /dev/null
alias gwX='git rm -rf'
compdef _git gwX=git-rm
compdef _git gwX=git-rm 2> /dev/null
alias gwg='git grep'
compdef _git gwg=git-grep
compdef _git gwg=git-grep 2> /dev/null

View File

@ -15,13 +15,13 @@ if [[ "$OSTYPE" == darwin* ]] && grep -q 'file-flags' <(rsync --help 2>&1); then
fi
alias rsync-copy="${rsync_cmd}"
compdef _rsync rsync-copy=rsync
compdef _rsync rsync-copy=rsync 2> /dev/null
alias rsync-move="${rsync_cmd} --remove-source-files"
compdef _rsync rsync-move=rsync
compdef _rsync rsync-move=rsync 2> /dev/null
alias rsync-update="${rsync_cmd} --update"
compdef _rsync rsync-upate=rsync
compdef _rsync rsync-upate=rsync 2> /dev/null
alias rsync-synchronize="${rsync_cmd} --update --delete"
compdef _rsync rsync-synchronize=rsync
compdef _rsync rsync-synchronize=rsync 2> /dev/null
unset rsync_cmd

View File

@ -17,25 +17,25 @@ alias http-serve='python -m SimpleHTTPServer'
function mkdcd {
[[ -n "$1" ]] && mkdir -p "$1" && cd "$1"
}
compdef _mkdir mkdcd
compdef _mkdir mkdcd 2> /dev/null
# Changes to a directory and lists its contents.
function cdll {
builtin cd "$1" && ll
}
compdef _cd cdll
compdef _cd cdll 2> /dev/null
# Pushes an entry onto the directory stack and lists its contents.
function pushdll {
builtin pushd "$1" && ll
}
compdef _cd pushdll
compdef _cd pushdll 2> /dev/null
# Pops an entry off the directory stack and lists its contents.
function popdll {
builtin popd "$1" && ll
}
compdef _cd popdll
compdef _cd popdll 2> /dev/null
# Prints columns 1 2 3 ... n.
function slit {
@ -46,7 +46,7 @@ function slit {
function pmine {
ps "$@" -U "$USER" -o pid,%cpu,%mem,command
}
compdef _ps pmine
compdef _ps pmine 2> /dev/null
# Finds files and executes a command on them.
function find-exec {