Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Ohmyzsh
Commits
18ef1ee6
Commit
18ef1ee6
authored
Aug 25, 2015
by
Dawid Ferenczy
Browse files
Merge remote-tracking branch 'robbyrussell/master'
parents
eafd5f32
192de6bc
Changes
234
Show whitespace changes
Inline
Side-by-side
plugins/frontend-search/README.md
0 → 100644
View file @
18ef1ee6
## Rationale ##
> Searches for your Frontend contents more easier
## Instalation ##
Open your
`.zshrc`
file and load
`frontend-search`
plugin
```
bash
...
plugins
=(
<your-plugins-list>... frontend-search
)
...
```
## Commands ##
All command searches are accept only in format
*
`frontend <search-content> <search-term>`
The search content are
*
`jquery <api.jquery.com>`
*
`mdn <developer.mozilla.org>`
*
`compass <compass-style.org>`
*
`html5please <html5please.com>`
*
`caniuse <caniuse.com>`
*
`aurajs <aurajs.com>`
*
`dartlang <api.dartlang.org/apidocs/channels/stable/dartdoc-viewer>`
*
`lodash <search>`
*
`qunit <api.qunitjs.com>`
*
`fontello <fontello.com>`
*
`bootsnipp <bootsnipp.com>`
*
`cssflow <cssflow.com>`
*
`codepen <codepen.io>`
*
`unheap <www.unheap.com>`
*
`bem <google.com/search?as_q=<search-term>&as_sitesearch=bem.info>`
*
`smacss <google.com/search?as_q=<search-term>&as_sitesearch=smacss.com>`
*
`angularjs <google.com/search?as_q=<search-term>&as_sitesearch=angularjs.org>`
*
`reactjs <google.com/search?as_q=<search-term>&as_sitesearch=facebook.github.io/react>`
*
`emberjs <emberjs.com>`
*
`stackoverflow <stackoverflow.com>`
## Aliases ##
There are a few aliases presented as well:
*
`jquery`
A shorthand for
`frontend jquery`
*
`mdn`
A shorthand for
`frontend mdn`
*
`compass`
A shorthand for
`frontend compass`
*
`html5please`
A shorthand for
`frontend html5please`
*
`caniuse`
A shorthand for
`frontend caniuse`
*
`aurajs`
A shorthand for
`frontend aurajs`
*
`dartlang`
A shorthand for
`frontend dartlang`
*
`lodash`
A shorthand for
`frontend lodash`
*
`qunit`
A shorthand for
`frontend qunit`
*
`fontello`
A shorthand for
`frontend fontello`
*
`bootsnipp`
A shorthand for
`frontend bootsnipp`
*
`cssflow`
A shorthand for
`frontend cssflow`
*
`codepen`
A shorthand for
`frontend codepen`
*
`unheap`
A shorthand for
`frontend unheap`
*
`bem`
A shorthand for
`frontend bem`
*
`smacss`
A shorthand for
`frontend smacss`
*
`angularjs`
A shorthand for
`frontend angularjs`
*
`reactjs`
A shorthand for
`frontend reactjs`
*
`emberjs`
A shorthand for
`frontend emberjs`
*
`stackoverflow`
A shorthand for
`frontend stackoverflow`
## Author
**Wilson Mendes (willmendesneto)**
+
<https://plus.google.com/+WilsonMendes>
+
<https://twitter.com/willmendesneto>
+
<http://github.com/willmendesneto>
New features comming soon.
plugins/frontend-search/_frontend-search.sh
0 → 100644
View file @
18ef1ee6
#compdef frontend
zstyle
':completion:*:descriptions'
format
'%B%d%b'
zstyle
':completion::complete:frontend:*:commands'
group-name commands
zstyle
':completion::complete:frontend:*:frontend_points'
group-name frontend_points
zstyle
':completion::complete:frontend::'
list-grouped
zmodload zsh/mapfile
function
_frontend
()
{
local
CONFIG
=
$HOME
/.frontend-search
local
ret
=
1
local
-a
commands
local
-a
frontend_points
frontend_points
=(
"
${
(f)mapfile[
$CONFIG
]//
$HOME
/~
}
"
)
commands
=(
'jquery: Search in jQuery website'
'mdn: Search in MDN website'
'compass: Search in COMPASS website'
'html5please: Search in HTML5 Please website'
'caniuse: Search in Can I Use website'
'aurajs: Search in AuraJs website'
'dartlang: Search in Dart website'
'lodash: Search in Lo-Dash website'
'qunit: Search in Qunit website'
'fontello: Search in fontello website'
'bootsnipp: Search in bootsnipp website'
'cssflow: Search in cssflow website'
'codepen: Search in codepen website'
'unheap: Search in unheap website'
'bem: Search in BEM website'
'smacss: Search in SMACSS website'
'angularjs: Search in Angular website'
'reactjs: Search in React website'
'emberjs: Search in Ember website'
'stackoverflow: Search in StackOverflow website'
)
_arguments
-C
\
'1: :->first_arg'
\
'2: :->second_arg'
&&
ret
=
0
case
$state
in
first_arg
)
_describe
-t
frontend_points
"Warp points"
frontend_points
&&
ret
=
0
_describe
-t
commands
"Commands"
commands
&&
ret
=
0
;;
second_arg
)
case
$words
[
2]
in
jquery
)
_describe
-t
points
"Warp points"
frontend_points
&&
ret
=
0
;;
mdn
)
_describe
-t
points
"Warp points"
frontend_points
&&
ret
=
0
;;
compass
)
_describe
-t
points
"Warp points"
frontend_points
&&
ret
=
0
;;
html5please
)
_describe
-t
points
"Warp points"
frontend_points
&&
ret
=
0
;;
caniuse
)
_describe
-t
points
"Warp points"
frontend_points
&&
ret
=
0
;;
aurajs
)
_describe
-t
points
"Warp points"
frontend_points
&&
ret
=
0
;;
dartlang
)
_describe
-t
points
"Warp points"
frontend_points
&&
ret
=
0
;;
lodash
)
_describe
-t
points
"Warp points"
frontend_points
&&
ret
=
0
;;
qunit
)
_describe
-t
points
"Warp points"
frontend_points
&&
ret
=
0
;;
fontello
)
_describe
-t
points
"Warp points"
frontend_points
&&
ret
=
0
;;
bootsnipp
)
_describe
-t
points
"Warp points"
frontend_points
&&
ret
=
0
;;
cssflow
)
_describe
-t
points
"Warp points"
frontend_points
&&
ret
=
0
;;
codepen
)
_describe
-t
points
"Warp points"
frontend_points
&&
ret
=
0
;;
unheap
)
_describe
-t
points
"Warp points"
frontend_points
&&
ret
=
0
;;
bem
)
_describe
-t
points
"Warp points"
frontend_points
&&
ret
=
0
;;
smacss
)
_describe
-t
points
"Warp points"
frontend_points
&&
ret
=
0
;;
angularjs
)
_describe
-t
points
"Warp points"
frontend_points
&&
ret
=
0
;;
reactjs
)
_describe
-t
points
"Warp points"
frontend_points
&&
ret
=
0
;;
emberjs
)
_describe
-t
points
"Warp points"
frontend_points
&&
ret
=
0
;;
stackoverflow
)
_describe
-t
points
"Warp points"
frontend_points
&&
ret
=
0
;;
esac
;;
esac
return
$ret
}
_frontend
"
$@
"
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et
plugins/frontend-search/frontend-search.plugin.zsh
0 → 100644
View file @
18ef1ee6
# frontend from terminal
function
frontend
()
{
# no keyword provided, simply show how call methods
if
[[
$#
-le
1
]]
;
then
echo
"Please provide a search-content and a search-term for app.
\n
Ex:
\n
frontend <search-content> <search-term>
\n
"
return
1
fi
# check whether the search engine is supported
if
[[
!
$1
=
~
'(jquery|mdn|compass|html5please|caniuse|aurajs|dartlang|qunit|fontello|bootsnipp|cssflow|codepen|unheap|bem|smacss|angularjs|reactjs|emberjs|stackoverflow)'
]]
;
then
echo
"Search valid search content
$1
not supported."
echo
"Valid contents: (formats 'frontend <search-content>' or '<search-content>')"
echo
"* jquery"
echo
"* mdn"
echo
"* compass"
echo
"* html5please"
echo
"* caniuse"
echo
"* aurajs"
echo
"* dartlang"
echo
"* lodash"
echo
"* qunit"
echo
"* fontello"
echo
"* bootsnipp"
echo
"* cssflow"
echo
"* codepen"
echo
"* unheap"
echo
"* bem"
echo
"* smacss"
echo
"* angularjs"
echo
"* reactjs"
echo
"* emberjs"
echo
"* stackoverflow"
echo
""
return
1
fi
local
url
=
"http://"
local
query
=
""
case
"
$1
"
in
"jquery"
)
url
=
"
${
url
}
api.jquery.com"
url
=
"
${
url
}
/?s=
$2
"
;;
"mdn"
)
url
=
"
${
url
}
developer.mozilla.org"
url
=
"
${
url
}
/search?q=
$2
"
;;
"compass"
)
url
=
"
${
url
}
compass-style.org"
url
=
"
${
url
}
/search?q=
$2
"
;;
"html5please"
)
url
=
"
${
url
}
html5please.com"
url
=
"
${
url
}
/#
$2
"
;;
"caniuse"
)
url
=
"
${
url
}
caniuse.com"
url
=
"
${
url
}
/#search=
$2
"
;;
"aurajs"
)
url
=
"
${
url
}
aurajs.com"
url
=
"
${
url
}
/api/#stq=
$2
"
;;
"dartlang"
)
url
=
"
${
url
}
api.dartlang.org/apidocs/channels/stable/dartdoc-viewer"
url
=
"
${
url
}
/dart-
$2
"
;;
"qunit"
)
url
=
"
${
url
}
api.qunitjs.com"
url
=
"
${
url
}
/?s=
$2
"
;;
"fontello"
)
url
=
"
${
url
}
fontello.com"
url
=
"
${
url
}
/#search=
$2
"
;;
"bootsnipp"
)
url
=
"
${
url
}
bootsnipp.com"
url
=
"
${
url
}
/search?q=
$2
"
;;
"cssflow"
)
url
=
"
${
url
}
cssflow.com"
url
=
"
${
url
}
/search?q=
$2
"
;;
"codepen"
)
url
=
"
${
url
}
codepen.io"
url
=
"
${
url
}
/search?q=
$2
"
;;
"unheap"
)
url
=
"
${
url
}
www.unheap.com"
url
=
"
${
url
}
/?s=
$2
"
;;
"bem"
)
url
=
"
${
url
}
google.com"
url
=
"
${
url
}
/search?as_q=
$2
&as_sitesearch=bem.info"
;;
"smacss"
)
url
=
"
${
url
}
google.com"
url
=
"
${
url
}
/search?as_q=
$2
&as_sitesearch=smacss.com"
;;
"angularjs"
)
url
=
"
${
url
}
google.com"
url
=
"
${
url
}
/search?as_q=
$2
&as_sitesearch=angularjs.org"
;;
"reactjs"
)
url
=
"
${
url
}
google.com"
url
=
"
${
url
}
/search?as_q=
$2
&as_sitesearch=facebook.github.io/react"
;;
"emberjs"
)
url
=
"
${
url
}
emberjs.com"
url
=
"
${
url
}
/api/#stq=
$2
&stp=1"
;;
"stackoverflow"
)
url
=
"
${
url
}
stackoverflow.com"
url
=
"
${
url
}
/search?q=
$2
"
;;
*
)
echo
"INVALID PARAM!"
return
;;
esac
echo
"
$url
"
open_command
"
$url
"
}
# javascript
alias
jquery
=
'frontend jquery'
alias
mdn
=
'frontend mdn'
# pre processors frameworks
alias
compassdoc
=
'frontend compass'
# important links
alias
html5please
=
'frontend html5please'
alias
caniuse
=
'frontend caniuse'
# components and libraries
alias
aurajs
=
'frontend aurajs'
alias
dartlang
=
'frontend dartlang'
alias
lodash
=
'frontend lodash'
#tests
alias
qunit
=
'frontend qunit'
#fonts
alias
fontello
=
'frontend fontello'
# snippets
alias
bootsnipp
=
'frontend bootsnipp'
alias
cssflow
=
'frontend cssflow'
alias
codepen
=
'frontend codepen'
alias
unheap
=
'frontend unheap'
# css architecture
alias
bem
=
'frontend bem'
alias
smacss
=
'frontend smacss'
# frameworks
alias
angularjs
=
'frontend angularjs'
alias
reactjs
=
'frontend reactjs'
alias
emberjs
=
'frontend emberjs'
# search websites
alias
stackoverflow
=
'frontend stackoverflow'
plugins/gem/_gem
View file @
18ef1ee6
...
...
@@ -59,6 +59,8 @@ case "$words[1]" in
build)
_files -g "*.gemspec"
;;
install)
_files ;;
list)
if [[ "$state" == forms ]]; then
_gem_installed
...
...
plugins/git-flow/git-flow.plugin.zsh
View file @
18ef1ee6
...
...
@@ -5,7 +5,7 @@
#
# To achieve git-flow completion nirvana:
#
# 0. Update your zsh's git-completion module to the newest verion.
# 0. Update your zsh's git-completion module to the newest ver
s
ion.
# From here. http://zsh.git.sourceforge.net/git/gitweb.cgi?p=zsh/zsh;a=blob_plain;f=Completion/Unix/Command/_git;hb=HEAD
#
# 1. Install this file. Either:
...
...
@@ -17,7 +17,7 @@
#
# source ~/.git-flow-completion.zsh
#
# c. Or, use this file as a oh-my-zsh plugin.
# c. Or, use this file as a
n
oh-my-zsh plugin.
#
#Alias
...
...
plugins/git-hubflow/git-hubflow.plugin.zsh
View file @
18ef1ee6
...
...
@@ -5,7 +5,7 @@
#
# To achieve git-hubflow completion nirvana:
#
# 0. Update your zsh's git-completion module to the newest verion.
# 0. Update your zsh's git-completion module to the newest ver
s
ion.
# From here. http://zsh.git.sourceforge.net/git/gitweb.cgi?p=zsh/zsh;a=blob_plain;f=Completion/Unix/Command/_git;hb=HEAD
#
# 1. Install this file. Either:
...
...
@@ -17,7 +17,7 @@
#
# source ~/.git-hubflow-completion.zsh
#
# c. Or, use this file as a oh-my-zsh plugin.
# c. Or, use this file as a
n
oh-my-zsh plugin.
#
_git-hf
()
...
...
plugins/git-prompt/git-prompt.plugin.zsh
View file @
18ef1ee6
...
...
@@ -2,9 +2,6 @@
# http://github.com/olivierverdier/zsh-git-prompt
#
export
__GIT_PROMPT_DIR
=
$ZSH
/plugins/git-prompt
# Initialize colors.
autoload
-U
colors
colors
# Allow for functions in the prompt.
setopt PROMPT_SUBST
...
...
plugins/git/README.md
View file @
18ef1ee6
## git
**Maintainer:**
[
Stibbons
](
https://github.com/Stibbons
)
This plugin adds several git aliases and increase the completion function provided by zsh
**Maintainer:**
[
@ncanceill
](
https://github.com/ncanceill
)
This plugin adds many useful aliases and functions.
### Usage
See the
[
wiki
](
https://github.com/robbyrussell/oh-my-zsh/wiki/Plugin:git
)
for a list of aliases and functions provided by the plugin.
plugins/git/_git-branch
deleted
100644 → 0
View file @
eafd5f32
#compdef git-branch
_git-branch ()
{
declare l c m d
l='--color --no-color -r -a --all -v --verbose --abbrev --no-abbrev'
c='-l -f --force -t --track --no-track --set-upstream --contains --merged --no-merged'
m='-m -M'
d='-d -D'
declare -a dependent_creation_args
if (( words[(I)-r] == 0 )); then
dependent_creation_args=(
"($l $m $d): :__git_branch_names"
"::start-point:__git_revisions")
fi
declare -a dependent_deletion_args
if (( words[(I)-d] || words[(I)-D] )); then
dependent_creation_args=
dependent_deletion_args=(
'-r[delete only remote-tracking branches]')
if (( words[(I)-r] )); then
dependent_deletion_args+='*: :__git_ignore_line_inside_arguments __git_remote_branch_names'
else
dependent_deletion_args+='*: :__git_ignore_line_inside_arguments __git_branch_names'
fi
fi
declare -a dependent_modification_args
if (( words[(I)-m] || words[(I)-M] )); then
dependent_creation_args=
dependent_modification_args=(
':old or new branch name:__git_branch_names'
'::new branch name:__git_branch_names')
fi
_arguments -w -S -s \
"($c $m $d --no-color :)--color=-[turn on branch coloring]:: :__git_color_whens" \
"($c $m $d : --color)--no-color[turn off branch coloring]" \
"($c $m -a --all)-r[list or delete only remote-tracking branches]" \
"($c $m $d : -r)"{-a,--all}"[list both remote-tracking branches and local branches]" \
"($c $m $d : -v --verbose)"{-v,--verbose}'[show SHA1 and commit subject line for each head]' \
"($c $m $d :)--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length" \
"($c $m $d :)--no-abbrev[do not abbreviate sha1s]" \
"($l $m $d)-l[create the branch's reflog]" \
"($l $m $d -f --force)"{-f,--force}"[force the creation of a new branch]" \
"($l $m $d -t --track)"{-t,--track}"[set up configuration so that pull merges from the start point]" \
"($l $m $d)--no-track[override the branch.autosetupmerge configuration variable]" \
"($l $m $d)--set-upstream[set up configuration so that pull merges]" \
"($l $m $d)--contains=[only list branches which contain the specified commit]: :__git_committishs" \
"($l $m $d)--merged=[only list branches which are fully contained by HEAD]: :__git_committishs" \
"($l $m $d)--no-merged=[do not list branches which are fully contained by HEAD]: :__git_committishs" \
$dependent_creation_args \
"($l $c $d -M)-m[rename a branch and the corresponding reflog]" \
"($l $c $d -m)-M[rename a branch even if the new branch-name already exists]" \
$dependent_modification_args \
"($l $c $m -D)-d[delete a fully merged branch]" \
"($l $c $m -d)-D[delete a branch]" \
$dependent_deletion_args
}
(( $+functions[__git_ignore_line] )) ||
__git_ignore_line () {
declare -a ignored
ignored=()
((CURRENT > 1)) &&
ignored+=(${line[1,CURRENT-1]//(#m)[\[\]()\\*?#<>~\^]/\\$MATCH})
((CURRENT < $#line)) &&
ignored+=(${line[CURRENT+1,-1]//(#m)[\[\]()\\*?#<>~\^]/\\$MATCH})
$* -F ignored
}
(( $+functions[__git_ignore_line_inside_arguments] )) ||
__git_ignore_line_inside_arguments () {
declare -a compadd_opts
zparseopts -D -E -a compadd_opts V: J: 1 2 n f X: M: P: S: r: R: q F:
__git_ignore_line $* $compadd_opts
}
plugins/git/_git-remote
deleted
100644 → 0
View file @
eafd5f32
#compdef git-remote
# NOTE: --track is undocumented.
# TODO: --track, -t, --master, and -m should take remote branches, I guess.
# NOTE: --master is undocumented.
# NOTE: --fetch is undocumented.
_git-remote () {
local curcontext=$curcontext state line
declare -A opt_args
_arguments -C \
':command:->command' \
'*::options:->options' && ret=0
case $state in
(command)
declare -a commands
commands=(
'add:add a new remote'
'show:show information about a given remote'
'prune:delete all stale tracking branches for a given remote'
'update:fetch updates for a set of remotes'
'rm:remove a remote from .git/config and all associated tracking branches'
'rename:rename a remote from .git/config and update all associated tracking branches'
'set-head:sets or deletes the default branch'
'set-branches:changes the list of branches tracked by the named remote.'
'set-url:changes URL remote points to.'
)
_describe -t commands 'sub-command' commands && ret=0
;;
(options)
case $line[1] in
(add)
_arguments \
'*'{--track,-t}'[track given branch instead of default glob refspec]:branch:__git_branch_names' \
'(--master -m)'{--master,-m}'[set the remote'\''s HEAD to point to given master branch]:branch:__git_branch_names' \
'(--fetch -f)'{--fetch,-f}'[run git-fetch on the new remote after it has been created]' \
':branch name:__git_remotes' \
':url:_urls' && ret=0
;;
(show)
_arguments \
'-n[do not contact the remote for a list of branches]' \
':remote:__git_remotes' && ret=0
;;
(prune)
_arguments \
'(--dry-run -n)'{-n,--dry-run}'[do not actually prune, only list what would be done]' \
':remote:__git_remotes' && ret=0
;;
(update)
__git_remote-groups && ret=0
;;
(rm)
__git_remotes && ret=0
;;
(rename)
__git_remotes && ret=0
;;
(set-url)
_arguments \
'*--push[manipulate push URLs]' \
'(--add)--add[add URL]' \
'(--delete)--delete[delete URLs]' \
':branch name:__git_remotes' \
':url:_urls' && ret=0
;;
esac
;;
esac
}
plugins/git/git.plugin.zsh
View file @
18ef1ee6
# Query/use custom command for `git`.
zstyle
-s
":vcs_info:git:*:-all-"
"command"
_omz_git_git_cmd
:
${
_omz_git_git_cmd
:
=git
}
#
# Functions
#
# The current branch name
# Usage example: git pull origin $(current_branch)
# Using '--quiet' with 'symbolic-ref' will not cause a fatal error (128) if
# it's not a symbolic ref, but in a Git repo.
function
current_branch
()
{
local
ref
ref
=
$(
$_omz_git_git_cmd
symbolic-ref
--quiet
HEAD 2> /dev/null
)
local
ret
=
$?
if
[[
$ret
!=
0
]]
;
then
[[
$ret
==
128
]]
&&
return
# no git repo.
ref
=
$(
$_omz_git_git_cmd
rev-parse
--short
HEAD 2> /dev/null
)
||
return
fi
echo
${
ref
#refs/heads/
}
}
# The list of remotes
function
current_repository
()
{
if
!
$_omz_git_git_cmd
rev-parse
--is-inside-work-tree
&> /dev/null
;
then
return
fi
echo
$(
$_omz_git_git_cmd
remote
-v
|
cut
-d
':'
-f
2
)
}
# Pretty log messages
function
_git_log_prettily
(){
if
!
[
-z
$1
]
;
then
git log
--pretty
=
$1
fi
}
# Warn if the current branch is a WIP
function
work_in_progress
()
{
if
$(
git log
-n
1 2>/dev/null |
grep
-q
-c
"
\-\-
wip
\-\-
"
)
;
then
echo
"WIP!!"
fi
}
#
# Aliases
# (sorted alphabetically)
#
alias
g
=
'git'
compdef
g
=
git
alias
gst
=
'git status'
compdef _git
gst
=
git-status
alias
gd
=
'git diff'
compdef _git
gd
=
git-diff
alias
gdc
=
'git diff --cached'
compdef _git
gdc
=
git-diff
alias
gl
=
'git pull'
compdef _git
gl
=
git-pull
alias
gup
=
'git pull --rebase'
compdef _git
gup
=
git-fetch
alias
gp
=
'git push'
compdef _git
gp
=
git-push
alias
gd
=
'git diff'
gdv
()
{
git diff
-w
"
$@
"
| view -
}
compdef _git
gdv
=
git-diff
alias
ga
=
'git add'
alias
gaa
=
'git add --all'
alias
gapa
=
'git add --patch'
alias
gb
=
'git branch'
alias
gba
=
'git branch -a'
alias
gbda
=
'git branch --merged | command grep -vE "^(\*|\s*master\s*$)" | command xargs -n 1 git branch -d'
alias
gbl
=
'git blame -b -w'
alias
gbnm
=
'git branch --no-merged'
alias
gbr
=
'git branch --remote'
alias
gbs
=
'git bisect'
alias
gbsb
=
'git bisect bad'
alias
gbsg
=
'git bisect good'
alias
gbsr
=
'git bisect reset'
alias
gbss
=
'git bisect start'
alias
gc
=
'git commit -v'
compdef _git
gc
=
git-commit
alias
gc!
=
'git commit -v --amend'
compdef _git gc!
=
git-commit
alias
gca
=
'git commit -v -a'
compdef _git
gc
=
git-commit
alias
gca!
=
'git commit -v -a --amend'
compdef _git gca!
=
git-commit
alias
gcan!
=
'git commit -v -a -s --no-edit --amend'
alias
gcb
=
'git checkout -b'
alias
gcf
=
'git config --list'
alias
gcl
=
'git clone --recursive'
alias
gclean
=
'git reset --hard && git clean -dfx'
alias
gcm
=
'git checkout master'
alias
gcmsg
=
'git commit -m'
compdef _git
gcmsg
=
git-commit
alias
gco
=
'git checkout'
compdef _git
gco
=
git-checkout
alias
gcm
=
'git checkout master'
alias
gr
=
'git remote'
compdef _git
gr
=
git-remote
alias
grv
=
'git remote -v'
compdef _git
grv
=
git-remote
alias
grmv
=
'git remote rename'
compdef _git
grmv
=
git-remote
alias
grrm
=
'git remote remove'
compdef _git
grrm
=
git-remote
alias
grset
=
'git remote set-url'
compdef _git
grset
=
git-remote
alias
grup
=
'git remote update'
compdef _git
grset
=
git-remote
alias
grbi
=
'git rebase -i'
compdef _git
grbi
=
git-rebase
alias
grbc
=
'git rebase --continue'
compdef _git
grbc
=
git-rebase
alias
grba
=
'git rebase --abort'
compdef _git
grba
=
git-rebase
alias
gb
=
'git branch'
compdef _git
gb
=
git-branch
alias
gba
=
'git branch -a'
compdef _git
gba
=
git-branch
alias
gcount
=
'git shortlog -sn'
compdef
gcount
=
git
alias
gcl
=
'git config --list'
alias
gcp
=
'git cherry-pick'
compdef _git
gcp
=
git-cherry-pick
alias
glg
=
'git log --stat --max-count=10'
compdef _git
glg
=
git-log
alias
glgg
=
'git log --graph --max-count=10'
compdef _git
glgg
=
git-log
alias
glgga
=
'git log --graph --decorate --all'
compdef _git
glgga
=
git-log
alias
glo
=
'git log --oneline --decorate --color'
compdef _git
glo
=
git-log
alias
glog
=
'git log --oneline --decorate --color --graph'
compdef _git
glog
=
git-log
alias
gss
=
'git status -s'
compdef _git
gss
=
git-status
alias
ga
=
'git add'
compdef _git
ga
=
git-add
alias
gm
=
'git merge'
compdef _git
gm
=
git-merge
alias
grh
=
'git reset HEAD'
alias
grhh
=
'git reset HEAD --hard'
alias
gclean
=
'git reset --hard && git clean -dfx'
alias
gwc
=
'git whatchanged -p --abbrev-commit --pretty=medium'
alias
gcs
=
'git commit -S'
#remove the gf alias
#alias gf='git ls-files | grep'
alias
gd
=
'git diff'
alias
gdca
=
'git diff --cached'
alias
gdt
=
'git diff-tree --no-commit-id --name-only -r'
gdv
()
{
git diff
-w
"
$@
"
| view -
}
compdef _git
gdv
=
git-diff
alias
gdw
=
'git diff --word-diff'
alias
gpoat
=
'git push origin --all && git push origin --tags'
alias
gmt
=
'git mergetool --no-prompt'
compdef _git
gm
=
git-mergetool
alias
gf
=
'git fetch'
alias
gfa
=
'git fetch --all --prune'
function
gfg
()
{
git ls-files |
grep
$@
}
compdef
gfg
=
grep
alias
gfo
=
'git fetch origin'
alias
gg
=
'git gui citool'
alias
gga
=
'git gui citool --amend'
alias
gk
=
'gitk --all --branches'
alias
gsts
=
'git stash show --text'
alias
gsta
=
'git stash'
alias
gstp
=
'git stash pop'
alias
gstd
=
'git stash drop'
# Will cd into the top of the current repository
# or submodule.
alias
grt
=
'cd $(git rev-parse --show-toplevel || echo ".")'
# Git and svn mix
alias
git-svn-dcommit-push
=
'git svn dcommit && git push github master:svntrunk'
compdef git-svn-dcommit-push
=
git
alias
gsr
=
'git svn rebase'
alias
gsd
=
'git svn dcommit'
#
# Will return the current branch name
# Usage example: git pull origin $(current_branch)
#
function
current_branch
()
{
ref
=
$(
git symbolic-ref HEAD 2> /dev/null
)
||
\
ref
=
$(
git rev-parse
--short
HEAD 2> /dev/null
)
||
return
echo
${
ref
#refs/heads/
}
ggf
()
{
[[
"$#"
!=
1
]]
&&
local
b
=
"
$(
current_branch
)
"
git push
--force
origin
"
${
b
:
=
$1
}
"
}
function
current_repository
()
{
ref
=
$(
git symbolic-ref HEAD 2> /dev/null
)
||
\
ref
=
$(
git rev-parse
--short
HEAD 2> /dev/null
)
||
return
echo
$(
git remote
-v
|
cut
-d
':'
-f
2
)
compdef _git
ggf
=
git-checkout
ggl
()
{
if
[[
"$#"
!=
0
]]
&&
[[
"$#"
!=
1
]]
;
then
git pull origin
"
${
*
}
"
else
[[
"$#"
==
0
]]
&&
local
b
=
"
$(
current_branch
)
"
git pull origin
"
${
b
:
=
$1
}
"
fi
}
# these aliases take advantage of the previous function
compdef _git
ggl
=
git-checkout
alias
ggpull
=
'git pull origin $(current_branch)'
compdef
ggpull
=
git
alias
ggpur
=
'git pull --rebase origin $(current_branch)'
compdef
ggpur
=
git
compdef _git
ggpull
=
git-checkout
ggp
()
{
if
[[
"$#"
!=
0
]]
&&
[[
"$#"
!=
1
]]
;
then
git push origin
"
${
*
}
"
else
[[
"$#"
==
0
]]
&&
local
b
=
"
$(
current_branch
)
"
git push origin
"
${
b
:
=
$1
}
"
fi
}
compdef _git
ggp
=
git-checkout
alias
ggpush
=
'git push origin $(current_branch)'
compdef
ggpush
=
git
alias
ggpnp
=
'git pull origin $(current_branch) && git push origin $(current_branch)'
compdef
ggpnp
=
git
# Pretty log messages
function
_git_log_prettily
(){
if
!
[
-z
$1
]
;
then
git log
--pretty
=
$1
fi
compdef _git
ggpush
=
git-checkout
ggpnp
()
{
if
[[
"$#"
==
0
]]
;
then
ggl
&&
ggp
else
ggl
"
${
*
}
"
&&
ggp
"
${
*
}
"
fi
}
alias
glp
=
"_git_log_prettily"
compdef _git
glp
=
git-log
# Work In Progress (wip)
# These features allow to pause a branch development and switch to another one (wip)
# When you want to go back to work, just unwip it
#
# This function return a warning if the current branch is a wip
function
work_in_progress
()
{
if
$(
git log
-n
1 2>/dev/null |
grep
-q
-c
"
\-\-
wip
\-\-
"
)
;
then
echo
"WIP!!"
fi
compdef _git
ggpnp
=
git-checkout
alias
ggsup
=
'git branch --set-upstream-to=origin/$(current_branch)'
ggu
()
{
[[
"$#"
!=
1
]]
&&
local
b
=
"
$(
current_branch
)
"
git pull
--rebase
origin
"
${
b
:
=
$1
}
"
}
# these alias commit and uncomit wip branches
alias
g
wip
=
'git add -A; git ls-files --deleted -z | xargs -r0 git rm; git commit -m "--wip--"
'
alias
gunwip
=
'git log -n 1 | grep -q -c "\-\-wip\-\-" && git reset HEAD~1'
compdef _git
ggu
=
git-checkout
alias
g
gpur
=
'ggu
'
compdef _git
ggpur
=
git-checkout
# these alias ignore changes to file
alias
gignore
=
'git update-index --assume-unchanged'
alias
gunignore
=
'git update-index --no-assume-unchanged'
# list temporarily ignored files
alias
gignored
=
'git ls-files -v | grep "^[[:lower:]]"'
alias
git-svn-dcommit-push
=
'git svn dcommit && git push github master:svntrunk'
compdef git-svn-dcommit-push
=
git
alias
gk
=
'\gitk --all --branches'
compdef _git
gk
=
'gitk'
alias
gke
=
'\gitk --all $(git log -g --pretty=format:%h)'
compdef _git
gke
=
'gitk'
alias
gl
=
'git pull'
alias
glg
=
'git log --stat --color'
alias
glgp
=
'git log --stat --color -p'
alias
glgg
=
'git log --graph --color'
alias
glgga
=
'git log --graph --decorate --all'
alias
glgm
=
'git log --graph --max-count=10'
alias
glo
=
'git log --oneline --decorate --color'
alias
glol
=
"git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
alias
glola
=
"git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --all"
alias
glog
=
'git log --oneline --decorate --color --graph'
alias
glp
=
"_git_log_prettily"
compdef _git
glp
=
git-log
alias
gm
=
'git merge'
alias
gmom
=
'git merge origin/master'
alias
gmt
=
'git mergetool --no-prompt'
alias
gmtvim
=
'git mergetool --no-prompt --tool=vimdiff'
alias
gmum
=
'git merge upstream/master'
alias
gp
=
'git push'
alias
gpd
=
'git push --dry-run'
alias
gpoat
=
'git push origin --all && git push origin --tags'
compdef _git
gpoat
=
git-push
alias
gpu
=
'git push upstream'
alias
gpv
=
'git push -v'
alias
gr
=
'git remote'
alias
gra
=
'git remote add'
alias
grb
=
'git rebase'
alias
grba
=
'git rebase --abort'
alias
grbc
=
'git rebase --continue'
alias
grbi
=
'git rebase -i'
alias
grbm
=
'git rebase master'
alias
grbs
=
'git rebase --skip'
alias
grh
=
'git reset HEAD'
alias
grhh
=
'git reset HEAD --hard'
alias
grmv
=
'git remote rename'
alias
grrm
=
'git remote remove'
alias
grset
=
'git remote set-url'
alias
grt
=
'cd $(git rev-parse --show-toplevel || echo ".")'
alias
gru
=
'git reset --'
alias
grup
=
'git remote update'
alias
grv
=
'git remote -v'
alias
gsb
=
'git status -sb'
alias
gsd
=
'git svn dcommit'
alias
gsi
=
'git submodule init'
alias
gsps
=
'git show --pretty=short --show-signature'
alias
gsr
=
'git svn rebase'
alias
gss
=
'git status -s'
alias
gst
=
'git status'
alias
gsta
=
'git stash'
alias
gstaa
=
'git stash apply'
alias
gstd
=
'git stash drop'
alias
gstl
=
'git stash list'
alias
gstp
=
'git stash pop'
alias
gsts
=
'git stash show --text'
alias
gsu
=
'git submodule update'
alias
gts
=
'git tag -s'
alias
gunignore
=
'git update-index --no-assume-unchanged'
alias
gunwip
=
'git log -n 1 | grep -q -c "\-\-wip\-\-" && git reset HEAD~1'
alias
gup
=
'git pull --rebase'
alias
gupv
=
'git pull --rebase -v'
alias
gvt
=
'git verify-tag'
alias
gwch
=
'git whatchanged -p --abbrev-commit --pretty=medium'
alias
gwip
=
'git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit -m "--wip--"'
plugins/gitfast/_git
View file @
18ef1ee6
...
...
@@ -30,10 +30,10 @@ if [ -z "$script" ]; then
local -a locations
local e
locations=(
"$(dirname ${funcsourcetrace[1]%:*})/git-completion.bash"
'/etc/bash_completion.d/git' # fedora, old debian
'/usr/share/bash-completion/completions/git' # arch, ubuntu, new debian
'/usr/share/bash-completion/git' # gentoo
$(dirname ${funcsourcetrace[1]%:*})/git-completion.bash
)
for e in $locations; do
test -f $e && script="$e" && break
...
...
@@ -76,6 +76,14 @@ __gitcomp_nl ()
compadd -Q -S "${4- }" -p "${2-}" -- ${=1} && _ret=0
}
__gitcomp_nl_append ()
{
emulate -L zsh
local IFS=$'\n'
compadd -Q -S "${4- }" -p "${2-}" -- ${=1} && _ret=0
}
__gitcomp_file ()
{
emulate -L zsh
...
...
plugins/gitfast/git-completion.bash
View file @
18ef1ee6
#!bash
#
# bash/zsh completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
...
...
@@ -180,9 +178,9 @@ _get_comp_words_by_ref ()
}
fi
__gitcompa
d
d
()
__gitcompa
ppen
d
()
{
local
i
=
0
local
i
=
${#
COMPREPLY
[@]
}
for
x
in
$1
;
do
if
[[
"
$x
"
==
"
$3
"
*
]]
;
then
COMPREPLY[i++]
=
"
$2$x$4
"
...
...
@@ -190,6 +188,12 @@ __gitcompadd ()
done
}
__gitcompadd
()
{
COMPREPLY
=()
__gitcompappend
"
$@
"
}
# Generates completion reply, appending a space to possible completion words,
# if necessary.
# It accepts 1 to 4 arguments:
...
...
@@ -220,6 +224,14 @@ __gitcomp ()
esac
}
# Variation of __gitcomp_nl () that appends to the existing list of
# completion candidates, COMPREPLY.
__gitcomp_nl_append
()
{
local
IFS
=
$'
\n
'
__gitcompappend
"
$1
"
"
${
2
-
}
"
"
${
3
-
$cur
}
"
"
${
4
-
}
"
}
# Generates completion reply from newline-separated possible completion words
# by appending a space to all of them.
# It accepts 1 to 4 arguments:
...
...
@@ -231,8 +243,8 @@ __gitcomp ()
# appended.
__gitcomp_nl
()
{
local
IFS
=
$'
\n
'
__gitcomp
add
"
$1
"
"
${
2
-
}
"
"
${
3
-
$cur
}
"
"
${
4
-
}
"
COMPREPLY
=()
__gitcomp
_nl_append
"
$@
"
}
# Generates completion reply with compgen from newline-separated possible
...
...
@@ -673,7 +685,6 @@ __git_list_porcelain_commands ()
index-pack
)
: plumbing
;;
init-db
)
: deprecated
;;
local-fetch
)
: plumbing
;;
lost-found
)
: infrequent
;;
ls-files
)
: plumbing
;;
ls-remote
)
: plumbing
;;
ls-tree
)
: plumbing
;;
...
...
@@ -687,14 +698,12 @@ __git_list_porcelain_commands ()
pack-refs
)
: plumbing
;;
parse-remote
)
: plumbing
;;
patch-id
)
: plumbing
;;
peek-remote
)
: plumbing
;;
prune
)
: plumbing
;;
prune-packed
)
: plumbing
;;
quiltimport
)
: import
;;
read-tree
)
: plumbing
;;
receive-pack
)
: plumbing
;;
remote-
*
)
: transport
;;
repo-config
)
: deprecated
;;
rerere
)
: plumbing
;;
rev-list
)
: plumbing
;;
rev-parse
)
: plumbing
;;
...
...
@@ -707,7 +716,6 @@ __git_list_porcelain_commands ()
ssh-
*
)
: transport
;;
stripspace
)
: plumbing
;;
symbolic-ref
)
: plumbing
;;
tar-tree
)
: deprecated
;;
unpack-file
)
: plumbing
;;
unpack-objects
)
: plumbing
;;
update-index
)
: plumbing
;;
...
...
@@ -901,7 +909,7 @@ _git_add ()
esac
# XXX should we check for --update and --all options ?
__git_complete_index_file
"--others --modified"
__git_complete_index_file
"--others --modified
--directory --no-empty-directory
"
}
_git_archive
()
...
...
@@ -1063,7 +1071,7 @@ _git_clean ()
esac
# XXX should we check for -x option ?
__git_complete_index_file
"--others"
__git_complete_index_file
"--others
--directory
"
}
_git_clone
()
...
...
@@ -1188,7 +1196,7 @@ _git_diff ()
__git_complete_revlist_file
}
__git_mergetools_common
=
"diffuse ecmerge emerge kdiff3 meld opendiff
__git_mergetools_common
=
"diffuse
diffmerge
ecmerge emerge kdiff3 meld opendiff
tkdiff vimdiff gvimdiff xxdiff araxis p4merge bc3 codecompare
"
...
...
@@ -1491,6 +1499,12 @@ _git_mergetool ()
_git_merge_base
()
{
case
"
$cur
"
in
--
*
)
__gitcomp
"--octopus --independent --is-ancestor --fork-point"
return
;;
esac
__gitcomp_nl
"
$(
__git_refs
)
"
}
...
...
@@ -1623,7 +1637,7 @@ _git_rebase ()
--preserve-merges --stat --no-stat
--committer-date-is-author-date --ignore-date
--ignore-whitespace --whitespace=
--autosquash
--autosquash
--fork-point --no-fork-point
"
return
...
...
@@ -1833,6 +1847,7 @@ _git_config ()
branch.
*
)
local
pfx
=
"
${
cur
%.*
}
."
cur_
=
"
${
cur
#*.
}
"
__gitcomp_nl
"
$(
__git_heads
)
"
"
$pfx
"
"
$cur_
"
"."
__gitcomp_nl_append
$'autosetupmerge
\n
autosetuprebase
\n
'
"
$pfx
"
"
$cur_
"
return
;;
guitool.
*
.
*
)
...
...
@@ -1875,6 +1890,7 @@ _git_config ()
remote.
*
)
local
pfx
=
"
${
cur
%.*
}
."
cur_
=
"
${
cur
#*.
}
"
__gitcomp_nl
"
$(
__git_remotes
)
"
"
$pfx
"
"
$cur_
"
"."
__gitcomp_nl_append
"pushdefault"
"
$pfx
"
"
$cur_
"
return
;;
url.
*
.
*
)
...
...
@@ -1997,6 +2013,7 @@ _git_config ()
fetch.unpackLimit
format.attach
format.cc
format.coverLetter
format.headers
format.numbered
format.pretty
...
...
@@ -2580,7 +2597,7 @@ if [[ -n ${ZSH_VERSION-} ]]; then
--
*
=
*
|
*
.
)
;;
*
)
c
=
"
$c
"
;;
esac
array[
$#array
+1]
=
"
$c
"
array[
$
{
#
array
[@]
}
+1]
=
"
$c
"
done
compset
-P
'*[=:]'
compadd
-Q
-S
''
-p
"
${
2
-
}
"
-a
--
array
&&
_ret
=
0
...
...
plugins/gitfast/git-prompt.sh
View file @
18ef1ee6
...
...
@@ -60,6 +60,7 @@
# of values:
#
# verbose show number of commits ahead/behind (+/-) upstream
# name if verbose, then also show the upstream abbrev name
# legacy don't use the '--count' option available in recent
# versions of git-rev-list
# git always compare HEAD to @{upstream}
...
...
@@ -84,13 +85,17 @@
# the colored output of "git status -sb" and are available only when
# using __git_ps1 for PROMPT_COMMAND or precmd.
# check whether printf supports -v
__git_printf_supports_v
=
printf
-v
__git_printf_supports_v
--
'%s'
yes
>
/dev/null 2>&1
# stores the divergence from upstream in $p
# used by GIT_PS1_SHOWUPSTREAM
__git_ps1_show_upstream
()
{
local
key value
local
svn_remote svn_url_pattern count n
local
upstream
=
git
legacy
=
""
verbose
=
""
local
upstream
=
git
legacy
=
""
verbose
=
""
name
=
""
svn_remote
=()
# get some config options from git-config
...
...
@@ -106,7 +111,7 @@ __git_ps1_show_upstream ()
;;
svn-remote.
*
.url
)
svn_remote[
$((${#
svn_remote
[@]
}
+
1
))
]=
"
$value
"
svn_url_pattern
+
=
"
\\
|
$value
"
svn_url_pattern
=
"
$svn_url_pattern
\\
|
$value
"
upstream
=
svn+git
# default upstream is SVN if available, else git
;;
esac
...
...
@@ -118,6 +123,7 @@ __git_ps1_show_upstream ()
git|svn
)
upstream
=
"
$option
"
;;
verbose
)
verbose
=
1
;;
legacy
)
legacy
=
1
;;
name
)
name
=
1
;;
esac
done
...
...
@@ -200,6 +206,9 @@ __git_ps1_show_upstream ()
*
)
# diverged from upstream
p
=
" u+
${
count
#*
}
-
${
count
% *
}
"
;;
esac
if
[[
-n
"
$count
"
&&
-n
"
$name
"
]]
;
then
p
=
"
$p
$(
git rev-parse
--abbrev-ref
"
$upstream
"
2>/dev/null
)
"
fi
fi
}
...
...
@@ -250,6 +259,13 @@ __git_ps1_colorize_gitstring ()
r
=
"
$c_clear$r
"
}
eread
()
{
f
=
"
$1
"
shift
test
-r
"
$f
"
&&
read
"
$@
"
<
"
$f
"
}
# __git_ps1 accepts 0 or 1 arguments (i.e., format string)
# when called from PS1 using command substitution
# in this mode it prints text to add to bash PS1 prompt (includes branch name)
...
...
@@ -312,9 +328,9 @@ __git_ps1 ()
local
step
=
""
local
total
=
""
if
[
-d
"
$g
/rebase-merge"
]
;
then
read
b 2>/dev/null <
"
$g
/rebase-merge/head-name"
read
step 2>/dev/null <
"
$g
/rebase-merge/msgnum"
read
total 2>/dev/null <
"
$g
/rebase-merge/end"
e
read
"
$g
/rebase-merge/head-name"
b
e
read
"
$g
/rebase-merge/msgnum"
step
e
read
"
$g
/rebase-merge/end"
total
if
[
-f
"
$g
/rebase-merge/interactive"
]
;
then
r
=
"|REBASE-i"
else
...
...
@@ -322,10 +338,10 @@ __git_ps1 ()
fi
else
if
[
-d
"
$g
/rebase-apply"
]
;
then
read
step 2>/dev/null <
"
$g
/rebase-apply/next"
read
total 2>/dev/null <
"
$g
/rebase-apply/last"
e
read
"
$g
/rebase-apply/next"
step
e
read
"
$g
/rebase-apply/last"
total
if
[
-f
"
$g
/rebase-apply/rebasing"
]
;
then
read
b 2>/dev/null <
"
$g
/rebase-apply/head-name"
e
read
"
$g
/rebase-apply/head-name"
b
r
=
"|REBASE"
elif
[
-f
"
$g
/rebase-apply/applying"
]
;
then
r
=
"|AM"
...
...
@@ -349,7 +365,7 @@ __git_ps1 ()
b
=
"
$(
git symbolic-ref HEAD 2>/dev/null
)
"
else
local head
=
""
if
!
read
head
2>/dev/null <
"
$g
/HEAD"
;
then
if
!
e
read
"
$g
/HEAD"
head
;
then
if
[
$pcmode
=
yes
]
;
then
PS1
=
"
$ps1pc_start$ps1pc_end
"
fi
...
...
@@ -433,7 +449,7 @@ __git_ps1 ()
local
gitstring
=
"
$c
${
b
##refs/heads/
}${
f
:+
$z$f
}
$r$p
"
if
[
$pcmode
=
yes
]
;
then
if
[
[
-n
${
ZSH_VERSION
-
}
]
]
;
then
if
[
"
${
__git_printf_supports_v
-
}
"
!=
yes
]
;
then
gitstring
=
$(
printf
--
"
$printf_format
"
"
$gitstring
"
)
else
printf
-v
gitstring
--
"
$printf_format
"
"
$gitstring
"
...
...
plugins/github/github.plugin.zsh
View file @
18ef1ee6
...
...
@@ -40,7 +40,7 @@ fi
#
# Use this when creating a new repo from scratch.
empty_gh
()
{
# [NAME_OF_REPO]
repo
=
$1
repo
=
$1
ghuser
=
$(
git config github.user
)
mkdir
"
$repo
"
...
...
plugins/gitignore/gitignore.plugin.zsh
View file @
18ef1ee6
function
gi
()
{
curl http://www.gitignore.io/api/
$@
;
}
function
gi
()
{
curl
-sL
http
s
://www.gitignore.io/api/
$@
;
}
_gitign
i
reio_get_command_list
()
{
curl
-s
http://www.gitignore.io/api/list |
tr
","
"
\n
"
_gitign
o
reio_get_command_list
()
{
curl
-s
L
http
s
://www.gitignore.io/api/list |
tr
","
"
\n
"
}
_gitign
i
reio
()
{
_gitign
o
reio
()
{
compset
-P
'*,'
compadd
-S
''
`
_gitign
i
reio_get_command_list
`
compadd
-S
''
`
_gitign
o
reio_get_command_list
`
}
compdef _gitign
i
reio gi
compdef _gitign
o
reio gi
plugins/golang/golang.plugin.zsh
View file @
18ef1ee6
...
...
@@ -23,6 +23,7 @@ __go_tool_complete() {
'env[print Go environment information]'
'fix[run go tool fix on packages]'
'fmt[run gofmt on package sources]'
'generate[generate Go files by processing source]'
'get[download and install packages and dependencies]'
'help[display help]'
'install[compile and install packages and dependencies]'
...
...
@@ -158,3 +159,6 @@ __go_tool_complete() {
}
compdef __go_tool_complete go
# aliases
alias
gfa
=
'go fmt . ./...'
plugins/gradle/gradle.plugin.zsh
View file @
18ef1ee6
...
...
@@ -60,7 +60,7 @@ function in_gradle() {
############################################################################
_gradle_does_task_list_need_generating
()
{
[
!
-f
.gradletasknamecache
]
&&
return
0
;
[
.gradletasknamecache
-nt
build.gradle
]
&&
return
0
;
[
build.gradle
-nt
.gradletasknamecache
]
&&
return
0
;
return
1
;
}
...
...
@@ -72,7 +72,7 @@ _gradle_tasks () {
if
[
in_gradle
]
;
then
_gradle_arguments
if
_gradle_does_task_list_need_generating
;
then
gradle tasks
--all
|
grep
"^[ ]*[a-zA-Z0-9]*
\
-
\
"
|
sed
"s/ - .*
$/
/"
|
sed
"s/[
\
]*//"
>
.gradletasknamecache
gradle tasks
--all
|
grep
"^[ ]*[a-zA-Z0-9
:
]*
\
-
\
"
|
sed
"s/ - .*
$/
/"
|
sed
"s/[
\
]*//"
>
.gradletasknamecache
fi
compadd
-X
"==== Gradle Tasks ===="
`
cat
.gradletasknamecache
`
fi
...
...
@@ -82,7 +82,7 @@ _gradlew_tasks () {
if
[
in_gradle
]
;
then
_gradle_arguments
if
_gradle_does_task_list_need_generating
;
then
gradlew tasks
--all
|
grep
"^[ ]*[a-zA-Z0-9]*
\
-
\
"
|
sed
"s/ - .*
$/
/"
|
sed
"s/[
\
]*//"
>
.gradletasknamecache
gradlew tasks
--all
|
grep
"^[ ]*[a-zA-Z0-9
:
]*
\
-
\
"
|
sed
"s/ - .*
$/
/"
|
sed
"s/[
\
]*//"
>
.gradletasknamecache
fi
compadd
-X
"==== Gradlew Tasks ===="
`
cat
.gradletasknamecache
`
fi
...
...
plugins/grails/grails.plugin.zsh
100755 → 100644
View file @
18ef1ee6
File mode changed from 100755 to 100644
plugins/grunt/grunt.plugin.zsh
0 → 100644
View file @
18ef1ee6
#compdef grunt
#autoload
# -----------------------------------------------------------------------------
# _grunt
#
# Completion script for grunt.
# - https://github.com/gruntjs/grunt
# - https://github.com/gruntjs/grunt-cli
#
# -----------------------------------------------------------------------------
#
# Version : 0.1.2
# Author : Yonchu <yuyuchu3333@gmail.com>
# License : MIT License
# Repository : https://github.com/yonchu/grunt-zsh-completion
# Last Change : 20 Aug 2014.
#
# Copyright (c) 2013 Yonchu.
#
# -----------------------------------------------------------------------------
# USAGE
# -----
#
# Enable caching:
#
# If you want to use the cache, set the followings in your .zshrc:
#
# zstyle ':completion:*' use-cache yes
#
#
# Settings:
#
# - Show grunt file path:
# zstyle ':completion::complete:grunt::options:' show_grunt_path yes
#
# - Cache expiration days (default: 7):
# zstyle ':completion::complete:grunt::options:' expire 1
#
# - Not update options cache if target gruntfile is changed.
# zstyle ':completion::complete:grunt::options:' no_update_options yes
#
# Note that if you change the zstyle settings,
# you should delete the cache file and restart zsh.
#
# $ rm ~/.zcompcache/grunt
# $ exec zsh
#
# -----------------------------------------------------------------------------
function
__grunt
()
{
local
curcontext
=
"
$curcontext
"
update_policy state
local
show_grunt_path update_msg gruntfile opts tasks
# Setup cache-policy.
zstyle
-s
":completion:
${
curcontext
}
:"
cache-policy update_policy
if
[[
-z
$update_policy
]]
;
then
zstyle
":completion:
${
curcontext
}
:"
cache-policy __grunt_caching_policy
fi
# Check show_path option.
zstyle
-b
":completion:
${
curcontext
}
:options:"
show_grunt_path show_grunt_path
# Get current gruntfile.
gruntfile
=
$(
__grunt_get_gruntfile
)
# Initialize opts and tasks.
opts
=()
tasks
=()
# Add help options.
opts+
=(
'(- 1 *)'
{
-h
,--help
}
'[Display this help text.]'
)
## Complete without gruntfile.
if
[[
!
-f
$gruntfile
]]
;
then
_arguments
"
${
opts
[@]
}
"
return
fi
## Complete with gruntfile.
# Retrieve cache.
if
!
__grunt_update_cache
"
$gruntfile
"
;
then
update_msg
=
' (cache updated)'
fi
# Make optioins completion.
if
[[
${#
__grunt_opts
}
-gt
0
]]
;
then
opts+
=(
"
${
__grunt_opts
[@]
}
"
)
fi
# Complete arguments.
_arguments
\
"
${
opts
[@]
}
"
\
'*: :->tasks'
\
&&
return
case
$state
in
tasks
)
if
[[
$show_grunt_path
==
'yes'
]]
;
then
update_msg
=
"
$update_msg
:
${${
gruntfile
/#
$HOME
/~
}
%/
}
"
fi
# Make tasks completion.
if
[[
${#
__grunt_tasks
}
-gt
0
]]
;
then
tasks+
=(
"
${
__grunt_tasks
[@]
}
"
)
_describe
-t
grunt-task
"
$verbose
grunt task
$update_msg
"
tasks
||
return
1
fi
;;
esac
return
0
}
# Cache policy:
# The cache file name: grunt
# The cache variable name: __grunt_version __grunt_gruntfile __grunt_opts __grunt_tasks
function
__grunt_update_cache
()
{
# TODO
local
version
=
'0.1.2'
local
is_updating
=
0
local
gruntfile
=
"
$1
"
local
grunt_info no_update_options cache_path
# Check no_update_options option.
zstyle
-b
":completion:
${
curcontext
}
:options:"
no_update_options no_update_options
if
!
(
((
$+
__grunt_gruntfile
))
\
&&
((
$+
__grunt_opts
))
\
&&
((
$+
__grunt_tasks
))
)
\
&&
!
_retrieve_cache
'grunt'
;
then
is_updating
=
1
fi
if
[[
$gruntfile
!=
$__grunt_gruntfile
]]
;
then
# Except for --help options.
__grunt_gruntfile
=
$gruntfile
if
[[
$no_update_options
==
'yes'
]]
;
then
if
[[
$PREFIX
==
${
PREFIX
#-
}
]]
;
then
# Not options completions.
is_updating
=
1
elif
[[
${#
__grunt_opts
}
-lt
2
]]
;
then
is_updating
=
1
else
unset
__grunt_gruntfile
fi
else
is_updating
=
1
fi
else
if
[[
$PREFIX
!=
${
PREFIX
#-
}
&&
${#
__grunt_opts
}
-gt
1
]]
;
then
unset
__grunt_gruntfile
fi
fi
if
_cache_invalid
'grunt'
;
then
is_updating
=
1
fi
# Check _grunt version.
if
[[
$__grunt_version
!=
$version
]]
;
then
is_updating
=
1
fi
if
[[
$is_updating
-ne
0
]]
;
then
# Update caceh.
__grunt_version
=
$version
__grunt_gruntfile
=
$gruntfile
is_updating
=
1
grunt_info
=
$(
grunt
--help
--no-color
--gruntfile
"
$__grunt_gruntfile
"
2>/dev/null
)
__grunt_opts
=(
${
(f)
"
$(
__grunt_get_opts
"
$grunt_info
"
)
"
}
)
__grunt_tasks
=(
${
(f)
"
$(
__grunt_get_tasks
"
$grunt_info
"
)
"
}
)
_store_cache
'grunt'
__grunt_version __grunt_gruntfile __grunt_opts __grunt_tasks
fi
return
$is_updating
}
function
__grunt_get_tasks
()
{
echo
-E
"
$1
"
\
|
grep
'Available tasks'
-A
100
\
|
grep
'^ '
\
|
sed
-e
's/^[[:blank:]]*//'
-e
's/[[:blank:]]*$//'
\
|
sed
-e
's/:/\\:/g'
\
|
sed
-e
's/ /:/'
}
function
__grunt_get_opts
()
{
local
opt_hunk opt_sep opt_num line opt
opt_hunk
=
$(
echo
-E
"
$1
"
\
|
grep
'Options$'
-A
100
\
|
sed
'1 d'
\
|
sed
-e
's/[[:blank:]]*$//'
\
)
opt_sep
=()
opt_hunk
=(
${
(f)opt_hunk
}
)
opt_num
=
0
for
line
in
"
$opt_hunk
[@]"
;
do
opt
=
$(
echo
-E
"
$line
"
|
sed
-e
's/^[[:blank:]]*//'
)
if
[[
$line
==
$opt
]]
;
then
break
fi
if
[[
$opt
!=
${
opt
#-
}
]]
;
then
# Start with -
((
opt_num++
))
opt
=
$(
echo
-E
"
$opt
"
|
sed
's/^\(\(--[^ ]*\)\(, \(-[^ ]*\)\)*\) */\2\\t\4\\\t/'
)
fi
opt_sep[
$opt_num
]=(
"
${
opt_sep
[
$opt_num
]
}${
opt
}
"
)
done
for
line
in
"
$opt_sep
[@]"
;
do
opt
=(
${
(s
:
\t
:
)line
}
)
if
[[
${
opt
[1]
}
==
'--help'
]]
;
then
continue
fi
if
[[
${#
opt
}
-eq
2
]]
;
then
echo
-E
"(
${
opt
[1]
}
)
${
opt
[1]
}
[
${
opt
[2]
}
]"
else
echo
-E
"(
${
opt
[1]
}
,
${
opt
[2]
}
)
${
opt
[1]
}
[
${
opt
[3]
}
]"
echo
-E
"(
${
opt
[1]
}
,
${
opt
[2]
}
)
${
opt
[2]
}
[
${
opt
[3]
}
]"
fi
done
}
function
__grunt_get_gruntfile
()
{
local
gruntfile
local
curpath
=
"
$PWD
"
while
[
"
$curpath
"
]
;
do
for
gruntfile
in
"
$curpath
/"
{
G,g
}
runtfile.
{
js,coffee
}
;
do
if
[[
-e
"
$gruntfile
"
]]
;
then
echo
"
$gruntfile
"
return
fi
done
curpath
=
${
curpath
%/*
}
done
return
1
}
function
__grunt_caching_policy
()
{
# Returns status zero if the completions cache needs rebuilding.
# Rebuild if .agignore more recent than cache.
if
[[
-f
$__grunt_gruntfile
&&
$__grunt_gruntfile
-nt
$1
]]
;
then
# Invalid cache because gruntfile is old.
return
0
fi
local
-a
oldp
local
expire
zstyle
-s
":completion:
${
curcontext
}
:options:"
expire expire
||
expire
=
7
# Rebuild if cache is more than $expire days.
oldp
=(
"
$1
"
(
Nm+
$expire
)
)
((
$#oldp
))
}
compdef __grunt grunt
\ No newline at end of file
Prev
1
2
3
4
5
6
7
8
9
…
12
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment