Skip to content

Instantly share code, notes, and snippets.

@tbhaxor
Created Apr 21, 2021
Embed
What would you like to do?
Bashit Alias Plugin Diff
--- /tmp/alias_completion-24679HnwBXq 2021-04-22 05:02:47.842921363 +0530
+++ /home/terabyte/.bash_it/plugins/available/alias-completion.plugin.bash 2021-04-22 05:02:46.726252452 +0530
@@ -1,2424 +1,106 @@
-function _alias_completion::- {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='cd -'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 1 ))
- COMP_WORDS=(cd - ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/-/cd -}
- (( COMP_POINT += ${#COMP_LINE} ))
- _cd "cd" "$compl_word" "$prec_word"
- }
-complete -o nospace -F _alias_completion::- -
-function _alias_completion::.. {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='cd ..'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 1 ))
- COMP_WORDS=(cd .. ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/../cd ..}
- (( COMP_POINT += ${#COMP_LINE} ))
- _cd "cd" "$compl_word" "$prec_word"
- }
-complete -o nospace -F _alias_completion::.. ..
-function _alias_completion::... {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='cd ../..'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 1 ))
- COMP_WORDS=(cd ../.. ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/.../cd ../..}
- (( COMP_POINT += ${#COMP_LINE} ))
- _cd "cd" "$compl_word" "$prec_word"
- }
-complete -o nospace -F _alias_completion::... ...
-function _alias_completion::.... {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='cd ../../..'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 1 ))
- COMP_WORDS=(cd ../../.. ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/..../cd ../../..}
- (( COMP_POINT += ${#COMP_LINE} ))
- _cd "cd" "$compl_word" "$prec_word"
- }
-complete -o nospace -F _alias_completion::.... ....
-complete -c -f _
-complete -F _bash-it-comp babsh
-complete -F _bash-it-comp bash_it
-complete -F _bash-it-comp bash_ti
-complete -F _bash-it-comp bashit
-complete -F _bash-it-comp batbsh
-complete -F _bash-it-comp batshit
-function _alias_completion::bshena {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='bash-it enable alias'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(bash-it enable alias ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/bshena/bash-it enable alias}
- (( COMP_POINT += ${#COMP_LINE} ))
- _bash-it-comp "bash-it" "$compl_word" "$prec_word"
- }
-complete -F _alias_completion::bshena bshena
-function _alias_completion::bshenc {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='bash-it enable completion'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(bash-it enable completion ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/bshenc/bash-it enable completion}
- (( COMP_POINT += ${#COMP_LINE} ))
- _bash-it-comp "bash-it" "$compl_word" "$prec_word"
- }
-complete -F _alias_completion::bshenc bshenc
-function _alias_completion::bshenp {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='bash-it enable plugin'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(bash-it enable plugin ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/bshenp/bash-it enable plugin}
- (( COMP_POINT += ${#COMP_LINE} ))
- _bash-it-comp "bash-it" "$compl_word" "$prec_word"
- }
-complete -F _alias_completion::bshenp bshenp
-function _alias_completion::bshha {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='bash-it help aliases'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(bash-it help aliases ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/bshha/bash-it help aliases}
- (( COMP_POINT += ${#COMP_LINE} ))
- _bash-it-comp "bash-it" "$compl_word" "$prec_word"
- }
-complete -F _alias_completion::bshha bshha
-function _alias_completion::bshhc {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='bash-it help completions'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(bash-it help completions ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/bshhc/bash-it help completions}
- (( COMP_POINT += ${#COMP_LINE} ))
- _bash-it-comp "bash-it" "$compl_word" "$prec_word"
- }
-complete -F _alias_completion::bshhc bshhc
-function _alias_completion::bshhp {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='bash-it help plugins'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(bash-it help plugins ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/bshhp/bash-it help plugins}
- (( COMP_POINT += ${#COMP_LINE} ))
- _bash-it-comp "bash-it" "$compl_word" "$prec_word"
- }
-complete -F _alias_completion::bshhp bshhp
-function _alias_completion::bshsa {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='bash-it show aliases'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(bash-it show aliases ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/bshsa/bash-it show aliases}
- (( COMP_POINT += ${#COMP_LINE} ))
- _bash-it-comp "bash-it" "$compl_word" "$prec_word"
- }
-complete -F _alias_completion::bshsa bshsa
-function _alias_completion::bshsc {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='bash-it show completions'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(bash-it show completions ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/bshsc/bash-it show completions}
- (( COMP_POINT += ${#COMP_LINE} ))
- _bash-it-comp "bash-it" "$compl_word" "$prec_word"
- }
-complete -F _alias_completion::bshsc bshsc
-function _alias_completion::bshsch {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='bash-it search'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 1 ))
- COMP_WORDS=(bash-it search ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/bshsch/bash-it search}
- (( COMP_POINT += ${#COMP_LINE} ))
- _bash-it-comp "bash-it" "$compl_word" "$prec_word"
- }
-complete -F _alias_completion::bshsch bshsch
-function _alias_completion::bshsp {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='bash-it show plugins'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(bash-it show plugins ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/bshsp/bash-it show plugins}
- (( COMP_POINT += ${#COMP_LINE} ))
- _bash-it-comp "bash-it" "$compl_word" "$prec_word"
- }
-complete -F _alias_completion::bshsp bshsp
-complete -F _minimal c
-function _alias_completion::cd.. {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='cd ..'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 1 ))
- COMP_WORDS=(cd .. ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/cd../cd ..}
- (( COMP_POINT += ${#COMP_LINE} ))
- _cd "cd" "$compl_word" "$prec_word"
- }
-complete -o nospace -F _alias_completion::cd.. cd..
-complete -F _minimal cls
-function _alias_completion::df {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='df -h'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 1 ))
- COMP_WORDS=(df -h ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/df/df -h}
- (( COMP_POINT += ${#COMP_LINE} ))
- _longopt "df" "$compl_word" "$prec_word"
- }
-complete -F _alias_completion::df df
-complete -F _minimal edit
-complete -F _alias_completion::egrep egrep
-complete -F _alias_completion::fgrep fgrep
-complete -F _alias_completion::free free
-complete -o bashdefault -o default -o nospace -F __git_wrap__git_main g
-function _alias_completion::ga {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git add'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 1 ))
- COMP_WORDS=(git add ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/ga/git add}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::ga ga
-function _alias_completion::gall {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git add -A'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(git add -A ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gall/git add -A}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gall gall
-function _alias_completion::gap {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git add -p'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(git add -p ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gap/git add -p}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gap gap
-function _alias_completion::gb {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git branch'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 1 ))
- COMP_WORDS=(git branch ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gb/git branch}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gb gb
-function _alias_completion::gbD {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git branch -D'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(git branch -D ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gbD/git branch -D}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gbD gbD
-function _alias_completion::gba {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git branch -a'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(git branch -a ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gba/git branch -a}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gba gba
-function _alias_completion::gbc {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git for-each-ref --format="%(authorname) %09 %(if)%(HEAD)%(then)*%(else)%(refname:short)%(end) %09 %(creatordate)" refs/remotes/ --sort=authorname DESC'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 9 ))
- COMP_WORDS=(git for-each-ref --format="%(authorname) %09 %(if)%(HEAD)%(then)*%(else)%(refname:short)%(end) %09 %(creatordate)" refs/remotes/ --sort=authorname DESC ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gbc/git for-each-ref --format="%(authorname) %09 %(if)%(HEAD)%(then)*%(else)%(refname:short)%(end) %09 %(creatordate)" refs/remotes/ --sort=authorname DESC}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gbc gbc
-function _alias_completion::gbd {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git branch -d'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(git branch -d ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gbd/git branch -d}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gbd gbd
-function _alias_completion::gbm {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git branch -m'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(git branch -m ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gbm/git branch -m}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gbm gbm
-function _alias_completion::gbt {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git branch --track'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(git branch --track ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gbt/git branch --track}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gbt gbt
-function _alias_completion::gc {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git commit -v'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(git commit -v ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gc/git commit -v}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gc gc
-function _alias_completion::gca {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git commit -v -a'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 3 ))
- COMP_WORDS=(git commit -v -a ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gca/git commit -v -a}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gca gca
-function _alias_completion::gcaa {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git commit -a --amend -C HEAD'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 5 ))
- COMP_WORDS=(git commit -a --amend -C HEAD ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gcaa/git commit -a --amend -C HEAD}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gcaa gcaa
-function _alias_completion::gcam {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git commit -v -am'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 3 ))
- COMP_WORDS=(git commit -v -am ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gcam/git commit -v -am}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gcam gcam
-function _alias_completion::gcamd {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git commit --amend'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(git commit --amend ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gcamd/git commit --amend}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gcamd gcamd
-function _alias_completion::gcb {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git checkout -b'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(git checkout -b ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gcb/git checkout -b}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gcb gcb
-function _alias_completion::gci {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git commit --interactive'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(git commit --interactive ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gci/git commit --interactive}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gci gci
-function _alias_completion::gcl {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git clone'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 1 ))
- COMP_WORDS=(git clone ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gcl/git clone}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gcl gcl
-function _alias_completion::gclean {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git clean -fd'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(git clean -fd ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gclean/git clean -fd}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gclean gclean
-function _alias_completion::gcm {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git commit -v -m'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 3 ))
- COMP_WORDS=(git commit -v -m ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gcm/git commit -v -m}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gcm gcm
-function _alias_completion::gco {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git checkout'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 1 ))
- COMP_WORDS=(git checkout ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gco/git checkout}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gco gco
-function _alias_completion::gcob {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git checkout -b'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(git checkout -b ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gcob/git checkout -b}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gcob gcob
-function _alias_completion::gcobu {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git checkout -b ${USER}/'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 3 ))
- COMP_WORDS=(git checkout -b ${USER}/ ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gcobu/git checkout -b ${USER}/}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gcobu gcobu
-function _alias_completion::gcom {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git checkout master'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(git checkout master ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gcom/git checkout master}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gcom gcom
-function _alias_completion::gcount {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git shortlog -sn'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(git shortlog -sn ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gcount/git shortlog -sn}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gcount gcount
-function _alias_completion::gcp {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git cherry-pick'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 1 ))
- COMP_WORDS=(git cherry-pick ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gcp/git cherry-pick}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gcp gcp
-function _alias_completion::gcpx {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git cherry-pick -x'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(git cherry-pick -x ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gcpx/git cherry-pick -x}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gcpx gcpx
-function _alias_completion::gcsam {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git commit -S -am'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 3 ))
- COMP_WORDS=(git commit -S -am ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gcsam/git commit -S -am}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gcsam gcsam
-function _alias_completion::gct {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git checkout --track'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(git checkout --track ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gct/git checkout --track}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gct gct
-function _alias_completion::gd {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git diff'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 1 ))
- COMP_WORDS=(git diff ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gd/git diff}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gd gd
-function _alias_completion::gdel {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git branch -D'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(git branch -D ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gdel/git branch -D}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gdel gdel
-function _alias_completion::gds {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git diff --staged'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(git diff --staged ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gds/git diff --staged}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gds gds
-function _alias_completion::gdt {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git difftool'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 1 ))
- COMP_WORDS=(git difftool ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gdt/git difftool}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gdt gdt
-complete -o bashdefault -o default -o nospace -F __git_wrap__git_main get
-function _alias_completion::gexport {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git archive --format zip --output'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 4 ))
- COMP_WORDS=(git archive --format zip --output ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gexport/git archive --format zip --output}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gexport gexport
-function _alias_completion::gf {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git fetch --all --prune'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 3 ))
- COMP_WORDS=(git fetch --all --prune ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gf/git fetch --all --prune}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gf gf
-function _alias_completion::gft {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git fetch --all --prune --tags'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 4 ))
- COMP_WORDS=(git fetch --all --prune --tags ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gft/git fetch --all --prune --tags}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gft gft
-function _alias_completion::gftv {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git fetch --all --prune --tags --verbose'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 5 ))
- COMP_WORDS=(git fetch --all --prune --tags --verbose ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gftv/git fetch --all --prune --tags --verbose}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gftv gftv
-function _alias_completion::gfv {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git fetch --all --prune --verbose'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 4 ))
- COMP_WORDS=(git fetch --all --prune --verbose ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gfv/git fetch --all --prune --verbose}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gfv gfv
-function _alias_completion::ggs {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='gg --stat'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 1 ))
- COMP_WORDS=(gg --stat ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/ggs/gg --stat}
- (( COMP_POINT += ${#COMP_LINE} ))
- _minimal "gg" "$compl_word" "$prec_word"
- }
-complete -F _alias_completion::ggs ggs
-function _alias_completion::ggui {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git gui'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 1 ))
- COMP_WORDS=(git gui ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/ggui/git gui}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::ggui ggui
-function _alias_completion::ghm {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='cd "$(git rev-parse --show-toplevel)"'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 3 ))
- COMP_WORDS=(cd "$(git rev-parse --show-toplevel)" ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/ghm/cd "$(git rev-parse --show-toplevel)"}
- (( COMP_POINT += ${#COMP_LINE} ))
- _cd "cd" "$compl_word" "$prec_word"
- }
-complete -o nospace -F _alias_completion::ghm ghm
-function _alias_completion::gl {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git pull'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 1 ))
- COMP_WORDS=(git pull ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gl/git pull}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gl gl
-function _alias_completion::gll {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git log --graph --pretty=oneline --abbrev-commit'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 4 ))
- COMP_WORDS=(git log --graph --pretty=oneline --abbrev-commit ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gll/git log --graph --pretty=oneline --abbrev-commit}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gll gll
-function _alias_completion::glsum {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git diff --name-only --diff-filter=U'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 3 ))
- COMP_WORDS=(git diff --name-only --diff-filter=U ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/glsum/git diff --name-only --diff-filter=U}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::glsum glsum
-complete -o bashdefault -o default -o nospace -F _alias_completion::gu glsut
-function _alias_completion::glum {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git pull upstream master'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 3 ))
- COMP_WORDS=(git pull upstream master ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/glum/git pull upstream master}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::glum glum
-function _alias_completion::gm {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git merge'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 1 ))
- COMP_WORDS=(git merge ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gm/git merge}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gm gm
-function _alias_completion::gmv {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git mv'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 1 ))
- COMP_WORDS=(git mv ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gmv/git mv}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gmv gmv
-function _alias_completion::gnew {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git log HEAD@{1}..HEAD@{0}'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(git log HEAD@{1}..HEAD@{0} ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gnew/git log HEAD@{1}..HEAD@{0}}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gnew gnew
-function _alias_completion::gp {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git push'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 1 ))
- COMP_WORDS=(git push ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gp/git push}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gp gp
-function _alias_completion::gpatch {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git format-patch -1'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(git format-patch -1 ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gpatch/git format-patch -1}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gpatch gpatch
-function _alias_completion::gpd {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git push --delete'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(git push --delete ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gpd/git push --delete}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gpd gpd
-function _alias_completion::gpf {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git push --force'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(git push --force ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gpf/git push --force}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gpf gpf
-function _alias_completion::gpg-recv-keys {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 3 ))
- COMP_WORDS=(gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gpg-recv-keys/gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys}
- (( COMP_POINT += ${#COMP_LINE} ))
- _gpg "gpg" "$compl_word" "$prec_word"
- }
-complete -o default -F _alias_completion::gpg-recv-keys gpg-recv-keys
-function _alias_completion::gpl {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git pull'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 1 ))
- COMP_WORDS=(git pull ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gpl/git pull}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gpl gpl
-function _alias_completion::gpo {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git push origin HEAD'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 3 ))
- COMP_WORDS=(git push origin HEAD ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gpo/git push origin HEAD}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gpo gpo
-function _alias_completion::gpom {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git push origin master'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 3 ))
- COMP_WORDS=(git push origin master ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gpom/git push origin master}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gpom gpom
-function _alias_completion::gpr {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git pull --rebase'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(git pull --rebase ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gpr/git pull --rebase}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gpr gpr
-function _alias_completion::gpu {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git push --set-upstream'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(git push --set-upstream ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gpu/git push --set-upstream}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gpu gpu
-function _alias_completion::gpunch {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git push --force-with-lease'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(git push --force-with-lease ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gpunch/git push --force-with-lease}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gpunch gpunch
-function _alias_completion::gpuo {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git push --set-upstream origin'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 3 ))
- COMP_WORDS=(git push --set-upstream origin ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gpuo/git push --set-upstream origin}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gpuo gpuo
-function _alias_completion::gr {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git remote'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 1 ))
- COMP_WORDS=(git remote ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gr/git remote}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gr gr
-function _alias_completion::gra {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git remote add'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(git remote add ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gra/git remote add}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gra gra
-function _alias_completion::grb {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git rebase'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 1 ))
- COMP_WORDS=(git rebase ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/grb/git rebase}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::grb grb
-function _alias_completion::grbc {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git rebase --continue'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(git rebase --continue ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/grbc/git rebase --continue}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::grbc grbc
-function _alias_completion::grep {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='grep --colour=auto'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 1 ))
- COMP_WORDS=(grep --colour=auto ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/grep/grep --colour=auto}
- (( COMP_POINT += ${#COMP_LINE} ))
- _longopt "grep" "$compl_word" "$prec_word"
- }
-complete -F _alias_completion::grep grep
-function _alias_completion::grm {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git rebase master'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(git rebase master ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/grm/git rebase master}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::grm grm
-function _alias_completion::grmi {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git rebase master -i'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 3 ))
- COMP_WORDS=(git rebase master -i ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/grmi/git rebase master -i}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::grmi grmi
-function _alias_completion::grv {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git remote -v'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(git remote -v ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/grv/git remote -v}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::grv grv
-function _alias_completion::gs {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git status'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 1 ))
- COMP_WORDS=(git status ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gs/git status}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gs gs
-function _alias_completion::gsd {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git svn dcommit'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(git svn dcommit ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gsd/git svn dcommit}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gsd gsd
-function _alias_completion::gsh {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git show'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 1 ))
- COMP_WORDS=(git show ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gsh/git show}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gsh gsh
-function _alias_completion::gsl {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git shortlog -sn'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(git shortlog -sn ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gsl/git shortlog -sn}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gsl gsl
-function _alias_completion::gsr {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git svn rebase'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(git svn rebase ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gsr/git svn rebase}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gsr gsr
-function _alias_completion::gss {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git status -s'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(git status -s ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gss/git status -s}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gss gss
-function _alias_completion::gst {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git stash'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 1 ))
- COMP_WORDS=(git stash ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gst/git stash}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gst gst
-function _alias_completion::gstb {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git stash branch'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(git stash branch ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gstb/git stash branch}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gstb gstb
-function _alias_completion::gstd {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git stash drop'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(git stash drop ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gstd/git stash drop}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gstd gstd
-function _alias_completion::gstl {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git stash list'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(git stash list ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gstl/git stash list}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gstl gstl
-function _alias_completion::gstp {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git stash pop'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(git stash pop ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gstp/git stash pop}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gstp gstp
-function _alias_completion::gstpo {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git stash pop'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(git stash pop ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gstpo/git stash pop}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gstpo gstpo
-function _alias_completion::gstpu {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git stash push'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(git stash push ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gstpu/git stash push}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gstpu gstpu
-function _alias_completion::gstpum {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git stash push -m'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 3 ))
- COMP_WORDS=(git stash push -m ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gstpum/git stash push -m}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gstpum gstpum
-function _alias_completion::gsts {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git stash push'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(git stash push ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gsts/git stash push}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gsts gsts
-function _alias_completion::gstsm {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git stash push -m'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 3 ))
- COMP_WORDS=(git stash push -m ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gstsm/git stash push -m}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gstsm gstsm
-function _alias_completion::gsu {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git submodule update --init --recursive'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 4 ))
- COMP_WORDS=(git submodule update --init --recursive ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gsu/git submodule update --init --recursive}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gsu gsu
-function _alias_completion::gsw {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git switch'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 1 ))
- COMP_WORDS=(git switch ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gsw/git switch}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gsw gsw
-function _alias_completion::gswc {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git switch --create'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(git switch --create ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gswc/git switch --create}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gswc gswc
-function _alias_completion::gswm {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git switch master'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(git switch master ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gswm/git switch master}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gswm gswm
-function _alias_completion::gswt {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git switch --track'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(git switch --track ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gswt/git switch --track}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gswt gswt
-function _alias_completion::gt {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git tag'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 1 ))
- COMP_WORDS=(git tag ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gt/git tag}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gt gt
-function _alias_completion::gta {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git tag -a'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(git tag -a ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gta/git tag -a}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gta gta
-function _alias_completion::gtd {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git tag -d'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(git tag -d ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gtd/git tag -d}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gtd gtd
-function _alias_completion::gtl {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git tag -l'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(git tag -l ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gtl/git tag -l}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gtl gtl
-function _alias_completion::gu {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git ls-files . --exclude-standard --others'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 4 ))
- COMP_WORDS=(git ls-files . --exclude-standard --others ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gu/git ls-files . --exclude-standard --others}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gu gu
-function _alias_completion::gus {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git reset HEAD'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(git reset HEAD ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gus/git reset HEAD}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gus gus
-function _alias_completion::gwc {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='git whatchanged'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 1 ))
- COMP_WORDS=(git whatchanged ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/gwc/git whatchanged}
- (( COMP_POINT += ${#COMP_LINE} ))
- __git_wrap__git_main "git" "$compl_word" "$prec_word"
- }
-complete -o bashdefault -o default -o nospace -F _alias_completion::gwc gwc
-complete -F _minimal h
-complete -F _hstr hh
-complete -F _minimal ipy
-complete -F _minimal irc
-complete -F _minimal k
-function _alias_completion::l {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='ls -a'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 1 ))
- COMP_WORDS=(ls -a ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/l/ls -a}
- (( COMP_POINT += ${#COMP_LINE} ))
- _longopt "ls" "$compl_word" "$prec_word"
- }
-complete -F _alias_completion::l l
-function _alias_completion::l1 {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='ls -1'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 1 ))
- COMP_WORDS=(ls -1 ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/l1/ls -1}
- (( COMP_POINT += ${#COMP_LINE} ))
- _longopt "ls" "$compl_word" "$prec_word"
- }
-complete -F _alias_completion::l1 l1
-function _alias_completion::la {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='ls -AF'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 1 ))
- COMP_WORDS=(ls -AF ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/la/ls -AF}
- (( COMP_POINT += ${#COMP_LINE} ))
- _longopt "ls" "$compl_word" "$prec_word"
- }
-complete -F _alias_completion::la la
-function _alias_completion::ll {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='ls -al'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 1 ))
- COMP_WORDS=(ls -al ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/ll/ls -al}
- (( COMP_POINT += ${#COMP_LINE} ))
- _longopt "ls" "$compl_word" "$prec_word"
- }
-complete -F _alias_completion::ll ll
-function _alias_completion::ls {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='ls --color=auto'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 1 ))
- COMP_WORDS=(ls --color=auto ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/ls/ls --color=auto}
- (( COMP_POINT += ${#COMP_LINE} ))
- _longopt "ls" "$compl_word" "$prec_word"
- }
-complete -F _alias_completion::ls ls
-function _alias_completion::md {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='mkdir -p'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 1 ))
- COMP_WORDS=(mkdir -p ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/md/mkdir -p}
- (( COMP_POINT += ${#COMP_LINE} ))
- _longopt "mkdir" "$compl_word" "$prec_word"
- }
-complete -F _alias_completion::md md
-complete -F _longopt more
-function _alias_completion::np {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='nano -w PKGBUILD'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(nano -w PKGBUILD ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/np/nano -w PKGBUILD}
- (( COMP_POINT += ${#COMP_LINE} ))
- _minimal "nano" "$compl_word" "$prec_word"
- }
-complete -F _alias_completion::np np
-complete -F _minimal pass
-function _alias_completion::pbcopy {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='xclip -selection clipboard'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(xclip -selection clipboard ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/pbcopy/xclip -selection clipboard}
- (( COMP_POINT += ${#COMP_LINE} ))
- _minimal "xclip" "$compl_word" "$prec_word"
- }
-complete -F _alias_completion::pbcopy pbcopy
-function _alias_completion::pbpaste {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='xclip -selection clipboard -o'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 3 ))
- COMP_WORDS=(xclip -selection clipboard -o ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/pbpaste/xclip -selection clipboard -o}
- (( COMP_POINT += ${#COMP_LINE} ))
- _minimal "xclip" "$compl_word" "$prec_word"
- }
-complete -F _alias_completion::pbpaste pbpaste
-function _alias_completion::peview {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='wine /usr/bin/PEview.exe'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 1 ))
- COMP_WORDS=(wine /usr/bin/PEview.exe ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/peview/wine /usr/bin/PEview.exe}
- (( COMP_POINT += ${#COMP_LINE} ))
- _wine "wine" "$compl_word" "$prec_word"
- }
-complete -F _alias_completion::peview peview
-complete -F _minimal piano
-complete -o default -F _python_django_completion py
-complete -F _minimal q
-complete -F _minimal rb
-complete -F _longopt rd
-function _alias_completion::reload_aliases {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='source ${BASH_IT}/scripts/reloader.bash alias aliases'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 3 ))
- COMP_WORDS=(source ${BASH_IT}/scripts/reloader.bash alias aliases ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/reload_aliases/source ${BASH_IT}/scripts/reloader.bash alias aliases}
- (( COMP_POINT += ${#COMP_LINE} ))
- _minimal "source" "$compl_word" "$prec_word"
- }
-complete -F _alias_completion::reload_aliases reload_aliases
-function _alias_completion::reload_completion {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='source ${BASH_IT}/scripts/reloader.bash completion completion'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 3 ))
- COMP_WORDS=(source ${BASH_IT}/scripts/reloader.bash completion completion ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/reload_completion/source ${BASH_IT}/scripts/reloader.bash completion completion}
- (( COMP_POINT += ${#COMP_LINE} ))
- _minimal "source" "$compl_word" "$prec_word"
- }
-complete -F _alias_completion::reload_completion reload_completion
-function _alias_completion::reload_plugins {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='source ${BASH_IT}/scripts/reloader.bash plugin plugins'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 3 ))
- COMP_WORDS=(source ${BASH_IT}/scripts/reloader.bash plugin plugins ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/reload_plugins/source ${BASH_IT}/scripts/reloader.bash plugin plugins}
- (( COMP_POINT += ${#COMP_LINE} ))
- _minimal "source" "$compl_word" "$prec_word"
- }
-complete -F _alias_completion::reload_plugins reload_plugins
-function _alias_completion::reset {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='clear; reset'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 1 ))
- COMP_WORDS=(clear; reset ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/reset/clear; reset}
- (( COMP_POINT += ${#COMP_LINE} ))
- "clear;" "$compl_word" "$prec_word"
- }
-complete -F _bash-it-comp shit
-complete -F _longopt sl
-function _alias_completion::snano {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='sudo nano'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 1 ))
- COMP_WORDS=(sudo nano ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/snano/sudo nano}
- (( COMP_POINT += ${#COMP_LINE} ))
- complete "sudo" "$compl_word" "$prec_word"
- }
-complete -c -f snano
-function _alias_completion::svim {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='sudo vim'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 1 ))
- COMP_WORDS=(sudo vim ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/svim/sudo vim}
- (( COMP_POINT += ${#COMP_LINE} ))
- complete "sudo" "$compl_word" "$prec_word"
- }
-complete -c -f svim
-function _alias_completion::vbpf {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='vim ~/.bash_profile'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 1 ))
- COMP_WORDS=(vim ~/.bash_profile ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/vbpf/vim ~/.bash_profile}
- (( COMP_POINT += ${#COMP_LINE} ))
- _filedir_xspec "vim" "$compl_word" "$prec_word"
- }
-complete -F _alias_completion::vbpf vbpf
-function _alias_completion::vbrc {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='vim ~/.bashrc'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 1 ))
- COMP_WORDS=(vim ~/.bashrc ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/vbrc/vim ~/.bashrc}
- (( COMP_POINT += ${#COMP_LINE} ))
- _filedir_xspec "vim" "$compl_word" "$prec_word"
- }
-complete -F _alias_completion::vbrc vbrc
-function _alias_completion::wpscan {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='wpscan --api-token iprb3kkWZ33Xv6c5saxhmaPQ00L4lKcsXg0HGwWk24E'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(wpscan --api-token iprb3kkWZ33Xv6c5saxhmaPQ00L4lKcsXg0HGwWk24E ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/wpscan/wpscan --api-token iprb3kkWZ33Xv6c5saxhmaPQ00L4lKcsXg0HGwWk24E}
- (( COMP_POINT += ${#COMP_LINE} ))
- _minimal "wpscan" "$compl_word" "$prec_word"
- }
-complete -F _alias_completion::wpscan wpscan
-function _alias_completion::xcpy {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='xclip -selection clipboard'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 2 ))
- COMP_WORDS=(xclip -selection clipboard ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/xcpy/xclip -selection clipboard}
- (( COMP_POINT += ${#COMP_LINE} ))
- _minimal "xclip" "$compl_word" "$prec_word"
- }
-complete -F _alias_completion::xcpy xcpy
-function _alias_completion::xpst {
- local compl_word=$2
- local prec_word=$3
- # check if prec_word is the alias itself. if so, replace it
- # with the last word in the unaliased form, i.e.,
- # alias_cmd + ' ' + alias_args.
- if [[ $COMP_LINE == "$prec_word $compl_word" ]]; then
- prec_word='xclip -selection clipboard -o'
- prec_word=${prec_word#* }
- fi
- (( COMP_CWORD += 3 ))
- COMP_WORDS=(xclip -selection clipboard -o ${COMP_WORDS[@]:1})
- (( COMP_POINT -= ${#COMP_LINE} ))
- COMP_LINE=${COMP_LINE/xpst/xclip -selection clipboard -o}
- (( COMP_POINT += ${#COMP_LINE} ))
- _minimal "xclip" "$compl_word" "$prec_word"
- }
-complete -F _alias_completion::xpst xpst
-complete -F _minimal xt
+# shellcheck shell=bash
+# Load after the other completions to understand what needs to be completed
+# BASH_IT_LOAD_PRIORITY: 365
+
+cite about-plugin
+about-plugin 'Automatic completion of aliases'
+
+# References:
+# http://superuser.com/a/437508/119764
+# http://stackoverflow.com/a/1793178/1228454
+
+# This needs to be a plugin so it gets executed after the completions and the aliases have been defined.
+# Bash-it loads its components in the order
+# 1) Aliases
+# 2) Completions
+# 3) Plugins
+# 4) Custom scripts
+
+# Automatically add completion for all aliases to commands having completion functions
+function alias_completion {
+ local namespace="alias_completion"
+
+ # parse function based completion definitions, where capture group 2 => function and 3 => trigger
+ local compl_regex='complete( +[^ ]+)* -F ([^ ]+) ("[^"]+"|[^ ]+)'
+ # parse alias definitions, where capture group 1 => trigger, 2 => command, 3 => command arguments
+ local alias_regex="alias( -- | )([^=]+)='(\"[^\"]+\"|[^ ]+)(( +[^ ]+)*)'"
+
+ # create array of function completion triggers, keeping multi-word triggers together
+ eval "local completions=($(complete -p | sed -Ene "/$compl_regex/s//'\3'/p"))"
+ ((${#completions[@]} == 0)) && return 0
+
+ # create temporary file for wrapper functions and completions
+ local tmp_file
+ tmp_file="$(mktemp -t "${namespace}-${RANDOM}XXXXXX")" || return 1
+
+ local completion_loader
+ completion_loader="$(complete -p -D 2> /dev/null | sed -Ene 's/.* -F ([^ ]*).*/\1/p')"
+
+ # read in "<alias> '<aliased command>' '<command args>'" lines from defined aliases
+ local line
+
+ # shellcheck disable=SC2162
+ # some aliases do have backslashes that needs to be interpreted
+ while read line; do
+ eval "local alias_tokens; alias_tokens=($line)" 2> /dev/null || continue # some alias arg patterns cause an eval parse error
+ local alias_name="${alias_tokens[0]}" alias_cmd="${alias_tokens[1]}" alias_args="${alias_tokens[2]# }"
+
+ # skip aliases to pipes, boolean control structures and other command lists
+ # (leveraging that eval errs out if $alias_args contains unquoted shell metacharacters)
+ eval "local alias_arg_words; alias_arg_words=($alias_args)" 2> /dev/null || continue
+ # avoid expanding wildcards
+ read -ra alias_arg_words <<< "$alias_args"
+
+ # skip alias if there is no completion function triggered by the aliased command
+ if [[ ! " ${completions[*]} " =~ $alias_cmd ]]; then
+ if [[ -n "$completion_loader" ]]; then
+ # force loading of completions for the aliased command
+ eval "$completion_loader $alias_cmd"
+ # 124 means completion loader was successful
+ [[ $? -eq 124 ]] || continue
+ completions+=("$alias_cmd")
+ else
+ continue
+ fi
+ fi
+ local new_completion="$(complete -p "$alias_cmd" 2> /dev/null)"
+
+ # create a wrapper inserting the alias arguments if any
+ if [[ -n $alias_args ]]; then
+ local compl_func="${new_completion/#* -F /}"
+ compl_func="${compl_func%% *}"
+ # avoid recursive call loops by ignoring our own functions
+ if [[ "${compl_func#_$namespace::}" == "$compl_func" ]]; then
+ local compl_wrapper="_${namespace}::${alias_name}"
+ echo "function $compl_wrapper {
+ local compl_word=\$2
+ local prec_word=\$3
+ # check if prec_word is the alias itself. if so, replace it
+ # with the last word in the unaliased form, i.e.,
+ # alias_cmd + ' ' + alias_args.
+ if [[ \$COMP_LINE == \"\$prec_word \$compl_word\" ]]; then
+ prec_word='$alias_cmd $alias_args'
+ prec_word=\${prec_word#* }
+ fi
+ (( COMP_CWORD += ${#alias_arg_words[@]} ))
+ COMP_WORDS=($alias_cmd $alias_args \${COMP_WORDS[@]:1})
+ (( COMP_POINT -= \${#COMP_LINE} ))
+ COMP_LINE=\${COMP_LINE/$alias_name/$alias_cmd $alias_args}
+ (( COMP_POINT += \${#COMP_LINE} ))
+ $compl_func \"$alias_cmd\" \"\$compl_word\" \"\$prec_word\"
+ }" >> "$tmp_file"
+ new_completion="${new_completion/ -F $compl_func / -F $compl_wrapper }"
+ fi
+ fi
+
+ # replace completion trigger by alias
+ if [[ -n $new_completion ]]; then
+ new_completion="${new_completion% *} $alias_name"
+ echo "$new_completion" >> "$tmp_file"
+ fi
+ done < <(alias -p | sed -Ene "s/$alias_regex/\2 '\3' '\4'/p")
+ # shellcheck source=/dev/null
+ source "$tmp_file" && command rm -f "$tmp_file"
+}
+
+alias_completion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment