1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-12-19 02:41:57 +00:00

Merge branch 'master' of github.com:robbyrussell/oh-my-zsh

This commit is contained in:
Robby Russell 2016-09-24 16:36:50 -07:00
commit a21d57a170
15 changed files with 218 additions and 45 deletions

View file

@ -1,4 +1,7 @@
# fixme - the load process here seems a bit bizarre # fixme - the load process here seems a bit bizarre
zmodload -i zsh/complist
WORDCHARS=''
unsetopt menu_complete # do not autoselect the first completion entry unsetopt menu_complete # do not autoselect the first completion entry
unsetopt flowcontrol unsetopt flowcontrol
@ -6,32 +9,26 @@ setopt auto_menu # show completion menu on succesive tab press
setopt complete_in_word setopt complete_in_word
setopt always_to_end setopt always_to_end
WORDCHARS=''
zmodload -i zsh/complist
## case-insensitive (all),partial-word and then substring completion
if [ "x$CASE_SENSITIVE" = "xtrue" ]; then
zstyle ':completion:*' matcher-list 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
unset CASE_SENSITIVE
else
if [ "x$HYPHEN_INSENSITIVE" = "xtrue" ]; then
zstyle ':completion:*' matcher-list 'm:{a-zA-Z-_}={A-Za-z_-}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
unset HYPHEN_INSENSITIVE
else
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
fi
fi
zstyle ':completion:*' list-colors ''
# should this be in keybindings? # should this be in keybindings?
bindkey -M menuselect '^o' accept-and-infer-next-history bindkey -M menuselect '^o' accept-and-infer-next-history
zstyle ':completion:*:*:*:*:*' menu select zstyle ':completion:*:*:*:*:*' menu select
# case insensitive (all), partial-word and substring completion
if [[ "$CASE_SENSITIVE" = true ]]; then
zstyle ':completion:*' matcher-list 'r:|=*' 'l:|=* r:|=*'
else
if [[ "$HYPHEN_INSENSITIVE" = true ]]; then
zstyle ':completion:*' matcher-list 'm:{a-zA-Z-_}={A-Za-z_-}' 'r:|=*' 'l:|=* r:|=*'
else
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*'
fi
fi
unset CASE_SENSITIVE HYPHEN_INSENSITIVE
zstyle ':completion:*' list-colors ''
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01' zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
if [ "$OSTYPE[0,7]" = "solaris" ]
then if [[ "$OSTYPE" = solaris* ]]; then
zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm" zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm"
else else
zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm -w -w" zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm -w -w"

View file

@ -0,0 +1,11 @@
# `copybuffer` plugin
This plugin binds the ctrl-o keyboard shortcut to a command that copies the text
that is currently typed in the command line ($BUFFER) to the system clipboard.
This is useful if you type a command - and before you hit enter to execute it - want
to copy it maybe so you can paste it into a script, gist or whatnot.
```zsh
plugins=(... copybuffer)
```

View file

@ -0,0 +1,14 @@
# copy the active line from the command line buffer
# onto the system clipboard (requires clipcopy plugin)
copybuffer () {
if which clipcopy &>/dev/null; then
echo $BUFFER | clipcopy
else
echo "clipcopy function not found. Please make sure you have Oh My Zsh installed correctly."
fi
}
zle -N copybuffer
bindkey "^O" copybuffer

View file

@ -228,7 +228,7 @@ __docker_get_log_options() {
journald_options=("env" "labels" "tag") journald_options=("env" "labels" "tag")
json_file_options=("env" "labels" "max-file" "max-size") json_file_options=("env" "labels" "max-file" "max-size")
syslog_options=("env" "labels" "syslog-address" "syslog-facility" "syslog-format" "syslog-tls-ca-cert" "syslog-tls-cert" "syslog-tls-key" "syslog-tls-skip-verify" "tag") syslog_options=("env" "labels" "syslog-address" "syslog-facility" "syslog-format" "syslog-tls-ca-cert" "syslog-tls-cert" "syslog-tls-key" "syslog-tls-skip-verify" "tag")
splunk_options=("env" "labels" "splunk-caname" "splunk-capath" "splunk-format" "splunk-index" "splunk-insecureskipverify" "splunk-source" "splunk-sourcetype" "splunk-token" "splunk-url" "splunk-verify-connection" "tag") splunk_options=("env" "labels" "splunk-caname" "splunk-capath" "splunk-format" "splunk-gzip" "splunk-gzip-level" "splunk-index" "splunk-insecureskipverify" "splunk-source" "splunk-sourcetype" "splunk-token" "splunk-url" "splunk-verify-connection" "tag")
[[ $log_driver = (awslogs|all) ]] && _describe -t awslogs-options "awslogs options" awslogs_options "$@" && ret=0 [[ $log_driver = (awslogs|all) ]] && _describe -t awslogs-options "awslogs options" awslogs_options "$@" && ret=0
[[ $log_driver = (fluentd|all) ]] && _describe -t fluentd-options "fluentd options" fluentd_options "$@" && ret=0 [[ $log_driver = (fluentd|all) ]] && _describe -t fluentd-options "fluentd options" fluentd_options "$@" && ret=0
@ -434,7 +434,7 @@ __docker_complete_events_filter() {
(event) (event)
local -a event_opts local -a event_opts
event_opts=('attach' 'commit' 'connect' 'copy' 'create' 'delete' 'destroy' 'detach' 'die' 'disconnect' 'exec_create' 'exec_detach' event_opts=('attach' 'commit' 'connect' 'copy' 'create' 'delete' 'destroy' 'detach' 'die' 'disconnect' 'exec_create' 'exec_detach'
'exec_start' 'export' 'import' 'kill' 'load' 'mount' 'oom' 'pause' 'pull' 'push' 'reload' 'rename' 'resize' 'restart' 'save' 'start' 'exec_start' 'export' 'health_status' 'import' 'kill' 'load' 'mount' 'oom' 'pause' 'pull' 'push' 'reload' 'rename' 'resize' 'restart' 'save' 'start'
'stop' 'tag' 'top' 'unmount' 'unpause' 'untag' 'update') 'stop' 'tag' 'top' 'unmount' 'unpause' 'untag' 'update')
_describe -t event-filter-opts "event filter options" event_opts && ret=0 _describe -t event-filter-opts "event filter options" event_opts && ret=0
;; ;;
@ -792,7 +792,7 @@ __docker_node_commands() {
"ls:List nodes in the swarm" "ls:List nodes in the swarm"
"promote:Promote a node as manager in the swarm" "promote:Promote a node as manager in the swarm"
"rm:Remove one or more nodes from the swarm" "rm:Remove one or more nodes from the swarm"
"ps:List tasks running on a node" "ps:List tasks running on a node, defaults to current node"
"update:Update a node" "update:Update a node"
) )
_describe -t docker-node-commands "docker node command" _docker_node_subcommands _describe -t docker-node-commands "docker node command" _docker_node_subcommands
@ -1083,6 +1083,7 @@ __docker_service_subcommand() {
"($help)*--constraint=[Placement constraints]:constraint: " "($help)*--constraint=[Placement constraints]:constraint: "
"($help)--endpoint-mode=[Placement constraints]:mode:(dnsrr vip)" "($help)--endpoint-mode=[Placement constraints]:mode:(dnsrr vip)"
"($help)*"{-e=,--env=}"[Set environment variables]:env: " "($help)*"{-e=,--env=}"[Set environment variables]:env: "
"($help)*--group-add=[Add additional user groups to the container]:group:_groups"
"($help)*--label=[Service labels]:label: " "($help)*--label=[Service labels]:label: "
"($help)--limit-cpu=[Limit CPUs]:value: " "($help)--limit-cpu=[Limit CPUs]:value: "
"($help)--limit-memory=[Limit Memory]:value: " "($help)--limit-memory=[Limit Memory]:value: "
@ -1177,6 +1178,7 @@ __docker_service_subcommand() {
"($help)--arg=[Service command args]:arguments: _normal" \ "($help)--arg=[Service command args]:arguments: _normal" \
"($help)*--container-label-add=[Add or update container labels]:label: " \ "($help)*--container-label-add=[Add or update container labels]:label: " \
"($help)*--container-label-rm=[Remove a container label by its key]:label: " \ "($help)*--container-label-rm=[Remove a container label by its key]:label: " \
"($help)*--group-rm=[Remove previously added user groups from the container]:group:_groups" \
"($help)--image=[Service image tag]:image:__docker_repositories" \ "($help)--image=[Service image tag]:image:__docker_repositories" \
"($help -)1:service:__docker_complete_services" && ret=0 "($help -)1:service:__docker_complete_services" && ret=0
;; ;;
@ -1658,7 +1660,8 @@ __docker_subcommand() {
$opts_help \ $opts_help \
"($help)*"{-f=,--filter=}"[Filter values]:filter:__docker_complete_events_filter" \ "($help)*"{-f=,--filter=}"[Filter values]:filter:__docker_complete_events_filter" \
"($help)--since=[Events created since this timestamp]:timestamp: " \ "($help)--since=[Events created since this timestamp]:timestamp: " \
"($help)--until=[Events created until this timestamp]:timestamp: " && ret=0 "($help)--until=[Events created until this timestamp]:timestamp: " \
"($help)--format=[Format the output using the given go template]:template: " && ret=0
;; ;;
(exec) (exec)
local state local state
@ -1701,7 +1704,7 @@ __docker_subcommand() {
"($help -a --all)"{-a,--all}"[Show all images]" \ "($help -a --all)"{-a,--all}"[Show all images]" \
"($help)--digests[Show digests]" \ "($help)--digests[Show digests]" \
"($help)*"{-f=,--filter=}"[Filter values]:filter:->filter-options" \ "($help)*"{-f=,--filter=}"[Filter values]:filter:->filter-options" \
"($help)--format[Pretty-print containers using a Go template]:template: " \ "($help)--format[Pretty-print images using a Go template]:template: " \
"($help)--no-trunc[Do not truncate output]" \ "($help)--no-trunc[Do not truncate output]" \
"($help -q --quiet)"{-q,--quiet}"[Only show numeric IDs]" \ "($help -q --quiet)"{-q,--quiet}"[Only show numeric IDs]" \
"($help -): :__docker_repositories" && ret=0 "($help -): :__docker_repositories" && ret=0

View file

@ -46,6 +46,7 @@ alias gapa='git add --patch'
alias gb='git branch' alias gb='git branch'
alias gba='git branch -a' alias gba='git branch -a'
alias gbd='git branch -d'
alias gbda='git branch --no-color --merged | command grep -vE "^(\*|\s*(master|develop|dev)\s*$)" | command xargs -n 1 git branch -d' alias gbda='git branch --no-color --merged | command grep -vE "^(\*|\s*(master|develop|dev)\s*$)" | command xargs -n 1 git branch -d'
alias gbl='git blame -b -w' alias gbl='git blame -b -w'
alias gbnm='git branch --no-merged' alias gbnm='git branch --no-merged'

View file

@ -172,7 +172,7 @@ function listMavenCompletions {
gwt:browser gwt:clean gwt:compile gwt:compile-report gwt:css gwt:debug gwt:eclipse gwt:eclipseTest gwt:generateAsync gwt:help gwt:i18n gwt:mergewebxml gwt:resources gwt:run gwt:sdkInstall gwt:source-jar gwt:soyc gwt:test gwt:browser gwt:clean gwt:compile gwt:compile-report gwt:css gwt:debug gwt:eclipse gwt:eclipseTest gwt:generateAsync gwt:help gwt:i18n gwt:mergewebxml gwt:resources gwt:run gwt:sdkInstall gwt:source-jar gwt:soyc gwt:test
# options # options
-Dmaven.test.skip=true -DskipTests -DskipITs -Dmaven.surefire.debug -DenableCiProfile -Dpmd.skip=true -Dcheckstyle.skip=true -Dtycho.mode=maven -Dmaven.test.failure.ignore=true -Dmaven.test.skip=true -DskipTests -DskipITs -Dmaven.surefire.debug -DenableCiProfile -Dpmd.skip=true -Dcheckstyle.skip=true -Dtycho.mode=maven -Dmaven.test.failure.ignore=true -DgroupId= -DartifactId= -Dversion= -Dpackaging=jar -Dfile=
# arguments # arguments
-am -amd -B -C -c -cpu -D -e -emp -ep -f -fae -ff -fn -gs -h -l -N -npr -npu -nsu -o -P -pl -q -rf -s -T -t -U -up -V -v -X -am -amd -B -C -c -cpu -D -e -emp -ep -f -fae -ff -fn -gs -h -l -N -npr -npu -nsu -o -P -pl -q -rf -s -T -t -U -up -V -v -X

37
plugins/ng/README.md Normal file
View file

@ -0,0 +1,37 @@
## NG Plugin
This [ng plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/ng)
adds completion support for Angular's CLI (named ng).
Ng is hosted on [ng home](https://github.com/catull/angular-cli)
It is used to generate Angular 2 app "stubs", build those apps, configure them,
test them, lint them etc.
Ahem, "stubs" is not what Angular engineers refer to the items ng can generate
for you.
"Stubs" can be any one of:
- class
- component
- directive
- enum
- module
- pipe
- route
- service
At the moment, `ng completion` creates a very rough completion for Zsh and
Bash.
It is missing most of the options and a few arguments.
In future, this plugin may be shortened to simply being
```zsh
eval `ng completion`
```
There is hope this materialises in the 21st century.
### CONTRIBUTOR
- Carlo Dapor ([catull](https://github.com/catull))

77
plugins/ng/ng.plugin.zsh Normal file
View file

@ -0,0 +1,77 @@
ng_opts='addon asset-sizes b build completion d destroy doc e2e g generate get github-pages:deploy gh-pages:deploy h help i init install lint make-this-awesome new s serve server set t test v version -h --help'
_ng_completion () {
local words cword opts
read -Ac words
read -cn cword
let cword-=1
case $words[cword] in
addon )
opts='-b --blueprint -d -dir --directory --dry-run -sb --skip-bower -sg --skip-git -sn --skip-npm -v --verbose'
;;
asset-sizes )
opts='-o --output-path'
;;
b | build )
opts='--environment --output-path --suppress-sizes --target --watch --watcher -dev -e -prod'
;;
d | destroy )
opts='--dry-run --verbose --pod --classic --dummy --in-repo --in-repo-addon -d -v -p -c -dum -id -ir'
;;
g | generate )
opts='class component directive enum module pipe route service --generate -d --dry-run --verbose -v --pod -p --classic -c --dummy -dum -id --in-repo --in-repo-addon -ir'
;;
gh-pages:deploy | github-pages:deploy )
opts='--environment --gh-token --gh-username --skip-build --user-page --message'
;;
h | help | -h | --help)
opts='--json --verbose -v'
;;
init )
opts='--blueprint --dry-run --link-cli --mobile --name --prefix --skip-bower --skip-npm --source-dir --style --verbose -b -d -lc -n -p -sb -sd -sn -v'
;;
new )
opts='--blueprint --directory --dry-run --link-cli --mobile --prefix --skip-bower --skip-git --skip-npm --source-dir --style --verbose -b -d -dir -lc -p -sb -sd -sg -sn -v'
;;
s | serve | server )
opts='--environment --host --insecure-proxy --inspr --live-reload --live-reload-base-url --live-reload-host --live-reload-live-css --live-reload-port --output-path --port --proxy --ssl --ssl-cert --ssl-key --target --watcher -H -dev -e -lr -lrbu -lrh -lrp -op -out -p -pr -prod -pxy -t -w'
;;
set )
opts='--global -g'
;;
t | test )
opts='--browsers --colors --config-file --environment --filter --host --launch --log-level --module --path --port --query --reporter --server --silent --test-page --test-port --watch -H -c -cf -e -f -m -r -s -tp -w'
;;
v | version )
opts='--verbose'
;;
ng )
opts=$ng_opts
;;
* )
opts=''
;;
esac
setopt shwordsplit
reply=($opts)
unset shwordsplit
}
compctl -K _ng_completion ng

View file

@ -32,6 +32,12 @@ alias npmE='PATH="$(npm bin)":"$PATH"'
# Check which npm modules are outdated # Check which npm modules are outdated
alias npmO="npm outdated" alias npmO="npm outdated"
# Check package versions
alias npmV="npm -v"
# List packages
alias npmL="npm list"
# Run npm start # Run npm start
alias npmst="npm start" alias npmst="npm start"

View file

@ -6,10 +6,10 @@
### Aliases ### Aliases
# Set all files' permissions to 644 recursively in a directory # Set all files' permissions to 644 recursively in a directory
alias set644='find . -type f -print0 | xargs -0 chmod 644' alias set644='find . -type f ! -perm 644 -print0 | xargs -0 chmod 644'
# Set all directories' permissions to 755 recursively in a directory # Set all directories' permissions to 755 recursively in a directory
alias set755='find . -type d -print0 | xargs -0 chmod 755' alias set755='find . -type d ! -perm 755 -print0 | xargs -0 chmod 755'
### Functions ### Functions
@ -63,14 +63,14 @@ EOF
exit_status=0; exit_status=0;
if [[ $use_slow == true ]]; then if [[ $use_slow == true ]]; then
# Process directories first so non-traversable ones are fixed as we go # Process directories first so non-traversable ones are fixed as we go
find "$target" -type d -exec chmod $chmod_opts 755 {} \; find "$target" -type d ! -perm 755 -exec chmod $chmod_opts 755 {} \;
if [[ $? != 0 ]]; then exit_status=$?; fi if [[ $? != 0 ]]; then exit_status=$?; fi
find "$target" -type f -exec chmod $chmod_opts 644 {} \; find "$target" -type f ! -perm 644 -exec chmod $chmod_opts 644 {} \;
if [[ $? != 0 ]]; then exit_status=$?; fi if [[ $? != 0 ]]; then exit_status=$?; fi
else else
find "$target" -type d -print0 | xargs -0 chmod $chmod_opts 755 find "$target" -type d ! -perm 755 -print0 | xargs -0 chmod $chmod_opts 755
if [[ $? != 0 ]]; then exit_status=$?; fi if [[ $? != 0 ]]; then exit_status=$?; fi
find "$target" -type f -print0 | xargs -0 chmod $chmod_opts 644 find "$target" -type f ! -perm 644 -print0 | xargs -0 chmod $chmod_opts 644
if [[ $? != 0 ]]; then exit_status=$?; fi if [[ $? != 0 ]]; then exit_status=$?; fi
fi fi
echo "Complete" echo "Complete"

View file

@ -36,6 +36,7 @@ alias -g RET='RAILS_ENV=test'
# Rails aliases # Rails aliases
alias rc='rails console' alias rc='rails console'
alias rcs='rails console --sandbox'
alias rd='rails destroy' alias rd='rails destroy'
alias rdb='rails dbconsole' alias rdb='rails dbconsole'
alias rg='rails generate' alias rg='rails generate'

View file

@ -26,7 +26,7 @@ plugins=(... xcode)
### `xc` ### `xc`
Opens the current directory in Xcode as an Xcode project. This will open one of the `.xcworkspace` and `.xcodeproj` files that it can find in the current working directory. Opens the current directory in Xcode as an Xcode project. This will open one of the `.xcworkspace` and `.xcodeproj` files that it can find in the current working directory. You can also specify a directory to look in for the Xcode files.
Returns 1 if it didn't find any relevant files. Returns 1 if it didn't find any relevant files.
### `simulator` ### `simulator`

View file

@ -7,10 +7,19 @@ alias xcsel='sudo xcode-select --switch'
# source: http://gist.github.com/subdigital/5420709 # source: http://gist.github.com/subdigital/5420709
function xc { function xc {
local xcode_proj local xcode_proj
if [[ $# == 0 ]]; then
xcode_proj=(*.{xcworkspace,xcodeproj}(N)) xcode_proj=(*.{xcworkspace,xcodeproj}(N))
else
xcode_proj=($1/*.{xcworkspace,xcodeproj}(N))
fi
if [[ ${#xcode_proj} -eq 0 ]]; then if [[ ${#xcode_proj} -eq 0 ]]; then
if [[ $# == 0 ]]; then
echo "No xcworkspace/xcodeproj file found in the current directory." echo "No xcworkspace/xcodeproj file found in the current directory."
else
echo "No xcworkspace/xcodeproj file found in $1."
fi
return 1 return 1
else else
echo "Found ${xcode_proj[1]}" echo "Found ${xcode_proj[1]}"

View file

@ -86,7 +86,7 @@ prompt_context() {
# Git: branch/detached head, dirty status # Git: branch/detached head, dirty status
prompt_git() { prompt_git() {
(( $+commands[git] )) || return
local PL_BRANCH_CHAR local PL_BRANCH_CHAR
() { () {
local LC_ALL="" LC_CTYPE="en_US.UTF-8" local LC_ALL="" LC_CTYPE="en_US.UTF-8"
@ -127,6 +127,28 @@ prompt_git() {
fi fi
} }
prompt_bzr() {
(( $+commands[bzr] )) || return
if (bzr status >/dev/null 2>&1); then
status_mod=`bzr status | head -n1 | grep "modified" | wc -m`
status_all=`bzr status | head -n1 | wc -m`
revision=`bzr log | head -n2 | tail -n1 | sed 's/^revno: //'`
if [[ $status_mod -gt 0 ]] ; then
prompt_segment yellow black
echo -n "bzr@"$revision "✚ "
else
if [[ $status_all -gt 0 ]] ; then
prompt_segment yellow black
echo -n "bzr@"$revision
else
prompt_segment green black
echo -n "bzr@"$revision
fi
fi
fi
}
prompt_hg() { prompt_hg() {
(( $+commands[hg] )) || return (( $+commands[hg] )) || return
local rev status local rev status
@ -198,6 +220,7 @@ build_prompt() {
prompt_context prompt_context
prompt_dir prompt_dir
prompt_git prompt_git
prompt_bzr
prompt_hg prompt_hg
prompt_end prompt_end
} }

View file

@ -41,10 +41,4 @@ PROMPT='
%~ %~
${smiley} %{$reset_color%}' ${smiley} %{$reset_color%}'
if [[ -d ~/.rvm ]] && [[ -e ~/.rvm/bin/rvm-prompt ]]; then RPROMPT='%{$fg[white]%} $(ruby_prompt_info)$(git_prompt)%{$reset_color%}'
rvm_prompt='$(~/.rvm/bin/rvm-prompt)'
else
rvm_prompt=''
fi
RPROMPT='%{$fg[white]%} $rvm_prompt$(git_prompt)%{$reset_color%}'