summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.editorconfig10
-rw-r--r--.github/ISSUE_TEMPLATE/bug_report.md38
-rw-r--r--.github/ISSUE_TEMPLATE/feature_request.md26
-rw-r--r--.github/ISSUE_TEMPLATE/support.md12
-rw-r--r--.gitignore3
-rw-r--r--CONTRIBUTING.md10
-rw-r--r--LICENSE.txt5
-rw-r--r--README.md98
-rw-r--r--lib/directories.zsh10
-rw-r--r--lib/functions.zsh9
-rw-r--r--lib/git.zsh42
-rw-r--r--lib/history.zsh4
-rw-r--r--lib/misc.zsh13
-rw-r--r--lib/prompt_info_functions.zsh19
-rw-r--r--lib/termsupport.zsh7
-rw-r--r--lib/theme-and-appearance.zsh7
-rw-r--r--oh-my-zsh.sh19
-rw-r--r--plugins/alias-finder/README.md46
-rw-r--r--plugins/alias-finder/alias-finder.plugin.zsh47
-rw-r--r--plugins/arcanist/README.md2
-rw-r--r--plugins/archlinux/README.md2
-rw-r--r--plugins/autoenv/README.md14
-rw-r--r--plugins/autojump/autojump.plugin.zsh53
-rw-r--r--plugins/aws/README.md2
-rw-r--r--plugins/aws/aws.plugin.zsh62
-rw-r--r--plugins/battery/battery.plugin.zsh49
-rw-r--r--plugins/bundler/README.md6
-rw-r--r--plugins/bundler/bundler.plugin.zsh5
-rw-r--r--plugins/bwana/README.md9
-rw-r--r--plugins/bwana/bwana.plugin.zsh13
-rw-r--r--plugins/cakephp3/README.md16
-rw-r--r--plugins/cargo/_cargo853
-rw-r--r--plugins/catimg/README.md4
-rw-r--r--plugins/catimg/catimg.plugin.zsh2
-rw-r--r--plugins/catimg/catimg.sh2
-rw-r--r--plugins/chruby/README.md20
-rw-r--r--plugins/cloudapp/README.md24
-rw-r--r--plugins/cloudapp/cloudapp.plugin.zsh8
-rw-r--r--plugins/colemak/README.md48
-rw-r--r--plugins/colored-man-pages/README.md15
-rw-r--r--plugins/colored-man-pages/colored-man-pages.plugin.zsh8
-rw-r--r--plugins/colorize/README.md29
-rw-r--r--plugins/colorize/colorize.plugin.zsh37
-rw-r--r--plugins/common-aliases/README.md121
-rw-r--r--plugins/compleat/README.md8
-rw-r--r--plugins/dash/README.md28
-rw-r--r--plugins/dash/dash.plugin.zsh52
-rw-r--r--plugins/debian/README.md114
-rw-r--r--plugins/debian/debian.plugin.zsh116
-rw-r--r--plugins/dircycle/README.md4
-rw-r--r--plugins/dirhistory/dirhistory.plugin.zsh3
-rw-r--r--plugins/dirpersist/dirpersist.plugin.zsh3
-rw-r--r--plugins/django/django.plugin.zsh5
-rw-r--r--plugins/dnote/README.md51
-rw-r--r--plugins/dnote/_dnote39
-rw-r--r--plugins/docker-compose/_docker-compose168
-rw-r--r--plugins/docker/README.md14
-rw-r--r--plugins/dotenv/README.md11
-rw-r--r--plugins/dotenv/dotenv.plugin.zsh12
-rw-r--r--plugins/eecms/README.md11
-rwxr-xr-xplugins/emacs/emacsclient.sh3
-rw-r--r--plugins/emoji-clock/emoji-clock.plugin.zsh2
-rw-r--r--plugins/emotty/README.md39
-rw-r--r--plugins/emotty/emotty.plugin.zsh10
-rw-r--r--plugins/encode64/README.md4
-rw-r--r--plugins/extract/README.md5
-rw-r--r--plugins/extract/_extract2
-rw-r--r--plugins/extract/extract.plugin.zsh9
-rw-r--r--plugins/fabric/_fab19
-rw-r--r--plugins/fasd/README.md21
-rw-r--r--plugins/fasd/fasd.plugin.zsh2
-rw-r--r--plugins/fbterm/README.md9
-rw-r--r--plugins/fedora/README.md2
-rw-r--r--plugins/flutter/README.md21
-rw-r--r--plugins/flutter/_flutter37
-rw-r--r--plugins/flutter/flutter.plugin.zsh7
-rw-r--r--plugins/frontend-search/README.md79
-rw-r--r--plugins/frontend-search/_frontend-search.sh61
-rw-r--r--plugins/frontend-search/frontend-search.plugin.zsh57
-rw-r--r--plugins/fzf/fzf.plugin.zsh156
-rw-r--r--plugins/gatsby/README.md7
-rw-r--r--plugins/gatsby/_gatsby24
-rw-r--r--plugins/gcloud/README.md24
-rw-r--r--plugins/gcloud/gcloud.plugin.zsh33
-rw-r--r--plugins/git-auto-fetch/git-auto-fetch.plugin.zsh31
-rw-r--r--plugins/git-escape-magic/README.md16
-rw-r--r--plugins/git-escape-magic/git-escape-magic135
-rw-r--r--plugins/git-escape-magic/git-escape-magic.plugin.zsh9
-rw-r--r--plugins/git-extras/git-extras.plugin.zsh4
-rw-r--r--plugins/git-hubflow/git-hubflow.plugin.zsh12
-rw-r--r--plugins/git-prompt/README.md61
-rw-r--r--plugins/git-prompt/git-prompt.plugin.zsh10
-rw-r--r--plugins/git-prompt/gitstatus.py3
-rw-r--r--plugins/git-remote-branch/README.md14
-rw-r--r--plugins/git/README.md216
-rw-r--r--plugins/git/git.plugin.zsh63
-rw-r--r--plugins/gitfast/README.md129
-rw-r--r--plugins/gitfast/_git30
-rw-r--r--plugins/gitfast/git-completion.bash2057
-rw-r--r--plugins/gitfast/git-prompt.sh28
-rw-r--r--plugins/gitfast/gitfast.plugin.zsh4
-rwxr-xr-xplugins/gitfast/update9
-rw-r--r--plugins/gitfast/updates.patch56
-rw-r--r--plugins/github/_hub11
-rw-r--r--plugins/go/README.md2
-rw-r--r--plugins/golang/README.md1
-rw-r--r--plugins/gradle/gradle.plugin.zsh1
-rw-r--r--plugins/gulp/gulp.plugin.zsh6
-rw-r--r--plugins/history-substring-search/README.md2
-rw-r--r--plugins/homestead/homestead.plugin.zsh2
-rw-r--r--plugins/httpie/README.md17
-rw-r--r--plugins/httpie/_httpie181
-rw-r--r--plugins/httpie/httpie.plugin.zsh33
-rw-r--r--plugins/iwhois/README.md24
-rw-r--r--plugins/iwhois/iwhois.plugin.zsh5
-rw-r--r--plugins/jenv/jenv.plugin.zsh2
-rw-r--r--plugins/jira/README.md1
-rw-r--r--plugins/jira/jira.plugin.zsh5
-rw-r--r--plugins/jruby/README.md21
-rw-r--r--plugins/jsontools/jsontools.plugin.zsh13
-rw-r--r--plugins/keychain/keychain.plugin.zsh2
-rw-r--r--plugins/kube-ps1/README.md29
-rw-r--r--plugins/kube-ps1/kube-ps1.plugin.zsh28
-rw-r--r--plugins/kubectl/README.md16
-rw-r--r--plugins/kubectl/kubectl.plugin.zsh21
-rw-r--r--plugins/last-working-dir/last-working-dir.plugin.zsh3
-rw-r--r--plugins/lein/README.md9
-rw-r--r--plugins/lol/README.md4
-rw-r--r--plugins/lol/lol.plugin.zsh2
-rw-r--r--plugins/magic-enter/Readme.md17
-rw-r--r--plugins/meteor/README.md2
-rw-r--r--plugins/mvn/README.md2
-rw-r--r--plugins/mvn/mvn.plugin.zsh2
-rw-r--r--plugins/mysql-macports/README.md20
-rw-r--r--plugins/n98-magerun/README.md21
-rw-r--r--plugins/n98-magerun/n98-magerun.plugin.zsh14
-rw-r--r--plugins/ng/README.md2
-rw-r--r--plugins/ng/ng.plugin.zsh5
-rw-r--r--plugins/nvm/nvm.plugin.zsh7
-rw-r--r--plugins/oc/README.md13
-rw-r--r--plugins/osx/README.md37
-rw-r--r--plugins/osx/osx.plugin.zsh97
-rw-r--r--plugins/osx/spotify64
-rw-r--r--plugins/pass/README.md22
-rw-r--r--plugins/per-directory-history/README.md71
-rw-r--r--plugins/percol/README.md4
-rw-r--r--plugins/perl/README.md37
-rw-r--r--plugins/phing/README.md8
-rw-r--r--plugins/pip/README.md19
-rw-r--r--plugins/pip/pip.plugin.zsh5
-rw-r--r--plugins/pipenv/README.md28
-rw-r--r--plugins/pipenv/pipenv.plugin.zsh43
-rw-r--r--plugins/please/README.md26
-rw-r--r--plugins/please/please.plugin.zsh7
-rw-r--r--plugins/pod/README.md10
-rw-r--r--plugins/pow/README.md21
-rw-r--r--plugins/powder/README.md8
-rw-r--r--plugins/powify/README.md10
-rw-r--r--plugins/profiles/README.md25
-rw-r--r--plugins/pyenv/README.md16
-rw-r--r--plugins/pyenv/pyenv.plugin.zsh2
-rw-r--r--plugins/python/python.plugin.zsh9
-rw-r--r--plugins/rails/README.md83
-rw-r--r--plugins/rails/rails.plugin.zsh4
-rw-r--r--plugins/rake/README.md37
-rw-r--r--plugins/rbenv/README.md26
-rw-r--r--plugins/rbenv/rbenv.plugin.zsh87
-rw-r--r--plugins/react-native/README.md61
-rw-r--r--plugins/react-native/react-native.plugin.zsh48
-rw-r--r--plugins/rebar/README.md9
-rw-r--r--plugins/redis-cli/README.md15
-rw-r--r--plugins/ripgrep/README.md4
-rw-r--r--plugins/ripgrep/_ripgrep187
-rw-r--r--plugins/rust/README.md9
-rw-r--r--plugins/rvm/README.md19
-rw-r--r--plugins/safe-paste/README.md9
-rw-r--r--plugins/salt/_salt2
-rw-r--r--plugins/sbt/README.md10
-rw-r--r--plugins/sbt/_sbt20
-rw-r--r--plugins/sbt/sbt.plugin.zsh10
-rw-r--r--plugins/screen/README.md10
-rw-r--r--plugins/sdk/README.md8
-rw-r--r--plugins/sdk/sdk.plugin.zsh82
-rw-r--r--plugins/sfdx/README.md11
-rw-r--r--plugins/sfdx/_sfdx1110
-rw-r--r--plugins/singlechar/README.md118
-rw-r--r--plugins/singlechar/singlechar.plugin.zsh12
-rw-r--r--plugins/sprunge/README.md31
-rw-r--r--plugins/sprunge/sprunge.plugin.zsh86
-rw-r--r--plugins/ssh-agent/ssh-agent.plugin.zsh14
-rw-r--r--plugins/sublime/README.md38
-rw-r--r--plugins/sublime/sublime.plugin.zsh189
-rw-r--r--plugins/sudo/README.md4
-rw-r--r--plugins/sudo/sudo.plugin.zsh4
-rw-r--r--plugins/supervisor/README.md12
-rw-r--r--plugins/supervisor/_supervisorctl7
-rw-r--r--plugins/svn-fast-info/svn-fast-info.plugin.zsh49
-rw-r--r--plugins/swiftpm/README.md2
-rw-r--r--plugins/swiftpm/_swift225
-rw-r--r--plugins/terminalapp/terminalapp.plugin.zsh6
-rw-r--r--plugins/terminitor/README.md9
-rw-r--r--plugins/terraform/README.md11
-rw-r--r--plugins/terraform/_terraform95
-rw-r--r--plugins/thefuck/README.md2
-rw-r--r--plugins/thefuck/thefuck.plugin.zsh4
-rw-r--r--plugins/thor/README.md10
-rw-r--r--plugins/timer/timer.plugin.zsh5
-rw-r--r--plugins/tmux/README.md4
-rw-r--r--plugins/tmux/tmux.extra.conf2
-rw-r--r--plugins/tmux/tmux.plugin.zsh14
-rw-r--r--plugins/tmuxinator/_tmuxinator6
-rw-r--r--plugins/torrent/README.md13
-rw-r--r--plugins/tugboat/README.md12
-rw-r--r--plugins/ubuntu/README.md68
-rw-r--r--plugins/ubuntu/ubuntu.plugin.zsh99
-rw-r--r--plugins/ufw/README.md18
-rw-r--r--plugins/urltools/README.md8
-rw-r--r--plugins/urltools/urltools.plugin.zsh8
-rw-r--r--plugins/vault/README.md19
-rw-r--r--plugins/vi-mode/vi-mode.plugin.zsh24
-rw-r--r--plugins/virtualenvwrapper/README.md38
-rw-r--r--plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh15
-rw-r--r--plugins/vscode/README.md15
-rw-r--r--plugins/vscode/vscode.plugin.zsh31
-rw-r--r--plugins/wd/README.md6
-rw-r--r--plugins/wd/wd.plugin.zsh6
-rw-r--r--plugins/yarn/README.md6
-rw-r--r--plugins/yarn/_yarn32
-rw-r--r--plugins/yarn/yarn.plugin.zsh6
-rw-r--r--plugins/yii/README.md14
-rw-r--r--plugins/z/z.sh25
-rw-r--r--templates/zshrc.zsh-template11
-rw-r--r--themes/3den.zsh-theme2
-rw-r--r--themes/af-magic.zsh-theme12
-rw-r--r--themes/agnoster.zsh-theme1
-rw-r--r--themes/alanpeabody.zsh-theme14
-rw-r--r--themes/amuse.zsh-theme27
-rw-r--r--themes/bira.zsh-theme32
-rw-r--r--themes/crcandy.zsh-theme2
-rw-r--r--themes/crunch.zsh-theme10
-rw-r--r--themes/dallas.zsh-theme13
-rw-r--r--themes/evan.zsh-theme4
-rw-r--r--themes/fino-time.zsh-theme8
-rw-r--r--themes/fino.zsh-theme12
-rw-r--r--themes/fishy.zsh-theme2
-rw-r--r--themes/frontcube.zsh-theme5
-rw-r--r--themes/gallifrey.zsh-theme2
-rw-r--r--themes/gallois.zsh-theme4
-rw-r--r--themes/gnzh.zsh-theme12
-rw-r--r--themes/itchy.zsh-theme4
-rw-r--r--themes/jaischeema.zsh-theme10
l---------[-rw-r--r--]themes/macovsky-ruby.zsh-theme16
-rw-r--r--themes/macovsky.zsh-theme14
-rw-r--r--themes/mira.zsh-theme20
-rw-r--r--themes/pure.zsh-theme10
-rw-r--r--themes/pygmalion-virtualenv.zsh-theme5
-rw-r--r--themes/pygmalion.zsh-theme5
-rw-r--r--themes/refined.zsh-theme1
-rw-r--r--themes/robbyrussell.zsh-theme4
-rw-r--r--themes/simonoff.zsh-theme6
-rw-r--r--themes/sunrise.zsh-theme2
-rw-r--r--themes/suvash.zsh-theme15
-rw-r--r--themes/wedisagree.zsh-theme5
-rw-r--r--tools/check_for_upgrade.sh4
-rwxr-xr-xtools/install.sh389
-rw-r--r--tools/uninstall.sh32
-rw-r--r--tools/upgrade.sh20
267 files changed, 7894 insertions, 3227 deletions
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 000000000..aa18e0e5c
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,10 @@
+root = true
+
+[*]
+end_of_line = lf
+insert_final_newline = true
+charset = utf-8
+
+[*.sh]
+indent_size = 4
+indent_style = tab
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
new file mode 100644
index 000000000..076c35544
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -0,0 +1,38 @@
+---
+name: Bug report
+about: Create a report to help us improve
+
+---
+
+<!--
+Fill this out before posting. You can delete irrelevant sections, but
+an issue where no sections have been filled will be deleted without comment.
+-->
+
+**Describe the bug**
+<!-- A clear and concise description of what the bug is. -->
+
+**To Reproduce**
+<!--
+Steps to reproduce the behavior:
+1. Enable plugin '...'
+2. Run command '...', _or_ try to complete command '...', _etc._
+3. See error
+-->
+
+**Expected behavior**
+<!-- A clear and concise description of what you expected to happen. -->
+
+**Screenshots or recordings**
+<!--
+If applicable, add screenshots or record an asciinema session (https://asciinema.org/)
+to help explain your problem.
+-->
+
+**System:**
+ - OS: [e.g. macOS]
+ - Zsh version [e.g. 5.6]
+ - Terminal emulator [e.g. iTerm2]
+
+**Additional context**
+<!-- Add any other context about the problem here. -->
diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md
new file mode 100644
index 000000000..d9c324a55
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/feature_request.md
@@ -0,0 +1,26 @@
+---
+name: Feature request
+about: Suggest a feature for Oh My Zsh
+labels: 'Type: feature'
+
+---
+
+<!--
+Fill this out before posting. You can delete irrelevant sections, but
+an issue where no sections have been filled will be deleted without comment.
+-->
+
+**Is your feature request related to a particular plugin or theme? If so, specify it.**
+<!-- The name of the plugin or theme you'd like us to improve. -->
+
+**Is your feature request related to a problem? Please describe.**
+<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
+
+**Describe the solution you'd like**
+<!-- A clear and concise description of what you want to happen. -->
+
+**Describe alternatives you've considered**
+<!-- A clear and concise description of any alternative solutions or features you've considered. -->
+
+**Additional context**
+<!-- Add any other context or screenshots about the feature request here. -->
diff --git a/.github/ISSUE_TEMPLATE/support.md b/.github/ISSUE_TEMPLATE/support.md
new file mode 100644
index 000000000..3c69a7d5e
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/support.md
@@ -0,0 +1,12 @@
+---
+name: Support
+about: Request support for any problem you're having with Oh My Zsh
+labels: 'Type: support'
+
+---
+
+<!--
+1. Look for similar issues already posted (including closed ones)
+2. Include as much relevant information as possible
+3. Try to make sure the issue is due to Oh My Zsh
+-->
diff --git a/.gitignore b/.gitignore
index b2022081a..251c9dc9f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,8 +1,7 @@
# custom files
custom/
-!custom/plugins/example
-!custom/example.zsh
# temp files directories
cache/
log/
+*.swp
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index f575157c2..be67e93b0 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -31,7 +31,7 @@ your problem.
If you find one, comment on it so we can know there are more people experiencing it.
-If not, look at the [Troubleshooting](https://github.com/robbyrussell/oh-my-zsh/wiki/Troubleshooting)
+If not, look at the [Troubleshooting](https://github.com/ohmyzsh/ohmyzsh/wiki/Troubleshooting)
page for instructions on how to gather data to better debug your problem.
Then, you can go ahead and create an issue with as much detail as you can provide.
@@ -62,7 +62,7 @@ maintainers) by mentioning their GitHub handle (starting with `@`) in your messa
You should be familiar with the basics of
[contributing on GitHub](https://help.github.com/articles/using-pull-requests) and have a fork
-[properly set up](https://github.com/robbyrussell/oh-my-zsh/wiki/Contribution-Technical-Practices).
+[properly set up](https://github.com/ohmyzsh/ohmyzsh/wiki/Contribution-Technical-Practices).
You MUST always create PRs with _a dedicated branch_ based on the latest upstream tree.
@@ -85,7 +85,7 @@ maintainers) by mentioning their GitHub handle (starting with `@`) in your messa
### You have an addition
-Please [do not](https://github.com/robbyrussell/oh-my-zsh/wiki/Themes#dont-send-us-your-theme-for-now)
+Please [do not](https://github.com/ohmyzsh/ohmyzsh/wiki/Themes#dont-send-us-your-theme-for-now)
send themes for now.
Please be so kind as to [search](#use-the-search-luke) for any pending, merged or rejected Pull Requests
@@ -109,7 +109,7 @@ to help you check whether a similar contribution to yours already exists. Please
before making any contribution, it avoids duplicates and eases maintenance. Trust me,
that works 90% of the time.
-You can also take a look at the [FAQ](https://github.com/robbyrussell/oh-my-zsh/wiki/FAQ)
+You can also take a look at the [FAQ](https://github.com/ohmyzsh/ohmyzsh/wiki/FAQ)
to be sure your contribution has not already come up.
If all fails, your thing has probably not been reported yet, so you can go ahead
@@ -121,5 +121,5 @@ and [create an issue](#reporting-issues) or [submit a PR](#submitting-pull-reque
Very nice!! :)
-Please have a look at the [Volunteer](https://github.com/robbyrussell/oh-my-zsh/wiki/Volunteers)
+Please have a look at the [Volunteer](https://github.com/ohmyzsh/ohmyzsh/wiki/Volunteers)
page for instructions on where to start and more.
diff --git a/LICENSE.txt b/LICENSE.txt
index 4d465b1c3..7431907a6 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -1,7 +1,6 @@
-The MIT License (MIT)
+MIT License
-Copyright (c) 2009-2019 Robby Russell and contributors
-See the full list at https://github.com/robbyrussell/oh-my-zsh/contributors
+Copyright (c) 2009-2019 Robby Russell and contributors (https://github.com/ohmyzsh/ohmyzsh/contributors)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/README.md b/README.md
index dd330d19e..bfb42c0fd 100644
--- a/README.md
+++ b/README.md
@@ -2,11 +2,14 @@
<img src="https://s3.amazonaws.com/ohmyzsh/oh-my-zsh-logo.png" alt="Oh My Zsh">
</p>
+[![Discord server](https://img.shields.io/discord/642496866407284746)](https://discord.gg/bpXWhnN)
+[![Follow @ohmyzsh](https://img.shields.io/twitter/follow/ohmyzsh?label=Follow+@ohmyzsh&style=flat)](https://twitter.com/intent/follow?screen_name=ohmyzsh)
+
Oh My Zsh is an open source, community-driven framework for managing your [zsh](https://www.zsh.org/) configuration.
Sounds boring. Let's try again.
-__Oh My Zsh will not make you a 10x developer...but you might feel like one.__
+__Oh My Zsh will not make you a 10x developer...but you may feel like one.__
Once installed, your terminal shell will become the talk of the town _or your money back!_ With each keystroke in your command prompt, you'll take advantage of the hundreds of powerful plugins and beautiful themes. Strangers will come up to you in cafés and ask you, _"that is amazing! are you some sort of genius?"_
@@ -18,10 +21,8 @@ To learn more, visit [ohmyz.sh](https://ohmyz.sh) and follow [@ohmyzsh](https://
### Prerequisites
-__Disclaimer:__ _Oh My Zsh works best on macOS and Linux._
-
-* Unix-like operating system (macOS or Linux)
-* [Zsh](https://www.zsh.org) should be installed (v4.3.9 or more recent). If not pre-installed (`zsh --version` to confirm), check the following instruction here: [Installing ZSH](https://github.com/robbyrussell/oh-my-zsh/wiki/Installing-ZSH)
+* A Unix-like operating system: macOS, Linux, BSD. On Windows: WSL is preferred, but cygwin or msys also mostly work.
+* [Zsh](https://www.zsh.org) should be installed (v4.3.9 or more recent). If not pre-installed (run `zsh --version` to confirm), check the following instructions here: [Installing ZSH](https://github.com/ohmyzsh/ohmyzsh/wiki/Installing-ZSH)
* `curl` or `wget` should be installed
* `git` should be installed
@@ -32,20 +33,31 @@ Oh My Zsh is installed by running one of the following commands in your terminal
#### via curl
```shell
-sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
+sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
```
#### via wget
```shell
-sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
+sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
+```
+
+#### Manual inspection
+
+It's a good idea to inspect the install script from projects you don't yet know. You can do
+that by downloading the install script first, looking through it so everything looks normal,
+then running it:
+
+```shell
+curl -Lo install.sh https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh
+sh install.sh
```
## Using Oh My Zsh
### Plugins
-Oh My Zsh comes with a shitload of plugins to take advantage of. You can take a look in the [plugins](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins) directory and/or the [wiki](https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins) to see what's currently available.
+Oh My Zsh comes with a shitload of plugins to take advantage of. You can take a look in the [plugins](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins) directory and/or the [wiki](https://github.com/ohmyzsh/ohmyzsh/wiki/Plugins) to see what's currently available.
#### Enabling Plugins
@@ -69,13 +81,15 @@ plugins=(
)
```
+_Note that the plugins are separated by whitespace. **Do not** use commas between them._
+
#### Using Plugins
Most plugins (should! we're working on this) include a __README__, which documents how to use them.
### Themes
-We'll admit it. Early in the Oh My Zsh world, we may have gotten a bit too theme happy. We have over one hundred themes now bundled. Most of them have [screenshots](https://github.com/robbyrussell/oh-my-zsh/wiki/Themes) on the wiki. Check them out!
+We'll admit it. Early in the Oh My Zsh world, we may have gotten a bit too theme happy. We have over one hundred themes now bundled. Most of them have [screenshots](https://github.com/ohmyzsh/ohmyzsh/wiki/Themes) on the wiki. Check them out!
#### Selecting a Theme
@@ -91,7 +105,7 @@ To use a different theme, simply change the value to match the name of your desi
```shell
ZSH_THEME="agnoster" # (this is one of the fancy ones)
-# see https://github.com/robbyrussell/oh-my-zsh/wiki/Themes#agnoster
+# see https://github.com/ohmyzsh/ohmyzsh/wiki/Themes#agnoster
```
_Note: many themes require installing the [Powerline Fonts](https://github.com/powerline/fonts) in order to render properly._
@@ -100,7 +114,7 @@ Open up a new terminal window and your prompt should look something like this:
![Agnoster theme](https://cloud.githubusercontent.com/assets/2618447/6316862/70f58fb6-ba03-11e4-82c9-c083bf9a6574.png)
-In case you did not find a suitable theme for your needs, please have a look at the wiki for [more of them](https://github.com/robbyrussell/oh-my-zsh/wiki/External-themes).
+In case you did not find a suitable theme for your needs, please have a look at the wiki for [more of them](https://github.com/ohmyzsh/ohmyzsh/wiki/External-themes).
If you're feeling feisty, you can let the computer select one randomly for you each time you open a new terminal window.
@@ -118,22 +132,62 @@ ZSH_THEME_RANDOM_CANDIDATES=(
)
```
+### FAQ
+
+If you have some more questions or issues, you might find a solution in our [FAQ](https://github.com/ohmyzsh/ohmyzsh/wiki/FAQ).
+
## Advanced Topics
If you're the type that likes to get their hands dirty, these sections might resonate.
### Advanced Installation
-Some users may want to change the default path, or manually install Oh My Zsh.
+Some users may want to manually install Oh My Zsh, or change the default path or other settings that
+the installer accepts (these settings are also documented at the top of the install script).
#### Custom Directory
The default location is `~/.oh-my-zsh` (hidden in your home directory)
-If you'd like to change the install directory with the `ZSH` environment variable, either by running `export ZSH=/your/path` before installing, or by setting it before the end of the install pipeline like this:
+If you'd like to change the install directory with the `ZSH` environment variable, either by running
+`export ZSH=/your/path` before installing, or by setting it before the end of the install pipeline
+like this:
+
+```shell
+ZSH="$HOME/.dotfiles/oh-my-zsh" sh install.sh
+```
+
+#### Unattended install
+
+If you're running the Oh My Zsh install script as part of an automated install, you can pass the
+flag `--unattended` to the `install.sh` script. This will have the effect of not trying to change
+the default shell, and also won't run `zsh` when the installation has finished.
```shell
-export ZSH="$HOME/.dotfiles/oh-my-zsh"; sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
+sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
+```
+
+#### Installing from a forked repository
+
+The install script also accepts these variables to allow installation of a different repository:
+
+- `REPO` (default: `ohmyzsh/ohmyzsh`): this takes the form of `owner/repository`. If you set
+ this variable, the installer will look for a repository at `https://github.com/{owner}/{repository}`.
+
+- `REMOTE` (default: `https://github.com/${REPO}.git`): this is the full URL of the git repository
+ clone. You can use this setting if you want to install from a fork that is not on GitHub (GitLab,
+ Bitbucket...) or if you want to clone with SSH instead of HTTPS (`git@github.com:user/project.git`).
+
+ _NOTE: it's incompatible with setting the `REPO` variable. This setting will take precedence._
+
+- `BRANCH` (default: `master`): you can use this setting if you want to change the default branch to be
+ checked out when cloning the repository. This might be useful for testing a Pull Request, or if you
+ want to use a branch other than `master`.
+
+For example:
+
+```shell
+REPO=apjanke/oh-my-zsh BRANCH=edge sh install.sh
```
#### Manual Installation
@@ -141,7 +195,7 @@ export ZSH="$HOME/.dotfiles/oh-my-zsh"; sh -c "$(curl -fsSL https://raw.githubus
##### 1. Clone the repository:
```shell
-git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
+git clone https://github.com/ohmyzsh/ohmyzsh.git ~/.oh-my-zsh
```
##### 2. *Optionally*, backup your existing `~/.zshrc` file:
@@ -161,9 +215,11 @@ cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
##### 4. Change your default shell
```shell
-chsh -s /bin/zsh
+chsh -s $(which zsh)
```
+You must log out from your user session and log back in to see this change.
+
##### 5. Initialize your new zsh configuration
Once you open up a new terminal window, it should load zsh with Oh My Zsh's configuration.
@@ -172,8 +228,10 @@ Once you open up a new terminal window, it should load zsh with Oh My Zsh's conf
If you have any hiccups installing, here are a few common fixes.
-* You _might_ need to modify your `PATH` in `~/.zshrc` if you're not able to find some commands after switching to `oh-my-zsh`.
-* If you installed manually or changed the install location, check the `ZSH` environment variable in `~/.zshrc`.
+* You _might_ need to modify your `PATH` in `~/.zshrc` if you're not able to find some commands after
+switching to `oh-my-zsh`.
+* If you installed manually or changed the install location, check the `ZSH` environment variable in
+`~/.zshrc`.
### Custom Plugins and Themes
@@ -219,13 +277,13 @@ Before you participate in our delightful community, please read the [code of con
I'm far from being a [Zsh](https://www.zsh.org/) expert and suspect there are many ways to improve – if you have ideas on how to make the configuration easier to maintain (and faster), don't hesitate to fork and send pull requests!
-We also need people to test out pull-requests. So take a look through [the open issues](https://github.com/robbyrussell/oh-my-zsh/issues) and help where you can.
+We also need people to test out pull-requests. So take a look through [the open issues](https://github.com/ohmyzsh/ohmyzsh/issues) and help where you can.
See [Contributing](CONTRIBUTING.md) for more details.
### Do NOT send us themes
-We have (more than) enough themes for the time being. Please add your theme to the [external themes](https://github.com/robbyrussell/oh-my-zsh/wiki/External-themes) wiki page.
+We have (more than) enough themes for the time being. Please add your theme to the [external themes](https://github.com/ohmyzsh/ohmyzsh/wiki/External-themes) wiki page.
## Contributors
diff --git a/lib/directories.zsh b/lib/directories.zsh
index 14064b86f..cf87bd7e4 100644
--- a/lib/directories.zsh
+++ b/lib/directories.zsh
@@ -21,7 +21,15 @@ alias 9='cd -9'
alias md='mkdir -p'
alias rd=rmdir
-alias d='dirs -v | head -10'
+
+function d () {
+ if [[ -n $1 ]]; then
+ dirs "$@"
+ else
+ dirs -v | head -10
+ fi
+}
+compdef _dirs d
# List directory contents
alias lsa='ls -lah'
diff --git a/lib/functions.zsh b/lib/functions.zsh
index 9f8736bd7..61dfa4780 100644
--- a/lib/functions.zsh
+++ b/lib/functions.zsh
@@ -21,7 +21,7 @@ function open_command() {
case "$OSTYPE" in
darwin*) open_cmd='open' ;;
cygwin*) open_cmd='cygstart' ;;
- linux*) ! [[ $(uname -a) =~ "Microsoft" ]] && open_cmd='xdg-open' || {
+ linux*) [[ "$(uname -r)" != *icrosoft* ]] && open_cmd='nohup xdg-open' || {
open_cmd='cmd.exe /c start ""'
[[ -e "$1" ]] && { 1="$(wslpath -w "${1:a}")" || return 1 }
} ;;
@@ -31,12 +31,7 @@ function open_command() {
;;
esac
- # don't use nohup on OSX
- if [[ "$OSTYPE" == darwin* ]]; then
- ${=open_cmd} "$@" &>/dev/null
- else
- nohup ${=open_cmd} "$@" &>/dev/null
- fi
+ ${=open_cmd} "$@" &>/dev/null
}
#
diff --git a/lib/git.zsh b/lib/git.zsh
index b92373153..2054fe272 100644
--- a/lib/git.zsh
+++ b/lib/git.zsh
@@ -10,16 +10,23 @@ function git_prompt_info() {
# Checks if working tree is dirty
function parse_git_dirty() {
- local STATUS=''
+ local STATUS
local -a FLAGS
FLAGS=('--porcelain')
if [[ "$(command git config --get oh-my-zsh.hide-dirty)" != "1" ]]; then
- if [[ $POST_1_7_2_GIT -gt 0 ]]; then
- FLAGS+='--ignore-submodules=dirty'
- fi
if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" == "true" ]]; then
FLAGS+='--untracked-files=no'
fi
+ case "$GIT_STATUS_IGNORE_SUBMODULES" in
+ git)
+ # let git decide (this respects per-repo config in .gitmodules)
+ ;;
+ *)
+ # if unset: ignore dirty submodules
+ # other values are passed to --ignore-submodules
+ FLAGS+="--ignore-submodules=${GIT_STATUS_IGNORE_SUBMODULES:-dirty}"
+ ;;
+ esac
STATUS=$(command git status ${FLAGS} 2> /dev/null | tail -n1)
fi
if [[ -n $STATUS ]]; then
@@ -181,28 +188,6 @@ function git_prompt_status() {
echo $STATUS
}
-# Compares the provided version of git to the version installed and on path
-# Outputs -1, 0, or 1 if the installed version is less than, equal to, or
-# greater than the input version, respectively.
-function git_compare_version() {
- local INPUT_GIT_VERSION INSTALLED_GIT_VERSION i
- INPUT_GIT_VERSION=(${(s/./)1})
- INSTALLED_GIT_VERSION=($(command git --version 2>/dev/null))
- INSTALLED_GIT_VERSION=(${(s/./)INSTALLED_GIT_VERSION[3]})
-
- for i in {1..3}; do
- if [[ $INSTALLED_GIT_VERSION[$i] -gt $INPUT_GIT_VERSION[$i] ]]; then
- echo 1
- return 0
- fi
- if [[ $INSTALLED_GIT_VERSION[$i] -lt $INPUT_GIT_VERSION[$i] ]]; then
- echo -1
- return 0
- fi
- done
- echo 0
-}
-
# Outputs the name of the current user
# Usage example: $(git_current_user_name)
function git_current_user_name() {
@@ -214,8 +199,3 @@ function git_current_user_name() {
function git_current_user_email() {
command git config user.email 2>/dev/null
}
-
-# This is unlikely to change so make it all statically assigned
-POST_1_7_2_GIT=$(git_compare_version "1.7.2")
-# Clean up the namespace slightly by removing the checker function
-unfunction git_compare_version
diff --git a/lib/history.zsh b/lib/history.zsh
index d8bbd41c4..52e45bf4c 100644
--- a/lib/history.zsh
+++ b/lib/history.zsh
@@ -12,12 +12,12 @@ function omz_history {
builtin fc "$@"
else
# unless a number is provided, show all history events (starting from 1)
- [[ ${@[-1]} = *[0-9]* ]] && builtin fc -l "$@" || builtin fc -l "$@" 1
+ [[ ${@[-1]-} = *[0-9]* ]] && builtin fc -l "$@" || builtin fc -l "$@" 1
fi
}
# Timestamp format
-case $HIST_STAMPS in
+case ${HIST_STAMPS-} in
"mm/dd/yyyy") alias history='omz_history -f' ;;
"dd.mm.yyyy") alias history='omz_history -E' ;;
"yyyy-mm-dd") alias history='omz_history -i' ;;
diff --git a/lib/misc.zsh b/lib/misc.zsh
index b30822b50..61571afc9 100644
--- a/lib/misc.zsh
+++ b/lib/misc.zsh
@@ -1,7 +1,7 @@
-## Load smart urls if available
-# bracketed-paste-magic is known buggy in zsh 5.1.1 (only), so skip it there; see #4434
autoload -Uz is-at-least
-if [[ $ZSH_VERSION != 5.1.1 ]]; then
+
+# *-magic is known buggy in some versions; disable if so
+if [[ $DISABLE_MAGIC_FUNCTIONS != true ]]; then
for d in $fpath; do
if [[ -e "$d/url-quote-magic" ]]; then
if is-at-least 5.1; then
@@ -22,7 +22,7 @@ env_default 'PAGER' 'less'
env_default 'LESS' '-R'
## super user alias
-alias _='sudo'
+alias _='sudo '
## more intelligent acking for ubuntu users
if which ack-grep &> /dev/null; then
@@ -31,10 +31,5 @@ else
alias afind='ack -il'
fi
-# only define LC_CTYPE if undefined
-if [[ -z "$LC_CTYPE" && -z "$LC_ALL" ]]; then
- export LC_CTYPE=${LANG%%:*} # pick the first entry from LANG
-fi
-
# recognize comments
setopt interactivecomments
diff --git a/lib/prompt_info_functions.zsh b/lib/prompt_info_functions.zsh
index 1d5c23e41..5069c4b21 100644
--- a/lib/prompt_info_functions.zsh
+++ b/lib/prompt_info_functions.zsh
@@ -10,9 +10,15 @@
# Dummy implementations that return false to prevent command_not_found
# errors with themes, that implement these functions
# Real implementations will be used when the respective plugins are loaded
-function chruby_prompt_info hg_prompt_info pyenv_prompt_info \
- rbenv_prompt_info svn_prompt_info vi_mode_prompt_info \
- virtualenv_prompt_info jenv_prompt_info {
+function chruby_prompt_info \
+ rbenv_prompt_info \
+ hg_prompt_info \
+ pyenv_prompt_info \
+ svn_prompt_info \
+ vi_mode_prompt_info \
+ virtualenv_prompt_info \
+ jenv_prompt_info \
+{
return 1
}
@@ -22,10 +28,13 @@ function rvm_prompt_info() {
[ -f $HOME/.rvm/bin/rvm-prompt ] || return 1
local rvm_prompt
rvm_prompt=$($HOME/.rvm/bin/rvm-prompt ${=ZSH_THEME_RVM_PROMPT_OPTIONS} 2>/dev/null)
- [[ "${rvm_prompt}x" == "x" ]] && return 1
- echo "${ZSH_THEME_RVM_PROMPT_PREFIX:=(}${rvm_prompt}${ZSH_THEME_RVM_PROMPT_SUFFIX:=)}"
+ [[ -z "${rvm_prompt}" ]] && return 1
+ echo "${ZSH_THEME_RUBY_PROMPT_PREFIX}${rvm_prompt}${ZSH_THEME_RUBY_PROMPT_SUFFIX}"
}
+ZSH_THEME_RVM_PROMPT_OPTIONS="i v g"
+
+
# use this to enable users to see their ruby version, no matter which
# version management system they use
function ruby_prompt_info() {
diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh
index aa14f3f07..f5e367fcb 100644
--- a/lib/termsupport.zsh
+++ b/lib/termsupport.zsh
@@ -75,8 +75,9 @@ function omz_termsupport_preexec {
title '$CMD' '%100>...>$LINE%<<'
}
-precmd_functions+=(omz_termsupport_precmd)
-preexec_functions+=(omz_termsupport_preexec)
+autoload -U add-zsh-hook
+add-zsh-hook precmd omz_termsupport_precmd
+add-zsh-hook preexec omz_termsupport_preexec
# Keep Apple Terminal.app's current working directory updated
@@ -99,7 +100,7 @@ if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then
}
# Use a precmd hook instead of a chpwd hook to avoid contaminating output
- precmd_functions+=(update_terminalapp_cwd)
+ add-zsh-hook precmd update_terminalapp_cwd
# Run once to get initial cwd set
update_terminalapp_cwd
fi
diff --git a/lib/theme-and-appearance.zsh b/lib/theme-and-appearance.zsh
index 96f34aa81..5016d86ca 100644
--- a/lib/theme-and-appearance.zsh
+++ b/lib/theme-and-appearance.zsh
@@ -19,7 +19,7 @@ if [[ "$DISABLE_LS_COLORS" != "true" ]]; then
# coreutils, so prefer it to "gls".
gls --color -d . &>/dev/null && alias ls='gls --color=tty'
colorls -G -d . &>/dev/null && alias ls='colorls -G'
- elif [[ "$OSTYPE" == darwin* ]]; then
+ elif [[ "$OSTYPE" == (darwin|freebsd)* ]]; then
# this is a good alias, it works by default just using $LSCOLORS
ls -G . &>/dev/null && alias ls='ls -G'
@@ -45,11 +45,10 @@ setopt prompt_subst
[[ -n "$WINDOW" ]] && SCREEN_NO="%B$WINDOW%b " || SCREEN_NO=""
-# Apply theming defaults
-PS1="%n@%m:%~%# "
-
# git theming default: Variables for theming the git info prompt
ZSH_THEME_GIT_PROMPT_PREFIX="git:(" # Prefix at the very beginning of the prompt, before the branch name
ZSH_THEME_GIT_PROMPT_SUFFIX=")" # At the very end of the prompt
ZSH_THEME_GIT_PROMPT_DIRTY="*" # Text to display if the branch is dirty
ZSH_THEME_GIT_PROMPT_CLEAN="" # Text to display if the branch is clean
+ZSH_THEME_RUBY_PROMPT_PREFIX="("
+ZSH_THEME_RUBY_PROMPT_SUFFIX=")"
diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh
index b1460b1d7..6b2662d5e 100644
--- a/oh-my-zsh.sh
+++ b/oh-my-zsh.sh
@@ -29,15 +29,6 @@ if [[ -z "$ZSH_CUSTOM" ]]; then
fi
-# Load all of the config files in ~/oh-my-zsh that end in .zsh
-# TIP: Add files you don't want in git to .gitignore
-for config_file ($ZSH/lib/*.zsh); do
- custom_config_file="${ZSH_CUSTOM}/lib/${config_file:t}"
- [ -f "${custom_config_file}" ] && config_file=${custom_config_file}
- source $config_file
-done
-
-
is_plugin() {
local base_dir=$1
local name=$2
@@ -71,6 +62,7 @@ if [ -z "$ZSH_COMPDUMP" ]; then
fi
if [[ $ZSH_DISABLE_COMPFIX != true ]]; then
+ source $ZSH/lib/compfix.zsh
# If completion insecurities exist, warn the user
handle_completion_insecurities
# Load only from secure directories
@@ -80,6 +72,15 @@ else
compinit -u -C -d "${ZSH_COMPDUMP}"
fi
+
+# Load all of the config files in ~/oh-my-zsh that end in .zsh
+# TIP: Add files you don't want in git to .gitignore
+for config_file ($ZSH/lib/*.zsh); do
+ custom_config_file="${ZSH_CUSTOM}/lib/${config_file:t}"
+ [ -f "${custom_config_file}" ] && config_file=${custom_config_file}
+ source $config_file
+done
+
# Load all of the plugins that were defined in ~/.zshrc
for plugin ($plugins); do
if [ -f $ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh ]; then
diff --git a/plugins/alias-finder/README.md b/plugins/alias-finder/README.md
new file mode 100644
index 000000000..409f4b653
--- /dev/null
+++ b/plugins/alias-finder/README.md
@@ -0,0 +1,46 @@
+# alias-finder plugin
+
+This plugin searches the defined aliases and outputs any that match the command inputted. This makes learning new aliases easier.
+
+To use it, add `alias-finder` to the `plugins` array of your zshrc file:
+```
+plugins=(... alias-finder)
+```
+
+## Usage
+To see if there is an alias defined for the command, pass it as an argument to `alias-finder`. This can also run automatically before each command you input - add `ZSH_ALIAS_FINDER_AUTOMATIC=true` to your zshrc if you want this.
+
+## Options
+
+- Use `--longer` or `-l` to allow the aliases to be longer than the input (match aliases if they contain the input).
+- Use `--exact` or `-e` to avoid matching aliases that are shorter than the input.
+
+## Examples
+```
+$ alias-finder "git pull"
+gl='git pull'
+g=git
+```
+```
+$ alias-finder "web_search google oh my zsh"
+google='web_search google'
+```
+```
+$ alias-finder "git commit -v"
+gc="git commit -v"
+g=git
+```
+```
+$ alias-finder -e "git commit -v"
+gc='git commit -v'
+```
+```
+$ alias-finder -l "git commit -v"
+gc='git commit -v'
+'gc!'='git commit -v --amend'
+gca='git commit -v -a'
+'gca!'='git commit -v -a --amend'
+'gcan!'='git commit -v -a --no-edit --amend'
+'gcans!'='git commit -v -a -s --no-edit --amend'
+'gcn!'='git commit -v --no-edit --amend'
+```
diff --git a/plugins/alias-finder/alias-finder.plugin.zsh b/plugins/alias-finder/alias-finder.plugin.zsh
new file mode 100644
index 000000000..caee9b5a3
--- /dev/null
+++ b/plugins/alias-finder/alias-finder.plugin.zsh
@@ -0,0 +1,47 @@
+alias-finder() {
+ local cmd="" exact="" longer="" wordStart="" wordEnd="" multiWordEnd=""
+ for i in $@; do
+ case $i in
+ -e|--exact) exact=true;;
+ -l|--longer) longer=true;;
+ *)
+ if [[ -z $cmd ]]; then
+ cmd=$i
+ else
+ cmd="$cmd $i"
+ fi
+ ;;
+ esac
+ done
+ cmd=$(sed 's/[].\|$(){}?+*^[]/\\&/g' <<< $cmd) # adds escaping for grep
+ if (( $(wc -l <<< $cmd) == 1 )); then
+ while [[ $cmd != "" ]]; do
+ if [[ $longer = true ]]; then
+ wordStart="'{0,1}"
+ else
+ wordEnd="$"
+ multiWordEnd="'$"
+ fi
+ if [[ $cmd == *" "* ]]; then
+ local finder="'$cmd$multiWordEnd"
+ else
+ local finder=$wordStart$cmd$wordEnd
+ fi
+ alias | grep -E "=$finder"
+ if [[ $exact = true || $longer = true ]]; then
+ break
+ else
+ cmd=$(sed -E 's/ {0,1}[^ ]*$//' <<< $cmd) # removes last word
+ fi
+ done
+ fi
+}
+
+preexec_alias-finder() {
+ if [[ $ZSH_ALIAS_FINDER_AUTOMATIC = true ]]; then
+ alias-finder $1
+ fi
+}
+
+autoload -U add-zsh-hook
+add-zsh-hook preexec preexec_alias-finder
diff --git a/plugins/arcanist/README.md b/plugins/arcanist/README.md
index 4bb8c8090..f2ca8cf55 100644
--- a/plugins/arcanist/README.md
+++ b/plugins/arcanist/README.md
@@ -2,4 +2,4 @@
**Maintainer:** [@emzar](https://github.com/emzar)
-This plugin adds many useful aliases.
+This plugin adds many useful aliases for [arcanist](https://github.com/phacility/arcanist).
diff --git a/plugins/archlinux/README.md b/plugins/archlinux/README.md
index 7ebe8e53d..ff2b6a4c4 100644
--- a/plugins/archlinux/README.md
+++ b/plugins/archlinux/README.md
@@ -14,7 +14,7 @@
| yalocs | yay -Qs | Search for packages in the local database |
| yalst | yay -Qe | List installed packages including from AUR (tagged as "local") |
| yamir | yay -Syy | Force refresh of all package lists after updating mirrorlist |
-| yaorph | yay -Qtd | Remove orphans using yaourt |
+| yaorph | yay -Qtd | Remove orphans using yay |
| yare | yay -R | Remove packages, keeping its settings and dependencies |
| yarem | yay -Rns | Remove packages, including its settings and unneeded dependencies |
| yarep | yay -Si | Display information about a package in the repositories |
diff --git a/plugins/autoenv/README.md b/plugins/autoenv/README.md
new file mode 100644
index 000000000..de3881774
--- /dev/null
+++ b/plugins/autoenv/README.md
@@ -0,0 +1,14 @@
+# Autoenv plugin
+
+This plugin loads the [Autoenv](https://github.com/inishchith/autoenv).
+
+To use it, add `autoenv` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... autoenv)
+```
+## Requirements
+
+In order to make this work, you will need to have the autoenv installed.
+
+More info on the usage and install: https://github.com/inishchith/autoenv
diff --git a/plugins/autojump/autojump.plugin.zsh b/plugins/autojump/autojump.plugin.zsh
index c0af67631..d80c88822 100644
--- a/plugins/autojump/autojump.plugin.zsh
+++ b/plugins/autojump/autojump.plugin.zsh
@@ -1,23 +1,34 @@
-if [ $commands[autojump] ]; then # check if autojump is installed
- if [ -f $HOME/.autojump/etc/profile.d/autojump.zsh ]; then # manual user-local installation
- . $HOME/.autojump/etc/profile.d/autojump.zsh
- elif [ -f $HOME/.autojump/share/autojump/autojump.zsh ]; then # another manual user-local installation
- . $HOME/.autojump/share/autojump/autojump.zsh
- elif [ -f $HOME/.nix-profile/etc/profile.d/autojump.zsh ]; then # nix installation
- . $HOME/.nix-profile/etc/profile.d/autojump.zsh
- elif [ -f /run/current-system/sw/share/autojump/autojump.zsh ]; then # nixos installation
- . /run/current-system/sw/share/autojump/autojump.zsh
- elif [ -f /usr/share/autojump/autojump.zsh ]; then # debian and ubuntu package
- . /usr/share/autojump/autojump.zsh
- elif [ -f /etc/profile.d/autojump.zsh ]; then # manual installation
- . /etc/profile.d/autojump.zsh
- elif [ -f /etc/profile.d/autojump.sh ]; then # gentoo installation
- . /etc/profile.d/autojump.sh
- elif [ -f /usr/local/share/autojump/autojump.zsh ]; then # freebsd installation
- . /usr/local/share/autojump/autojump.zsh
- elif [ -f /opt/local/etc/profile.d/autojump.sh ]; then # mac os x with ports
- . /opt/local/etc/profile.d/autojump.sh
- elif [ $commands[brew] -a -f `brew --prefix`/etc/autojump.sh ]; then # mac os x with brew
- . `brew --prefix`/etc/autojump.sh
+declare -a autojump_paths
+autojump_paths=(
+ $HOME/.autojump/etc/profile.d/autojump.zsh # manual installation
+ $HOME/.autojump/share/autojump/autojump.zsh # manual installation
+ $HOME/.nix-profile/etc/profile.d/autojump.sh # NixOS installation
+ /run/current-system/sw/share/autojump/autojump.zsh # NixOS installation
+ /usr/share/autojump/autojump.zsh # Debian and Ubuntu package
+ /etc/profile.d/autojump.zsh # manual installation
+ /etc/profile.d/autojump.sh # Gentoo installation
+ /usr/local/share/autojump/autojump.zsh # FreeBSD installation
+ /opt/local/etc/profile.d/autojump.sh # macOS with MacPorts
+ /usr/local/etc/profile.d/autojump.sh # macOS with Homebrew (default)
+)
+
+for file in $autojump_paths; do
+ if [[ -f "$file" ]]; then
+ source "$file"
+ found=1
+ break
+ fi
+done
+
+# if no path found, try Homebrew
+if (( ! found && $+commands[brew] )); then
+ file=$(brew --prefix)/etc/profile.d/autojump.sh
+ if [[ -f "$file" ]]; then
+ source "$file"
+ found=1
fi
fi
+
+(( ! found )) && echo '[oh-my-zsh] autojump script not found'
+
+unset autojump_paths file found
diff --git a/plugins/aws/README.md b/plugins/aws/README.md
index a52024128..57c3b54ac 100644
--- a/plugins/aws/README.md
+++ b/plugins/aws/README.md
@@ -25,6 +25,8 @@ plugins=(... aws)
## Plugin options
* Set `SHOW_AWS_PROMPT=false` in your zshrc file if you want to prevent the plugin from modifying your RPROMPT.
+ Some themes might overwrite the value of RPROMPT instead of appending to it, so they'll need to be fixed to
+ see the AWS profile prompt.
## Theme
diff --git a/plugins/aws/aws.plugin.zsh b/plugins/aws/aws.plugin.zsh
index 6de329bb8..231ac5ad2 100644
--- a/plugins/aws/aws.plugin.zsh
+++ b/plugins/aws/aws.plugin.zsh
@@ -1,27 +1,35 @@
-# AWS profile selection
-
-function agp {
+function agp() {
echo $AWS_PROFILE
}
-function asp {
- export AWS_DEFAULT_PROFILE=$1
- export AWS_PROFILE=$1
- export AWS_EB_PROFILE=$1
-
+# AWS profile selection
+function asp() {
if [[ -z "$1" ]]; then
+ unset AWS_DEFAULT_PROFILE AWS_PROFILE AWS_EB_PROFILE
echo AWS profile cleared.
+ return
+ fi
+
+ local available_profiles=($(aws_profiles))
+ if [[ -z "${available_profiles[(r)$1]}" ]]; then
+ echo "${fg[red]}Profile '$1' not found in '${AWS_CONFIG_FILE:-$HOME/.aws/config}'" >&2
+ echo "Available profiles: ${(j:, :)available_profiles:-no profiles found}${reset_color}" >&2
+ return 1
fi
+
+ export AWS_DEFAULT_PROFILE=$1
+ export AWS_PROFILE=$1
+ export AWS_EB_PROFILE=$1
}
-function aws_change_access_key {
- if [[ -z "$1" ]] then
+function aws_change_access_key() {
+ if [[ -z "$1" ]]; then
echo "usage: $0 <profile>"
return 1
fi
echo Insert the credentials when asked.
- asp "$1"
+ asp "$1" || return 1
aws iam create-access-key
aws configure --profile "$1"
@@ -30,27 +38,30 @@ function aws_change_access_key {
aws iam list-access-keys
}
-function aws_profiles {
- reply=($(grep '\[profile' "${AWS_CONFIG_FILE:-$HOME/.aws/config}"|sed -e 's/.*profile \([a-zA-Z0-9_\.-]*\).*/\1/'))
+function aws_profiles() {
+ [[ -r "${AWS_CONFIG_FILE:-$HOME/.aws/config}" ]] || return 1
+ grep '\[profile' "${AWS_CONFIG_FILE:-$HOME/.aws/config}"|sed -e 's/.*profile \([a-zA-Z0-9_\.-]*\).*/\1/'
}
-compctl -K aws_profiles asp aws_change_access_key
+function _aws_profiles() {
+ reply=($(aws_profiles))
+}
+compctl -K _aws_profiles asp aws_change_access_key
# AWS prompt
-
function aws_prompt_info() {
[[ -z $AWS_PROFILE ]] && return
echo "${ZSH_THEME_AWS_PREFIX:=<aws:}${AWS_PROFILE}${ZSH_THEME_AWS_SUFFIX:=>}"
}
if [ "$SHOW_AWS_PROMPT" != false ]; then
- export RPROMPT='$(aws_prompt_info)'"$RPROMPT"
+ RPROMPT='$(aws_prompt_info)'"$RPROMPT"
fi
# Load awscli completions
-_awscli-homebrew-installed() {
+function _awscli-homebrew-installed() {
# check if Homebrew is installed
(( $+commands[brew] )) || return 1
@@ -67,11 +78,18 @@ _awscli-homebrew-installed() {
# get aws_zsh_completer.sh location from $PATH
_aws_zsh_completer_path="$commands[aws_zsh_completer.sh]"
-# otherwise check if installed via Homebrew
-if [[ -z $_aws_zsh_completer_path ]] && _awscli-homebrew-installed; then
- _aws_zsh_completer_path=$_brew_prefix/libexec/bin/aws_zsh_completer.sh
-else
- _aws_zsh_completer_path=/usr/share/zsh/site-functions/aws_zsh_completer.sh
+# otherwise check common locations
+if [[ -z $_aws_zsh_completer_path ]]; then
+ # Homebrew
+ if _awscli-homebrew-installed; then
+ _aws_zsh_completer_path=$_brew_prefix/libexec/bin/aws_zsh_completer.sh
+ # Ubuntu
+ elif [[ -e /usr/share/zsh/vendor-completions/_awscli ]]; then
+ _aws_zsh_completer_path=/usr/share/zsh/vendor-completions/_awscli
+ # RPM
+ else
+ _aws_zsh_completer_path=/usr/share/zsh/site-functions/aws_zsh_completer.sh
+ fi
fi
[[ -r $_aws_zsh_completer_path ]] && source $_aws_zsh_completer_path
diff --git a/plugins/battery/battery.plugin.zsh b/plugins/battery/battery.plugin.zsh
index 8f398cfb3..6b6684716 100644
--- a/plugins/battery/battery.plugin.zsh
+++ b/plugins/battery/battery.plugin.zsh
@@ -7,6 +7,9 @@
# Email: neuralsandwich@gmail.com #
# Modified to add support for Apple Mac #
###########################################
+# Author: J (927589452) #
+# Modified to add support for FreeBSD #
+###########################################
if [[ "$OSTYPE" = darwin* ]] ; then
@@ -64,6 +67,52 @@ if [[ "$OSTYPE" = darwin* ]] ; then
[[ $(ioreg -rc "AppleSmartBattery"| grep '^.*"IsCharging"\ =\ ' | sed -e 's/^.*"IsCharging"\ =\ //') == "Yes" ]]
}
+elif [[ "$OSTYPE" = freebsd* ]] ; then
+
+ function battery_is_charging() {
+ [[ $(sysctl -n hw.acpi.battery.state) -eq 2 ]]
+ }
+
+ function battery_pct() {
+ if (( $+commands[sysctl] )) ; then
+ echo "$(sysctl -n hw.acpi.battery.life)"
+ fi
+ }
+
+ function battery_pct_remaining() {
+ if [ ! $(battery_is_charging) ] ; then
+ battery_pct
+ else
+ echo "External Power"
+ fi
+ }
+
+ function battery_time_remaining() {
+ remaining_time=$(sysctl -n hw.acpi.battery.time)
+ if [[ $remaining_time -ge 0 ]] ; then
+ # calculation from https://www.unix.com/shell-programming-and-scripting/23695-convert-minutes-hours-minutes-seconds.html
+ ((hour=$remaining_time/60))
+ ((minute=$remaining_time-$hour*60))
+ echo $hour:$minute
+ fi
+ }
+
+ function battery_pct_prompt() {
+ b=$(battery_pct_remaining)
+ if [ ! $(battery_is_charging) ] ; then
+ if [ $b -gt 50 ] ; then
+ color='green'
+ elif [ $b -gt 20 ] ; then
+ color='yellow'
+ else
+ color='red'
+ fi
+ echo "%{$fg[$color]%}$(battery_pct_remaining)%%%{$reset_color%}"
+ else
+ echo "∞"
+ fi
+ }
+
elif [[ "$OSTYPE" = linux* ]] ; then
function battery_is_charging() {
diff --git a/plugins/bundler/README.md b/plugins/bundler/README.md
index dc2f17008..9f211b02f 100644
--- a/plugins/bundler/README.md
+++ b/plugins/bundler/README.md
@@ -2,7 +2,7 @@
- adds completion for basic bundler commands
- adds short aliases for common bundler commands
- - `be` aliased to `bundle exec`.
+ - `be` aliased to `bundle exec`.
It also supports aliases (if `rs` is `rails server`, `be rs` will bundle-exec `rails server`).
- `bl` aliased to `bundle list`
- `bp` aliased to `bundle package`
@@ -15,7 +15,7 @@
- calls `bundle exec <gem executable>` otherwise
Common gems wrapped by default (by name of the executable):
-`annotate`, `cap`, `capify`, `cucumber`, `foodcritic`, `guard`, `hanami`, `irb`, `jekyll`, `kitchen`, `knife`, `middleman`, `nanoc`, `pry`, `puma`, `rackup`, `rainbows`, `rake`, `rspec`, `shotgun`, `sidekiq`, `spec`, `spork`, `spring`, `strainer`, `tailor`, `taps`, `thin`, `thor`, `unicorn` and `unicorn_rails`.
+`annotate`, `cap`, `capify`, `cucumber`, `foodcritic`, `guard`, `hanami`, `irb`, `jekyll`, `kitchen`, `knife`, `middleman`, `nanoc`, `pry`, `puma`, `rackup`, `rainbows`, `rake`, `rspec`, `rubocop`, `shotgun`, `sidekiq`, `spec`, `spork`, `spring`, `strainer`, `tailor`, `taps`, `thin`, `thor`, `unicorn` and `unicorn_rails`.
## Configuration
@@ -42,7 +42,7 @@ This will exclude the `foreman` and `spin` gems (i.e. their executable) from bei
## Excluded gems
-These gems should not be called with `bundle exec`. Please see [issue #2923](https://github.com/robbyrussell/oh-my-zsh/pull/2923) on GitHub for clarification.
+These gems should not be called with `bundle exec`. Please see [issue #2923](https://github.com/ohmyzsh/ohmyzsh/pull/2923) on GitHub for clarification.
`berks`
`foreman`
diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh
index 668e15d2f..665cb5e43 100644
--- a/plugins/bundler/bundler.plugin.zsh
+++ b/plugins/bundler/bundler.plugin.zsh
@@ -27,6 +27,7 @@ bundled_commands=(
rainbows
rake
rspec
+ rubocop
shotgun
sidekiq
spec
@@ -81,7 +82,7 @@ _bundler-installed() {
_within-bundled-project() {
local check_dir="$PWD"
while [ "$check_dir" != "/" ]; do
- [ -f "$check_dir/Gemfile" ] && return
+ [ -f "$check_dir/Gemfile" -o -f "$check_dir/gems.rb" ] && return
check_dir="$(dirname $check_dir)"
done
false
@@ -94,7 +95,7 @@ _binstubbed() {
_run-with-bundler() {
if _bundler-installed && _within-bundled-project; then
if _binstubbed $1; then
- ./bin/$@
+ ./bin/${^^@}
else
bundle exec $@
fi
diff --git a/plugins/bwana/README.md b/plugins/bwana/README.md
deleted file mode 100644
index 8cbeaa32e..000000000
--- a/plugins/bwana/README.md
+++ /dev/null
@@ -1,9 +0,0 @@
-# Bwana
-
-This plugin provides a function to open `man` pages directly with [Bwana](https://www.bruji.com/bwana/).
-
-To use it add bwana to the plugins array in your zshrc file.
-
-```bash
-plugins=(... bwana)
-```
diff --git a/plugins/bwana/bwana.plugin.zsh b/plugins/bwana/bwana.plugin.zsh
deleted file mode 100644
index b9a04793f..000000000
--- a/plugins/bwana/bwana.plugin.zsh
+++ /dev/null
@@ -1,13 +0,0 @@
-#
-# Requires https://www.bruji.com/bwana/
-#
-if [[ -e /Applications/Bwana.app ]] ||
- ( system_profiler -detailLevel mini SPApplicationsDataType | grep -q Bwana )
-then
- function man() {
- open "man:$1"
- }
-else
- echo "Bwana lets you read man files in Safari through a man: URI scheme"
- echo "To use it within Zsh, install it from https://www.bruji.com/bwana/"
-fi
diff --git a/plugins/cakephp3/README.md b/plugins/cakephp3/README.md
new file mode 100644
index 000000000..7e8f6640d
--- /dev/null
+++ b/plugins/cakephp3/README.md
@@ -0,0 +1,16 @@
+# cakephp3 plugin
+
+The plugin adds aliases and autocompletion for [cakephp3](https://book.cakephp.org/3.0/en/index.html).
+
+To use it, add `cakephp3` to the plugins array of your zshrc file:
+```
+plugins=(... cakephp3)
+```
+
+## Aliases
+
+| Alias | Command |
+|-----------|-------------------------------|
+| c3 | `bin/cake` |
+| c3cache | `bin/cake orm_cache clear` |
+| c3migrate | `bin/cake migrations migrate` |
diff --git a/plugins/cargo/_cargo b/plugins/cargo/_cargo
index 395c517cd..12694901e 100644
--- a/plugins/cargo/_cargo
+++ b/plugins/cargo/_cargo
@@ -2,489 +2,367 @@
autoload -U regexp-replace
-zstyle -T ':completion:*:*:cargo:*' tag-order && \
- zstyle ':completion:*:*:cargo:*' tag-order 'common-commands'
-
_cargo() {
-local context state state_descr line
-typeset -A opt_args
-
-# leading items in parentheses are an exclusion list for the arguments following that arg
-# See: http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Completion-Functions
-# - => exclude all other options
-# 1 => exclude positional arg 1
-# * => exclude all other args
-# +blah => exclude +blah
-_arguments \
- '(- 1 *)'{-h,--help}'[show help message]' \
- '(- 1 *)--list[list installed commands]' \
- '(- 1 *)'{-V,--version}'[show version information]' \
- {-v,--verbose}'[use verbose output]' \
- --color'[colorization option]' \
- '(+beta +nightly)+stable[use the stable toolchain]' \
- '(+stable +nightly)+beta[use the beta toolchain]' \
- '(+stable +beta)+nightly[use the nightly toolchain]' \
- '1: :->command' \
- '*:: :->args'
-
-case $state in
- command)
- _alternative 'common-commands:common:_cargo_cmds' 'all-commands:all:_cargo_all_cmds'
- ;;
-
- args)
- case $words[1] in
- bench)
- _arguments \
- '--features=[space separated feature list]' \
- '--all-features[enable all available features]' \
- '(-h, --help)'{-h,--help}'[show help message]' \
- '(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \
- "${command_scope_spec[@]}" \
- '--manifest-path=[path to manifest]: :_files -/' \
- '--no-default-features[do not build the default features]' \
- '--no-run[compile but do not run]' \
- '(-p,--package)'{-p=,--package=}'[package to run benchmarks for]:packages:_get_package_names' \
- '--target=[target triple]' \
- '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
- '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
- '--color=:colorization option:(auto always never)' \
- ;;
-
- build)
- _arguments \
- '--features=[space separated feature list]' \
- '--all-features[enable all available features]' \
- '(-h, --help)'{-h,--help}'[show help message]' \
- '(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \
- "${command_scope_spec[@]}" \
- '--manifest-path=[path to manifest]: :_files -/' \
- '--no-default-features[do not build the default features]' \
- '(-p,--package)'{-p=,--package=}'[package to build]:packages:_get_package_names' \
- '--release=[build in release mode]' \
- '--target=[target triple]' \
- '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
- '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
- '--color=:colorization option:(auto always never)' \
- ;;
-
- check)
- _arguments \
- '--features=[space separated feature list]' \
- '--all-features[enable all available features]' \
- '(-h, --help)'{-h,--help}'[show help message]' \
- '(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \
- "${command_scope_spec[@]}" \
- '--manifest-path=[path to manifest]: :_files -/' \
- '--no-default-features[do not check the default features]' \
- '(-p,--package)'{-p=,--package=}'[package to check]:packages:_get_package_names' \
- '--release=[check in release mode]' \
- '--target=[target triple]' \
- '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
- '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
- '--color=:colorization option:(auto always never)' \
- ;;
-
- clean)
- _arguments \
- '(-h, --help)'{-h,--help}'[show help message]' \
- '--manifest-path=[path to manifest]: :_files -/' \
- '(-p,--package)'{-p=,--package=}'[package to clean]:packages:_get_package_names' \
- '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
- '--release[whether or not to clean release artifacts]' \
- '--target=[target triple(default:all)]' \
- '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
- '--color=:colorization option:(auto always never)' \
- ;;
-
- doc)
- _arguments \
- '--features=[space separated feature list]' \
- '--all-features[enable all available features]' \
- '(-h, --help)'{-h,--help}'[show help message]' \
- '(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \
- '--manifest-path=[path to manifest]: :_files -/' \
- '--no-deps[do not build docs for dependencies]' \
- '--no-default-features[do not build the default features]' \
- '--open[open docs in browser after the build]' \
- '(-p, --package)'{-p,--package}'=[package to document]' \
- '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
- '--release[build artifacts in release mode, with optimizations]' \
- '--target=[build for the target triple]' \
- '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
- '--color=:colorization option:(auto always never)' \
- ;;
-
- fetch)
- _arguments \
- '(-h, --help)'{-h,--help}'[show help message]' \
- '--manifest-path=[path to manifest]: :_files -/' \
- '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
- '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
- '--color=:colorization option:(auto always never)' \
- ;;
-
- generate-lockfile)
- _arguments \
- '(-h, --help)'{-h,--help}'[show help message]' \
- '--manifest-path=[path to manifest]: :_files -/' \
- '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
- '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
- '--color=:colorization option:(auto always never)' \
- ;;
-
- git-checkout)
- _arguments \
- '(-h, --help)'{-h,--help}'[show help message]' \
- '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
- '--reference=[REF]' \
- '--url=[URL]' \
- '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
- '--color=:colorization option:(auto always never)' \
- ;;
-
- help)
- _arguments \
- '(-h, --help)'{-h,--help}'[show help message]' \
- '*: :_cargo_cmds' \
- ;;
-
- init)
- _arguments \
- '--bin[use binary template]' \
- '--vcs:initialize a new repo with a given VCS:(git hg none)' \
- '(-h, --help)'{-h,--help}'[show help message]' \
- '--name=[set the resulting package name]' \
- '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
- '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
- '--color=:colorization option:(auto always never)' \
- ;;
-
- install)
- _arguments \
- '--bin=[only install the specified binary]' \
- '--branch=[branch to use when installing from git]' \
- '--color=:colorization option:(auto always never)' \
- '--debug[build in debug mode instead of release mode]' \
- '--example[install the specified example instead of binaries]' \
- '--features=[space separated feature list]' \
- '--all-features[enable all available features]' \
- '--git=[URL from which to install the crate]' \
- '(-h, --help)'{-h,--help}'[show help message]' \
- '(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \
- '--no-default-features[do not build the default features]' \
- '--path=[local filesystem path to crate to install]: :_files -/' \
- '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
- '--rev=[specific commit to use when installing from git]' \
- '--root=[directory to install packages into]: :_files -/' \
- '--tag=[tag to use when installing from git]' \
- '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
- '--vers=[version to install from crates.io]' \
- ;;
-
- locate-project)
- _arguments \
- '(-h, --help)'{-h,--help}'[show help message]' \
- '--manifest-path=[path to manifest]: :_files -/' \
- ;;
-
- login)
- _arguments \
- '(-h, --help)'{-h,--help}'[show help message]' \
- '--host=[Host to set the token for]' \
- '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
- '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
- '--color=:colorization option:(auto always never)' \
- ;;
-
- metadata)
- _arguments \
- '(-h, --help)'{-h,--help}'[show help message]' \
- '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
- '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
- "--no-deps[output information only about the root package and don't fetch dependencies]" \
- '--no-default-features[do not include the default feature]' \
- '--manifest-path=[path to manifest]: :_files -/' \
- '--features=[space separated feature list]' \
- '--all-features[enable all available features]' \
- '--format-version=[format version(default: 1)]' \
- '--color=:colorization option:(auto always never)' \
- ;;
-
- new)
- _arguments \
- '--bin[use binary template]' \
- '--vcs:initialize a new repo with a given VCS:(git hg none)' \
- '(-h, --help)'{-h,--help}'[show help message]' \
- '--name=[set the resulting package name]' \
- '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
- '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
- '--color=:colorization option:(auto always never)' \
- ;;
-
- owner)
- _arguments \
- '(-a, --add)'{-a,--add}'[add owner LOGIN]' \
- '(-h, --help)'{-h,--help}'[show help message]' \
- '--index[registry index]' \
- '(-l, --list)'{-l,--list}'[list owners of a crate]' \
- '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
- '(-r, --remove)'{-r,--remove}'[remove owner LOGIN]' \
- '--token[API token to use when authenticating]' \
- '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
- '--color=:colorization option:(auto always never)' \
- ;;
-
- package)
- _arguments \
- '(-h, --help)'{-h,--help}'[show help message]' \
- '(-l, --list)'{-l,--list}'[print files included in a package without making one]' \
- '--manifest-path=[path to manifest]: :_files -/' \
- '--no-metadata[ignore warnings about a lack of human-usable metadata]' \
- '--no-verify[do not build to verify contents]' \
- '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
- '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
- '--color=:colorization option:(auto always never)' \
- ;;
-
- pkgid)
- _arguments \
- '(-h, --help)'{-h,--help}'[show help message]' \
- '--manifest-path=[path to manifest]: :_files -/' \
- '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
- '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
- '--color=:colorization option:(auto always never)' \
- ;;
-
- publish)
- _arguments \
- '(-h, --help)'{-h,--help}'[show help message]' \
- '--host=[Host to set the token for]' \
- '--manifest-path=[path to manifest]: :_files -/' \
- '--no-verify[Do not verify tarball until before publish]' \
- '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
- '--token[token to use when uploading]' \
- '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
- '--color=:colorization option:(auto always never)' \
- ;;
-
- read-manifest)
- _arguments \
- '(-h, --help)'{-h,--help}'[show help message]' \
- '--manifest-path=[path to manifest]: :_files -/' \
- '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
- '--color=:colorization option:(auto always never)' \
- ;;
-
- run)
- _arguments \
- '--example=[name of the bin target]' \
- '--features=[space separated feature list]' \
- '--all-features[enable all available features]' \
- '(-h, --help)'{-h,--help}'[show help message]' \
- '(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \
- '--manifest-path=[path to manifest]: :_files -/' \
- '--bin=[name of the bin target]' \
- '--no-default-features[do not build the default features]' \
- '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
- '--release=[build in release mode]' \
- '--target=[target triple]' \
- '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
- '--color=:colorization option:(auto always never)' \
- '*: :_normal' \
- ;;
-
- rustc)
- _arguments \
- '--color=:colorization option:(auto always never)' \
- '--features=[features to compile for the package]' \
- '--all-features[enable all available features]' \
- '(-h, --help)'{-h,--help}'[show help message]' \
- '(-j, --jobs)'{-j,--jobs}'=[number of parallel jobs, defaults to # of CPUs]' \
- '--manifest-path=[path to the manifest to fetch dependencies for]: :_files -/' \
- '--no-default-features[do not compile default features for the package]' \
- '(-p, --package)'{-p,--package}'=[profile to compile for]' \
- '--profile=[profile to build the selected target for]' \
- '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
- '--release[build artifacts in release mode, with optimizations]' \
- '--target=[target triple which compiles will be for]' \
- '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
- "${command_scope_spec[@]}" \
- ;;
-
- rustdoc)
- _arguments \
- '--color=:colorization option:(auto always never)' \
- '--features=[space-separated list of features to also build]' \
- '--all-features[enable all available features]' \
- '(-h, --help)'{-h,--help}'[show help message]' \
- '(-j, --jobs)'{-j,--jobs}'=[number of parallel jobs, defaults to # of CPUs]' \
- '--manifest-path=[path to the manifest to document]: :_files -/' \
- '--no-default-features[do not build the `default` feature]' \
- '--open[open the docs in a browser after the operation]' \
- '(-p, --package)'{-p,--package}'=[package to document]' \
- '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
- '--release[build artifacts in release mode, with optimizations]' \
- '--target=[build for the target triple]' \
- '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
- "${command_scope_spec[@]}" \
- ;;
-
- search)
- _arguments \
- '--color=:colorization option:(auto always never)' \
- '(-h, --help)'{-h,--help}'[show help message]' \
- '--host=[host of a registry to search in]' \
- '--limit=[limit the number of results]' \
- '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
- '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
- ;;
-
- test)
- _arguments \
- '--features=[space separated feature list]' \
- '--all-features[enable all available features]' \
- '(-h, --help)'{-h,--help}'[show help message]' \
- '(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \
- '--manifest-path=[path to manifest]: :_files -/' \
- '--test=[test name]: :_test_names' \
- '--no-default-features[do not build the default features]' \
- '--no-fail-fast[run all tests regardless of failure]' \
- '--no-run[compile but do not run]' \
- '(-p,--package)'{-p=,--package=}'[package to run tests for]:packages:_get_package_names' \
- '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
- '--release[build artifacts in release mode, with optimizations]' \
- '--target=[target triple]' \
- '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
- '--color=:colorization option:(auto always never)' \
- '1: :_test_names' \
- '(--doc --bin --example --test --bench)--lib[only test library]' \
- '(--lib --bin --example --test --bench)--doc[only test documentation]' \
- '(--lib --doc --example --test --bench)--bin=[binary name]' \
- '(--lib --doc --bin --test --bench)--example=[example name]' \
- '(--lib --doc --bin --example --bench)--test=[test name]' \
- '(--lib --doc --bin --example --test)--bench=[benchmark name]' \
- '--message-format:error format:(human json short)' \
- '--frozen[require lock and cache up to date]' \
- '--locked[require lock up to date]'
- ;;
-
- uninstall)
- _arguments \
- '--bin=[only uninstall the binary NAME]' \
- '--color=:colorization option:(auto always never)' \
- '(-h, --help)'{-h,--help}'[show help message]' \
- '(-q, --quiet)'{-q,--quiet}'[less output printed to stdout]' \
- '--root=[directory to uninstall packages from]: :_files -/' \
- '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
- ;;
-
- update)
- _arguments \
- '--aggressive=[force dependency update]' \
- '(-h, --help)'{-h,--help}'[show help message]' \
- '--manifest-path=[path to manifest]: :_files -/' \
- '(-p,--package)'{-p=,--package=}'[package to update]:packages:__get_package_names' \
- '--precise=[update single dependency to PRECISE]: :' \
- '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
- '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
- '--color=:colorization option:(auto always never)' \
- ;;
-
- verify-project)
- _arguments \
- '(-h, --help)'{-h,--help}'[show help message]' \
- '--manifest-path=[path to manifest]: :_files -/' \
- '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
- '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
- '--color=:colorization option:(auto always never)' \
- ;;
-
- version)
- _arguments \
- '(-h, --help)'{-h,--help}'[show help message]' \
- '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
- '--color=:colorization option:(auto always never)' \
- ;;
-
- yank)
- _arguments \
- '(-h, --help)'{-h,--help}'[show help message]' \
- '--index[registry index]' \
- '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
- '--token[API token to use when authenticating]' \
- '--undo[undo a yank, putting a version back into the index]' \
- '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
- '--color=:colorization option:(auto always never)' \
- '--vers[yank version]' \
- ;;
- esac
- ;;
-esac
+ local curcontext="$curcontext" ret=1
+ local -a command_scope_spec common parallel features msgfmt triple target registry
+ local -a state line state_descr # These are set by _arguments
+ typeset -A opt_args
+
+ common=(
+ '(-q --quiet)*'{-v,--verbose}'[use verbose output]'
+ '(-q --quiet -v --verbose)'{-q,--quiet}'[no output printed to stdout]'
+ '-Z+[pass unstable (nightly-only) flags to cargo]: :_cargo_unstable_flags'
+ '--frozen[require that Cargo.lock and cache are up-to-date]'
+ '--locked[require that Cargo.lock is up-to-date]'
+ '--color=[specify colorization option]:coloring:(auto always never)'
+ '(- 1 *)'{-h,--help}'[show help message]'
+ )
+
+ # leading items in parentheses are an exclusion list for the arguments following that arg
+ # See: http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Completion-Functions
+ # - => exclude all other options
+ # 1 => exclude positional arg 1
+ # * => exclude all other args
+ # +blah => exclude +blah
+ _arguments -s -S -C $common \
+ '(- 1 *)--list[list installed commands]' \
+ '(- 1 *)--explain=[provide a detailed explanation of an error message]:error code' \
+ '(- 1 *)'{-V,--version}'[show version information]' \
+ '(+beta +nightly)+stable[use the stable toolchain]' \
+ '(+stable +nightly)+beta[use the beta toolchain]' \
+ '(+stable +beta)+nightly[use the nightly toolchain]' \
+ '1: :_cargo_cmds' \
+ '*:: :->args'
+
+ # These flags are mutually exclusive specifiers for the scope of a command; as
+ # they are used in multiple places without change, they are expanded into the
+ # appropriate command's `_arguments` where appropriate.
+ command_scope_spec=(
+ '(--bin --example --test --lib)--bench=[specify benchmark name]: :_cargo_benchmark_names'
+ '(--bench --bin --test --lib)--example=[specify example name]:example name'
+ '(--bench --example --test --lib)--bin=[specify binary name]:binary name'
+ '(--bench --bin --example --test)--lib=[specify library name]:library name'
+ '(--bench --bin --example --lib)--test=[specify test name]:test name'
+ )
+
+ parallel=(
+ '(-j --jobs)'{-j+,--jobs=}'[specify number of parallel jobs]:jobs [# of CPUs]'
+ )
+
+ features=(
+ '(--all-features)--features=[specify features to activate]:feature'
+ '(--features)--all-features[activate all available features]'
+ "--no-default-features[don't build the default features]"
+ )
+
+ msgfmt='--message-format=[specify error format]:error format [human]:(human json short)'
+ triple='--target=[specify target triple]:target triple'
+ target='--target-dir=[specify directory for all generated artifacts]:directory:_directories'
+ manifest='--manifest-path=[specify path to manifest]:path:_directories'
+ registry='--registry=[specify registry to use]:registry'
+
+ case $state in
+ args)
+ curcontext="${curcontext%:*}-${words[1]}:"
+ case ${words[1]} in
+ bench)
+ _arguments -s -A "^--" $common $parallel $features $msgfmt $triple $target $manifest \
+ "${command_scope_spec[@]}" \
+ '--all-targets[benchmark all targets]' \
+ "--no-run[compile but don't run]" \
+ '(-p --package)'{-p+,--package=}'[specify package to run benchmarks for]:package:_cargo_package_names' \
+ '--exclude=[exclude packages from the benchmark]:spec' \
+ '--no-fail-fast[run all benchmarks regardless of failure]' \
+ '1: :_guard "^-*" "bench name"' \
+ '*:args:_default'
+ ;;
+
+ build)
+ _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \
+ '--all-targets[equivalent to specifying --lib --bins --tests --benches --examples]' \
+ "${command_scope_spec[@]}" \
+ '(-p --package)'{-p+,--package=}'[specify package to build]:package:_cargo_package_names' \
+ '--release[build in release mode]' \
+ '--build-plan[output the build plan in JSON]' \
+ ;;
+
+ check)
+ _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \
+ '--all-targets[equivalent to specifying --lib --bins --tests --benches --examples]' \
+ "${command_scope_spec[@]}" \
+ '(-p --package)'{-p+,--package=}'[specify package to check]:package:_cargo_package_names' \
+ '--release[check in release mode]' \
+ ;;
+
+ clean)
+ _arguments -s -S $common $triple $target $manifest \
+ '(-p --package)'{-p+,--package=}'[specify package to clean]:package:_cargo_package_names' \
+ '--release[clean release artifacts]' \
+ '--doc[clean just the documentation directory]'
+ ;;
+
+ doc)
+ _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \
+ '--no-deps[do not build docs for dependencies]' \
+ '--document-private-items[include non-public items in the documentation]' \
+ '--open[open docs in browser after the build]' \
+ '(-p --package)'{-p+,--package=}'[specify package to document]:package:_cargo_package_names' \
+ '--release[build artifacts in release mode, with optimizations]' \
+ ;;
+
+ fetch)
+ _arguments -s -S $common $triple $manifest
+ ;;
+
+ fix)
+ _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \
+ "${command_scope_spec[@]}" \
+ '--broken-code[fix code even if it already has compiler errors]' \
+ '--edition[fix in preparation for the next edition]' \
+ '--edition-idioms[fix warnings to migrate to the idioms of an edition]' \
+ '--allow-no-vcs[fix code even if a VCS was not detected]' \
+ '--allow-dirty[fix code even if the working directory is dirty]' \
+ '--allow-staged[fix code even if the working directory has staged changes]'
+ ;;
+
+ generate-lockfile)
+ _arguments -s -S $common $manifest
+ ;;
+
+ git-checkout)
+ _arguments -s -S $common \
+ '--reference=:reference' \
+ '--url=:url:_urls'
+ ;;
+
+ help)
+ _cargo_cmds
+ ;;
+
+ init)
+ _arguments -s -S $common $registry \
+ '--lib[use library template]' \
+ '--edition=[specify edition to set for the crate generated]:edition:(2015 2018)' \
+ '--vcs=[initialize a new repo with a given VCS]:vcs:(git hg pijul fossil none)' \
+ '--name=[set the resulting package name]:name' \
+ '1:path:_directories'
+ ;;
+
+ install)
+ _arguments -s -S $common $parallel $features $triple $registry \
+ '(-f --force)'{-f,--force}'[force overwriting of existing crates or binaries]' \
+ '--bin=[only install the specified binary]:binary' \
+ '--branch=[branch to use when installing from git]:branch' \
+ '--debug[build in debug mode instead of release mode]' \
+ '--example=[install the specified example instead of binaries]:example' \
+ '--git=[specify URL from which to install the crate]:url:_urls' \
+ '--path=[local filesystem path to crate to install]: :_directories' \
+ '--rev=[specific commit to use when installing from git]:commit' \
+ '--root=[directory to install packages into]: :_directories' \
+ '--tag=[tag to use when installing from git]:tag' \
+ '--vers=[version to install from crates.io]:version' \
+ '--list[list all installed packages and their versions]' \
+ '*: :_guard "^-*" "crate"'
+ ;;
+
+ locate-project)
+ _arguments -s -S $common $manifest
+ ;;
+
+ login)
+ _arguments -s -S $common $registry \
+ '*: :_guard "^-*" "token"'
+ ;;
+
+ metadata)
+ _arguments -s -S $common $features $manifest \
+ "--no-deps[output information only about the root package and don't fetch dependencies]" \
+ '--format-version=[specify format version]:version [1]:(1)'
+ ;;
+
+ new)
+ _arguments -s -S $common $registry \
+ '--lib[use library template]' \
+ '--vcs:initialize a new repo with a given VCS:(git hg none)' \
+ '--name=[set the resulting package name]'
+ ;;
+
+ owner)
+ _arguments -s -S $common $registry \
+ '(-a --add)'{-a,--add}'[specify name of a user or team to invite as an owner]:name' \
+ '--index=[specify registry index]:index' \
+ '(-l --list)'{-l,--list}'[list owners of a crate]' \
+ '(-r --remove)'{-r,--remove}'[specify name of a user or team to remove as an owner]:name' \
+ '--token=[specify API token to use when authenticating]:token' \
+ '*: :_guard "^-*" "crate"'
+ ;;
+
+ package)
+ _arguments -s -S $common $parallel $features $triple $target $manifest \
+ '(-l --list)'{-l,--list}'[print files included in a package without making one]' \
+ '--no-metadata[ignore warnings about a lack of human-usable metadata]' \
+ '--allow-dirty[allow dirty working directories to be packaged]' \
+ "--no-verify[don't build to verify contents]"
+ ;;
+
+ pkgid)
+ _arguments -s -S $common $manifest \
+ '(-p --package)'{-p+,--package=}'[specify package to get ID specifier for]:package:_cargo_package_names' \
+ '*: :_guard "^-*" "spec"'
+ ;;
+
+ publish)
+ _arguments -s -S $common $parallel $features $triple $target $manifest $registry \
+ '--index=[specify registry index]:index' \
+ '--allow-dirty[allow dirty working directories to be packaged]' \
+ "--no-verify[don't verify the contents by building them]" \
+ '--token=[specify token to use when uploading]:token' \
+ '--dry-run[perform all checks without uploading]'
+ ;;
+
+ read-manifest)
+ _arguments -s -S $common $manifest
+ ;;
+
+ run)
+ _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \
+ '--example=[name of the bin target]:name' \
+ '--bin=[name of the bin target]:name' \
+ '(-p --package)'{-p+,--package=}'[specify package with the target to run]:package:_cargo_package_names' \
+ '--release[build in release mode]' \
+ '*: :_default'
+ ;;
+
+ rustc)
+ _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \
+ '(-p --package)'{-p+,--package=}'[specify package to build]:package:_cargo_package_names' \
+ '--profile=[specify profile to build the selected target for]:profile' \
+ '--release[build artifacts in release mode, with optimizations]' \
+ "${command_scope_spec[@]}" \
+ '*: : _dispatch rustc rustc -default-'
+ ;;
+
+ rustdoc)
+ _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \
+ '--document-private-items[include non-public items in the documentation]' \
+ '--open[open the docs in a browser after the operation]' \
+ '(-p --package)'{-p+,--package=}'[specify package to document]:package:_cargo_package_names' \
+ '--release[build artifacts in release mode, with optimizations]' \
+ "${command_scope_spec[@]}" \
+ '*: : _dispatch rustdoc rustdoc -default-'
+ ;;
+
+ search)
+ _arguments -s -S $common $registry \
+ '--index=[specify registry index]:index' \
+ '--limit=[limit the number of results]:results [10]' \
+ '*: :_guard "^-*" "query"'
+ ;;
+
+ test)
+ _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \
+ '--test=[test name]: :_cargo_test_names' \
+ '--no-fail-fast[run all tests regardless of failure]' \
+ '--no-run[compile but do not run]' \
+ '(-p --package)'{-p+,--package=}'[package to run tests for]:package:_cargo_package_names' \
+ '--all[test all packages in the workspace]' \
+ '--release[build artifacts in release mode, with optimizations]' \
+ '1: :_cargo_test_names' \
+ '(--doc --bin --example --test --bench)--lib[only test library]' \
+ '(--lib --bin --example --test --bench)--doc[only test documentation]' \
+ '(--lib --doc --example --test --bench)--bin=[binary name]' \
+ '(--lib --doc --bin --test --bench)--example=[example name]' \
+ '(--lib --doc --bin --example --bench)--test=[test name]' \
+ '(--lib --doc --bin --example --test)--bench=[benchmark name]' \
+ '*: :_default'
+ ;;
+
+ uninstall)
+ _arguments -s -S $common \
+ '(-p --package)'{-p+,--package=}'[specify package to uninstall]:package:_cargo_package_names' \
+ '--bin=[only uninstall the specified binary]:name' \
+ '--root=[directory to uninstall packages from]: :_files -/' \
+ '*:crate:_cargo_installed_crates -F line'
+ ;;
+
+ update)
+ _arguments -s -S $common $manifest \
+ '--aggressive=[force dependency update]' \
+ "--dry-run[don't actually write the lockfile]" \
+ '(-p --package)'{-p+,--package=}'[specify package to update]:package:_cargo_package_names' \
+ '--precise=[update single dependency to precise release]:release'
+ ;;
+
+ verify-project)
+ _arguments -s -S $common $manifest
+ ;;
+
+ version)
+ _arguments -s -S $common
+ ;;
+
+ yank)
+ _arguments -s -S $common $registry \
+ '--vers=[specify yank version]:version' \
+ '--undo[undo a yank, putting a version back into the index]' \
+ '--index=[specify registry index to yank from]:registry index' \
+ '--token=[specify API token to use when authenticating]:token' \
+ '*: :_guard "^-*" "crate"'
+ ;;
+ *)
+ # allow plugins to define their own functions
+ if ! _call_function ret _cargo-${words[1]}; then
+ # fallback on default completion for unknown commands
+ _default && ret=0
+ fi
+ (( ! ret ))
+ ;;
+ esac
+ ;;
+ esac
+}
+
+_cargo_unstable_flags() {
+ local flags
+ flags=( help ${${${(M)${(f)"$(_call_program flags cargo -Z help)"}:#*--*}/ #-- #/:}##*-Z } )
+ _describe -t flags 'unstable flag' flags
}
-_cargo_cmds(){
-local -a commands;commands=(
-'bench:execute all benchmarks of a local package'
-'build:compile the current package'
-'check:check the current package without compiling'
-'clean:remove generated artifacts'
-'doc:build package documentation'
-'fetch:fetch package dependencies'
-'generate-lockfile:create lockfile'
-'git-checkout:git checkout'
-'help:get help for commands'
-'init:create new package in current directory'
-'install:install a Rust binary'
-'locate-project:print "Cargo.toml" location'
-'login:login to remote server'
-'metadata:the metadata for a package in json'
-'new:create a new package'
-'owner:manage the owners of a crate on the registry'
-'package:assemble local package into a distributable tarball'
-'pkgid:print a fully qualified package specification'
-'publish:upload package to the registry'
-'read-manifest:print manifest in JSON format'
-'run:run the main binary of the local package'
-'rustc:compile a package and all of its dependencies'
-'rustdoc:build documentation for a package'
-'search:search packages on crates.io'
-'test:execute all unit and tests of a local package'
-'uninstall:remove a Rust binary'
-'update:update dependencies'
-'verify-project:check Cargo.toml'
-'version:show version information'
-'yank:remove pushed file from index'
-)
-_describe -t common-commands 'common commands' commands
+_cargo_installed_crates() {
+ local expl
+ _description crates expl 'crate'
+ compadd "$@" "$expl[@]" - ${${${(f)"$(cargo install --list)"}:# *}%% *}
}
-_cargo_all_cmds(){
-local -a commands;commands=($(cargo --list))
-_describe -t all-commands 'all commands' commands
+_cargo_cmds() {
+ local -a commands
+ # This uses Parameter Expansion Flags, which are a built-in Zsh feature.
+ # See more: http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion-Flags
+ # and http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion
+ #
+ # # How this work?
+ #
+ # First it splits the result of `cargo --list` at newline, then it removes the first line.
+ # Then it removes indentation (4 whitespaces) before each items. (Note the x## pattern [1]).
+ # Then it replaces those spaces between item and description with a `:`
+ #
+ # [1]: https://github.com/zsh-users/zsh-completions/blob/master/zsh-completions-howto.org#patterns
+ commands=( ${${${(M)"${(f)$(_call_program commands cargo --list)}":# *}/ ##/}/ ##/:} )
+ _describe -t commands 'command' commands
}
#FIXME: Disabled until fixed
#gets package names from the manifest file
-_get_package_names()
-{
-}
-
-#TODO:see if it makes sense to have 'locate-project' to have non-json output.
-#strips package name from json stuff
-_locate_manifest(){
-local manifest=`cargo locate-project 2>/dev/null`
-regexp-replace manifest '\{"root":"|"\}' ''
-echo $manifest
+_cargo_package_names() {
+ _message -e packages package
}
# Extracts the values of "name" from the array given in $1 and shows them as
# command line options for completion
-_get_names_from_array()
-{
- local -a filelist;
- local manifest=$(_locate_manifest)
+_cargo_names_from_array() {
+ # strip json from the path
+ local manifest=${${${"$(cargo locate-project)"}%\"\}}##*\"}
if [[ -z $manifest ]]; then
return 0
fi
@@ -494,51 +372,36 @@ _get_names_from_array()
local in_block=false
local block_name=$1
names=()
- while read line
- do
+ while read -r line; do
if [[ $last_line == "[[$block_name]]" ]]; then
in_block=true
else
- if [[ $last_line =~ '.*\[\[.*' ]]; then
+ if [[ $last_line =~ '\s*\[\[.*' ]]; then
in_block=false
fi
fi
if [[ $in_block == true ]]; then
- if [[ $line =~ '.*name.*=' ]]; then
- regexp-replace line '^.*name *= *|"' ""
- names+=$line
+ if [[ $line =~ '\s*name\s*=' ]]; then
+ regexp-replace line '^\s*name\s*=\s*|"' ''
+ names+=( "$line" )
fi
fi
last_line=$line
- done < $manifest
- _describe $block_name names
+ done < "$manifest"
+ _describe "$block_name" names
}
#Gets the test names from the manifest file
-_test_names()
-{
- _get_names_from_array "test"
+_cargo_test_names() {
+ _cargo_names_from_array "test"
}
#Gets the bench names from the manifest file
-_benchmark_names()
-{
- _get_names_from_array "bench"
+_cargo_benchmark_names() {
+ _cargo_names_from_array "bench"
}
-# These flags are mutually exclusive specifiers for the scope of a command; as
-# they are used in multiple places without change, they are expanded into the
-# appropriate command's `_arguments` where appropriate.
-set command_scope_spec
-command_scope_spec=(
- '(--bin --example --test --lib)--bench=[benchmark name]: :_benchmark_names'
- '(--bench --bin --test --lib)--example=[example name]'
- '(--bench --example --test --lib)--bin=[binary name]'
- '(--bench --bin --example --test)--lib=[library name]'
- '(--bench --bin --example --lib)--test=[test name]'
-)
-
_cargo
diff --git a/plugins/catimg/README.md b/plugins/catimg/README.md
index 2fc28a1c6..42b59a62c 100644
--- a/plugins/catimg/README.md
+++ b/plugins/catimg/README.md
@@ -17,10 +17,10 @@ Plugin for displaying images on the terminal using the the `catimg.sh` script pr
)
```
-2. Reload the source file or restart your Terminal session:
+2. Restart the shell or restart your Terminal session:
```console
- $ source ~/.zshrc
+ $ exec zsh
$
```
diff --git a/plugins/catimg/catimg.plugin.zsh b/plugins/catimg/catimg.plugin.zsh
index 5f58ecde3..ca46444cc 100644
--- a/plugins/catimg/catimg.plugin.zsh
+++ b/plugins/catimg/catimg.plugin.zsh
@@ -4,7 +4,7 @@
# #
# Ouput the content of an image to the stdout using the 256 colors of the #
# terminal. #
-# Github: https://github.com/posva/catimg #
+# GitHub: https://github.com/posva/catimg #
################################################################################
diff --git a/plugins/catimg/catimg.sh b/plugins/catimg/catimg.sh
index 83ccf6a95..713a03291 100644
--- a/plugins/catimg/catimg.sh
+++ b/plugins/catimg/catimg.sh
@@ -4,7 +4,7 @@
# #
# Ouput the content of an image to the stdout using the 256 colors of the #
# terminal. #
-# Github: https://github.com/posva/catimg #
+# GitHub: https://github.com/posva/catimg #
################################################################################
function help() {
diff --git a/plugins/chruby/README.md b/plugins/chruby/README.md
new file mode 100644
index 000000000..d373006a5
--- /dev/null
+++ b/plugins/chruby/README.md
@@ -0,0 +1,20 @@
+# chruby plugin
+
+This plugin loads [chruby](https://github.com/postmodern/chruby), a tool that changes the
+current Ruby version, and completion and a prompt function to display the Ruby version.
+Supports brew and manual installation of chruby.
+
+To use it, add `chruby` to the plugins array in your zshrc file:
+```zsh
+plugins=(... chruby)
+```
+
+## Usage
+
+If you'd prefer to specify an explicit path to load chruby from
+you can set variables like so:
+
+```
+zstyle :omz:plugins:chruby path /local/path/to/chruby.sh
+zstyle :omz:plugins:chruby auto /local/path/to/auto.sh
+```
diff --git a/plugins/cloudapp/README.md b/plugins/cloudapp/README.md
new file mode 100644
index 000000000..62975a631
--- /dev/null
+++ b/plugins/cloudapp/README.md
@@ -0,0 +1,24 @@
+# CloudApp plugin
+
+[CloudApp](https://www.getcloudapp.com) brings screen recording, screenshots, and GIF creation to the cloud, in an easy-to-use enterprise-level app. The CloudApp plugin allows you to upload a file to your CloadApp account from the command line.
+
+To use it, add `cloudapp` to the plugins array of your `~/.zshrc` file:
+
+```
+plugins=(... dash)
+```
+
+## Requirements
+
+1. [Aaron Russell's `cloudapp_api` gem](https://github.com/aaronrussell/cloudapp_api#installation)
+
+2. That you set your CloudApp credentials in `~/.cloudapp` as a simple text file like below:
+ ```
+ email
+ password
+ ```
+
+## Usage
+
+- `cloudapp <filename>`: uploads `<filename>` to your CloudApp account, and if you're using
+ macOS, copies the URL to your clipboard.
diff --git a/plugins/cloudapp/cloudapp.plugin.zsh b/plugins/cloudapp/cloudapp.plugin.zsh
index 99252f690..3b363c81b 100644
--- a/plugins/cloudapp/cloudapp.plugin.zsh
+++ b/plugins/cloudapp/cloudapp.plugin.zsh
@@ -1,2 +1,6 @@
-#!/bin/zsh
-alias cloudapp=$ZSH/plugins/cloudapp/cloudapp.rb
+alias cloudapp="${0:a:h}/cloudapp.rb"
+
+# Ensure only the owner can access the credentials file
+if [[ -f ~/.cloudapp ]]; then
+ chmod 600 ~/.cloudapp
+fi
diff --git a/plugins/colemak/README.md b/plugins/colemak/README.md
new file mode 100644
index 000000000..4da4bc126
--- /dev/null
+++ b/plugins/colemak/README.md
@@ -0,0 +1,48 @@
+# Colemak plugin
+
+This plugin remaps keys in `zsh`'s [`vi`-style navigation mode](http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Keymaps)
+for a [Colemak](https://colemak.com/) keyboard layout, to match the QWERTY position:
+
+![Colemak layout on a US keyboard](https://colemak.com/wiki/images/6/6c/Colemak2.png)
+
+To use it, add it to the plugins array in your `~/.zshrc` file:
+
+```
+plugins=(... colemak)
+```
+
+You will also need to enable `vi` mode, so add another line to `~/.zshrc`:
+```
+bindkey -v
+```
+
+Restart your shell and hit the `<ESC>` key to activate `vicmd` (navigation) mode,
+and start navigating `zsh` with your new keybindings!
+
+## Key bindings for vicmd
+
+| Old | New | Binding | Description |
+|------------|------------|---------------------------|----------------------------------------------------|
+| `CTRL`+`j` | `CTRL`+`n` | accept-line | Insert new line |
+| `j` | `n` | down-line-or-history | Move one line down or command history forwards |
+| `k` | `e` | up-line-or-history | Move one line up or command history backwards |
+| `l` | `i` | vi-forward-char | Move one character to the right |
+| `n` | `k` | vi-repeat-search | Repeat command search forwards |
+| `N` | `K` | vi-rev-repeat-search | Repeat command search backwards |
+| `i` | `u` | vi-insert | Enter insert mode |
+| `I` | `U` | vi-insert-bol | Move to first non-blank char and enter insert mode |
+| `<none>` | `l` | vi-undo-change | Undo change |
+| `J` | `N` | vi-join | Join the current line with the next one |
+| `e` | `j` | vi-forward-word-end | Move to the end of the next word |
+| `E` | `J` | vi-forward-blank-word-end | Move to end of the current or next word |
+
+## Key bindings for less
+
+| Keyboard shortcut | `less` key binding |
+|-------------------|--------------------|
+| `n` | forw-line |
+| `e` | back-line |
+| `k` | repeat-search |
+| `ESC`+`k` | repeat-search-all |
+| `K` | reverse-search |
+| `ESC`+`K` | reverse-search-all |
diff --git a/plugins/colored-man-pages/README.md b/plugins/colored-man-pages/README.md
new file mode 100644
index 000000000..d9f6acb2a
--- /dev/null
+++ b/plugins/colored-man-pages/README.md
@@ -0,0 +1,15 @@
+# Colored man pages plugin
+
+This plugin adds colors to man pages.
+
+To use it, add `colored-man-pages` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... colored-man-pages)
+```
+
+You can also try to color other pages by prefixing the respective command with `colored`:
+
+```zsh
+colored git help clone
+```
diff --git a/plugins/colored-man-pages/colored-man-pages.plugin.zsh b/plugins/colored-man-pages/colored-man-pages.plugin.zsh
index 1bea536e0..ac6a94654 100644
--- a/plugins/colored-man-pages/colored-man-pages.plugin.zsh
+++ b/plugins/colored-man-pages/colored-man-pages.plugin.zsh
@@ -16,7 +16,7 @@ EOF
fi
fi
-function man() {
+function colored() {
env \
LESS_TERMCAP_mb=$(printf "\e[1;31m") \
LESS_TERMCAP_md=$(printf "\e[1;31m") \
@@ -28,5 +28,9 @@ function man() {
PAGER="${commands[less]:-$PAGER}" \
_NROFF_U=1 \
PATH="$HOME/bin:$PATH" \
- man "$@"
+ "$@"
+}
+
+function man() {
+ colored man "$@"
}
diff --git a/plugins/colorize/README.md b/plugins/colorize/README.md
index c006071f9..036724a1a 100644
--- a/plugins/colorize/README.md
+++ b/plugins/colorize/README.md
@@ -2,17 +2,36 @@
With this plugin you can syntax-highlight file contents of over 300 supported languages and other text formats.
+Colorize will highlight the content based on the filename extension. If it can't find a syntax-highlighting
+method for a given extension, it will try to find one by looking at the file contents. If no highlight method
+is found it will just cat the file normally, without syntax highlighting.
+
+## Setup
+
To use it, add colorize to the plugins array of your zshrc file:
```
plugins=(... colorize)
```
-## Usage
+### Requirements
+
+This plugin requires that Pygments be installed: [pygments.org](https://pygments.org/)
-* `ccat <file> [files]`: colorize the contents of the file (or files, if more than one are provided). If no arguments are passed it will colorize the standard input or stdin.
+## Styles
+
+Pygments offers multiple styles. By default, the `default` style is used, but you can choose another theme by setting the `ZSH_COLORIZE_STYLE` environment variable:
+
+`ZSH_COLORIZE_STYLE="colorful"`
+
+## Usage
-Colorize will highlight the content based on the filename extension. If it can't find a syntax-highlighting method for a given extension, it will try to find one by looking at the file contents. If no highlight method is found it will just cat the file normally, without syntax highlighting.
+* `ccat <file> [files]`: colorize the contents of the file (or files, if more than one are provided).
+ If no arguments are passed it will colorize the standard input or stdin.
-## Requirements
+* `cless <file> [files]`: colorize the contents of the file (or files, if more than one are provided) and
+ open less. If no arguments are passed it will colorize the standard input or stdin.
-You have to install Pygments first: [pygments.org](http://pygments.org/download/)
+Note that `cless` will behave as less when provided more than one file: you have to navigate files with
+the commands `:n` for next and `:p` for previous. The downside is that less options are not supported.
+But you can circumvent this by either using the LESS environment variable, or by running `ccat file1 file2|less --opts`.
+In the latter form, the file contents will be concatenated and presented by less as a single file.
diff --git a/plugins/colorize/colorize.plugin.zsh b/plugins/colorize/colorize.plugin.zsh
index d52e95c49..a006a7828 100644
--- a/plugins/colorize/colorize.plugin.zsh
+++ b/plugins/colorize/colorize.plugin.zsh
@@ -1,5 +1,6 @@
# easier alias to use the plugin
alias ccat='colorize_via_pygmentize'
+alias cless='colorize_via_pygmentize_less'
colorize_via_pygmentize() {
if ! (( $+commands[pygmentize] )); then
@@ -7,22 +8,50 @@ colorize_via_pygmentize() {
return 1
fi
+ # If the environment varianle ZSH_COLORIZE_STYLE
+ # is set, use that theme instead. Otherwise,
+ # use the default.
+ if [ -z $ZSH_COLORIZE_STYLE ]; then
+ ZSH_COLORIZE_STYLE="default"
+ fi
+
# pygmentize stdin if no arguments passed
if [ $# -eq 0 ]; then
- pygmentize -f terminal -g
+ pygmentize -O style="$ZSH_COLORIZE_STYLE" -g
return $?
fi
# guess lexer from file extension, or
# guess it from file contents if unsuccessful
+
local FNAME lexer
- for FNAME in $@
+ for FNAME in "$@"
do
lexer=$(pygmentize -N "$FNAME")
if [[ $lexer != text ]]; then
- pygmentize -f terminal -l "$lexer" "$FNAME"
+ pygmentize -O style="$ZSH_COLORIZE_STYLE" -l "$lexer" "$FNAME"
else
- pygmentize -f terminal -g "$FNAME"
+ pygmentize -O style="$ZSH_COLORIZE_STYLE" -g "$FNAME"
fi
done
}
+
+colorize_via_pygmentize_less() (
+ # this function is a subshell so tmp_files can be shared to cleanup function
+ declare -a tmp_files
+
+ cleanup () {
+ [[ ${#tmp_files} -gt 0 ]] && rm -f "${tmp_files[@]}"
+ exit
+ }
+ trap 'cleanup' EXIT HUP TERM INT
+
+ while (( $# != 0 )); do #TODO: filter out less opts
+ tmp_file="$(mktemp -t "tmp.colorize.XXXX.$(sed 's/\//./g' <<< "$1")")"
+ tmp_files+=("$tmp_file")
+ colorize_via_pygmentize "$1" > "$tmp_file"
+ shift 1
+ done
+
+ less -f "${tmp_files[@]}"
+)
diff --git a/plugins/common-aliases/README.md b/plugins/common-aliases/README.md
new file mode 100644
index 000000000..d198a29ac
--- /dev/null
+++ b/plugins/common-aliases/README.md
@@ -0,0 +1,121 @@
+# Common Aliases Plugin
+
+This plugin creates helpful shortcut aliases for many commonly used commands.
+
+To use it add `common-aliases` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... common-aliases)
+```
+
+## Aliases
+
+### ls command
+
+| Alias | Command | Description |
+|-------|---------------|--------------------------------------------------------------------------------|
+| l | `ls -lFh` | List files as a long list, show size, type, human-readable |
+| la | `ls -lAFh` | List almost all files as a long list show size, type, human-readable |
+| lr | `ls -tRFh` | List files recursively sorted by date, show type, human-readable |
+| lt | `ls -ltFh` | List files as a long list sorted by date, show type, human-readable |
+| ll | `ls -l` | List files as a long list |
+| ldot | `ls -ld .*` | List dot files as a long list |
+| lS | `ls -1FSsh` | List files showing only size and name sorted by size |
+| lart | `ls -1Fcart` | List all files sorted in reverse of create/modification time (oldest first) |
+| lrt | `ls -1Fcrt` | List files sorted in reverse of create/modification time(oldest first) |
+
+### File handling
+
+| Alias | Command | Description |
+|-------|-----------------------|------------------------------------------------------------------------------------|
+| rm | `rm -i` | Remove a file |
+| cp | `cp -i` | Copy a file |
+| mv | `mv -i` | Move a file |
+| zshrc | `${=EDITOR} ~/.zshrc` | Quickly access the ~/.zshrc file |
+| dud | `du -d 1 -h` | Display the size of files at depth 1 in current location in human-readable form |
+| duf | `du -sh` | Display the size of files in current location in human-readable form |
+| t | `tail -f` | Shorthand for tail which outputs the last part of a file |
+
+### find and grep
+
+| Alias | Command | Description |
+|-------|-----------------------------------------------------|-----------------------------------------|
+| fd | `find . -type d -name` | Find a directory with the given name |
+| ff | `find . -type f -name` | Find a file with the given name |
+| grep | `grep --color` | Searches for a query string |
+| sgrep | `grep -R -n -H -C 5 --exclude-dir={.git,.svn,CVS}` | Useful for searching within files |
+
+### Other Aliases
+
+| Alias | Command | Description |
+|-----------|---------------------|-------------------------------------------------------------|
+| h | `history` | Lists all recently used commands |
+| hgrep | `fc -El 0 \| grep` | Searches for a word in the list of previously used commands |
+| help | `man` | Opens up the man page for a command |
+| p | `ps -f` | Displays currently executing processes |
+| sortnr | `sort -n -r` | Used to sort the lines of a text file |
+| unexport | `unset` | Used to unset an environment variable |
+
+## Global aliases
+
+These aliases are expanded in any position in the command line, meaning you can use them even at the
+end of the command you've typed. Examples:
+
+Quickly pipe to less:
+```zsh
+$ ls -l /var/log L
+# will run
+$ ls -l /var/log | less
+```
+Silences stderr output:
+```zsh
+$ find . -type f NE
+# will run
+$ find . -type f 2>/dev/null
+```
+
+| Alias | Command | Description |
+|-------|-----------------------------|-------------------------------------------------------------|
+| H | `\| head` | Pipes output to head which outputs the first part of a file |
+| T | `\| tail` | Pipes output to tail which outputs the last part of a file |
+| G | `\| grep` | Pipes output to grep to search for some word |
+| L | `\| less` | Pipes output to less, useful for paging |
+| M | `\| most` | Pipes output to more, useful for paging |
+| LL | `2>&1 \| less` | Writes stderr to stdout and passes it to less |
+| CA | `2>&1 \| cat -A` | Writes stderr to stdout and passes it to cat |
+| NE | `2 > /dev/null` | Silences stderr |
+| NUL | `> /dev/null 2>&1` | Silences both stdout and stderr |
+| P | `2>&1\| pygmentize -l pytb` | Writes stderr to stdout and passes it to pygmentize |
+
+## File extension aliases
+
+These are special aliases that are triggered when a file name is passed as the command. For example,
+if the pdf file extension is aliased to `acroread` (a popular Linux pdf reader), when running `file.pdf`
+that file will be open with `acroread`.
+
+### Reading Docs
+
+| Alias | Command | Description |
+|-------|-------------|-------------------------------------|
+| pdf | `acroread` | Opens up a document using acroread |
+| ps | `gv` | Opens up a .ps file using gv |
+| dvi | `xdvi` | Opens up a .dvi file using xdvi |
+| chm | `xchm` | Opens up a .chm file using xchm |
+| djvu | `djview` | Opens up a .djvu file using djview |
+
+### Listing files inside a packed file
+
+| Alias | Command | Description |
+|---------|-------------|-------------------------------------|
+| zip | `unzip -l` | Lists files inside a .zip file |
+| rar | `unrar l` | Lists files inside a .rar file |
+| tar | `tar tf` | Lists files inside a .tar file |
+| tar.gz | `echo` | Lists files inside a .tar.gz file |
+| ace | `unace l` | Lists files inside a .ace file |
+
+### Some other features
+
+- Opens urls in terminal using browser specified by the variable `$BROWSER`
+- Opens C, C++, Tex and text files using editor specified by the variable `$EDITOR`
+- Opens images using image viewer specified by the variable `$XIVIEWER`
+- Opens videos and other media using mplayer
diff --git a/plugins/compleat/README.md b/plugins/compleat/README.md
new file mode 100644
index 000000000..630c91503
--- /dev/null
+++ b/plugins/compleat/README.md
@@ -0,0 +1,8 @@
+# compleat plugin
+
+This plugin looks for [compleat](https://github.com/mbrubeck/compleat) and loads its completion.
+
+To use it, add compleat to the plugins array in your zshrc file:
+```
+plugins=(... compleat)
+```
diff --git a/plugins/dash/README.md b/plugins/dash/README.md
new file mode 100644
index 000000000..0ca3e4e44
--- /dev/null
+++ b/plugins/dash/README.md
@@ -0,0 +1,28 @@
+# Dash plugin
+
+This plugin adds command line functionality for [Dash](https://kapeli.com/dash),
+an API Documentation Browser for macOS. This plugin requires Dash to be installed
+to work.
+
+To use it, add `dash` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... dash)
+```
+
+## Usage
+
+- Open and switch to the dash application.
+```
+dash
+```
+
+- Query for something in dash app: `dash query`
+```
+dash golang
+```
+
+- You can optionally provide a keyword: `dash [keyword:]query`
+```
+dash python:tuple
+```
diff --git a/plugins/dash/dash.plugin.zsh b/plugins/dash/dash.plugin.zsh
index b00d4877e..ace2e33c1 100644
--- a/plugins/dash/dash.plugin.zsh
+++ b/plugins/dash/dash.plugin.zsh
@@ -35,36 +35,30 @@ _dash() {
if [[ "$locator" == "platform" ]]; then
# Since these are the only special cases right now, let's not do the
# expensive processing unless we have to
- if [[ "$keyword" == "python" || "$keyword" == "java" || \
- "$keyword" == "qt" || "$keyword" == "cocs2d" ]]; then
+ if [[ "$keyword" = (python|java|qt|cocos2d) ]]; then
docsetName=`echo $doc | grep -Eo "docsetName = .*?;" | sed -e "s/docsetName = \(.*\);/\1/" -e "s/[\":]//g"`
- if [[ "$keyword" == "python" ]]; then
- if [[ "$docsetName" == "Python 2" ]]; then
- keyword="python2"
- elif [[ "$docsetName" == "Python 3" ]]; then
- keyword="python3"
- fi
- elif [[ "$keyword" == "java" ]]; then
- if [[ "$docsetName" == "Java SE7" ]]; then
- keyword="java7"
- elif [[ "$docsetName" == "Java SE6" ]]; then
- keyword="java6"
- elif [[ "$docsetName" == "Java SE8" ]]; then
- keyword="java8"
- fi
- elif [[ "$keyword" == "qt" ]]; then
- if [[ "$docsetName" == "Qt 5" ]]; then
- keyword="qt5"
- elif [[ "$docsetName" == "Qt 4" ]]; then
- keyword="qt4"
- elif [[ "$docsetName" == "Qt" ]]; then
- keyword="qt4"
- fi
- elif [[ "$keyword" == "cocos2d" ]]; then
- if [[ "$docsetName" == "Cocos3D" ]]; then
- keyword="cocos3d"
- fi
- fi
+ case "$keyword" in
+ python)
+ case "$docsetName" in
+ "Python 2") keyword="python2" ;;
+ "Python 3") keyword="python3" ;;
+ esac ;;
+ java)
+ case "$docsetName" in
+ "Java SE7") keyword="java7" ;;
+ "Java SE6") keyword="java6" ;;
+ "Java SE8") keyword="java8" ;;
+ esac ;;
+ qt)
+ case "$docsetName" in
+ "Qt 5") keyword="qt5" ;;
+ "Qt 4"|Qt) keyword="qt4" ;;
+ esac ;;
+ cocos2d)
+ case "$docsetName" in
+ Cocos3D) keyword="cocos3d" ;;
+ esac ;;
+ esac
fi
fi
diff --git a/plugins/debian/README.md b/plugins/debian/README.md
index a676674dc..da5675c66 100644
--- a/plugins/debian/README.md
+++ b/plugins/debian/README.md
@@ -1,75 +1,85 @@
# debian
-This plugin provides debian related zsh aliases.
+This plugin provides Debian-related aliases and functions for zsh.
+
To use it add `debian` to the plugins array in your zshrc file.
```zsh
plugins=(... debian)
```
+## Settings
+
+- `$apt_pref`: use apt or aptitude if installed, fallback is apt-get.
+- `$apt_upgr`: use upgrade or safe-upgrade (for aptitude).
+
+Set `$apt_pref` and `$apt_upgr` to whatever command you want (before sourcing Oh My Zsh) to override this behavior.
+
## Common Aliases
-| Alias | Command | Description |
-| -------- | ------------------------------------------------------------------------------|--------------------------------------------------------------------------- |
-| `age` | apt-get | Command line tool for handling packages |
-| `api` | aptitude | Same functionality as `apt-get`, provides extra options while installation |
-| `acs` | apt-cache search | Command line tool for searching apt software package cache |
-| `aps` | aptitude search | Searches installed packages using aptitude |
-| `as` | aptitude -F \"* %p -> %d \n(%v/%V)\" \ -no-gui --disable-columns search | - |
-| `afs` | apt-file search --regexp | Search file in packages |
-| `asrc` | apt-get source | Fetch source packages through `apt-get` |
-| `app` | apt-cache policy | Displays priority of package sources |
+| Alias | Command | Description |
+| ------ | ---------------------------------------------------------------------- | ---------------------------------------------------------- |
+| `age` | `apt-get` | Command line tool for handling packages |
+| `api` | `aptitude` | Same functionality as `apt-get`, provides extra options |
+| `acs` | `apt-cache search` | Command line tool for searching apt software package cache |
+| `aps` | `aptitude search` | Searches installed packages using aptitude |
+| `as` | `aptitude -F '* %p -> %d \n(%v/%V)' --no-gui --disable-columns search` | Print searched packages using a custom format |
+| `afs` | `apt-file search --regexp` | Search file in packages |
+| `asrc` | `apt-get source` | Fetch source packages through `apt-get` |
+| `app` | `apt-cache policy` | Displays priority of package sources |
## Superuser Operations Aliases
-| Alias | Command | Description |
-| -------- | -------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------- |
-| `aac` | sudo $apt_pref autoclean | Clears out the local repository of retrieved package files |
-| `abd` | sudo $apt_pref build-dep | Installs all dependencies for building packages |
-| `ac` | sudo $apt_pref clean | Clears out the local repository of retrieved package files except lock files |
-| `ad` | sudo $apt_pref update | Updates the package lists for upgrades for packages |
-| `adg` | sudo $apt_pref update && sudo $apt_pref $apt_upgr | Update and upgrade packages |
-| `adu` | sudo $apt_pref update && sudo $apt_pref dist-upgrade | Smart upgrade that handles dependencies |
-| `afu` | sudo apt-file update | Update the files in packages |
-| `au` | sudo $apt_pref $apt_upgr | - |
-| `ai` | sudo $apt_pref install | Command-line tool to install package |
-| `ail` | sed -e 's/ */ /g' -e 's/ *//' &#124; cut -s -d ' ' -f 1 &#124; "' xargs sudo $apt_pref install | Install all packages given on the command line while using only the first word of each line |
-| `ap` | sudo $apt_pref purge | Removes packages along with configuration files |
-| `ar` | sudo $apt_pref remove | Removes packages, keeps the configuration files |
-| `ads` | sudo apt-get dselect-upgrade | Installs packages from list and removes all not in the list |
-| `dia` | sudo dpkg -i ./*.deb | Install all .deb files in the current directory |
-| `di` | sudo dpkg -i | Install all .deb files in the current directory |
-| `kclean` | sudo aptitude remove -P ?and(~i~nlinux-(ima&#124;hea) ?not(~n`uname -r`)) | Remove ALL kernel images and headers EXCEPT the one in use |
-
-- `$apt_pref` - Use apt or aptitude if installed, fallback is apt-get.
-- `$apt_upgr` - Use upgrade.
+| Alias | Command | Description |
+| -------- | -------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
+| `aac` | `sudo $apt_pref autoclean` | Clears out the local repository of retrieved package files |
+| `abd` | `sudo $apt_pref build-dep` | Installs all dependencies for building packages |
+| `ac` | `sudo $apt_pref clean` | Clears out the local repository of retrieved package files except lock files |
+| `ad` | `sudo $apt_pref update` | Updates the package lists for upgrades for packages |
+| `adg` | `sudo $apt_pref update && sudo $apt_pref $apt_upgr` | Update and upgrade packages |
+| `adu` | `sudo $apt_pref update && sudo $apt_pref dist-upgrade` | Smart upgrade that handles dependencies |
+| `afu` | `sudo apt-file update` | Update the files in packages |
+| `au` | `sudo $apt_pref $apt_upgr` | Install package upgrades |
+| `ai` | `sudo $apt_pref install` | Command-line tool to install package |
+| `ail` | `sed -e 's/ */ /g' -e 's/ *//' \| cut -s -d ' ' -f 1 \| xargs sudo $apt_pref install` | Install all packages given on the command line while using only the first word of each line |
+| `ap` | `sudo $apt_pref purge` | Removes packages along with configuration files |
+| `ar` | `sudo $apt_pref remove` | Removes packages, keeps the configuration files |
+| `ads` | `sudo apt-get dselect-upgrade` | Installs packages from list and removes all not in the list |
+| `dia` | `sudo dpkg -i ./*.deb` | Install all .deb files in the current directory |
+| `di` | `sudo dpkg -i` | Install all .deb files in the current directory |
+| `kclean` | `sudo aptitude remove -P ?and(~i~nlinux-(ima\|hea) ?not(~n$(uname -r)))` | Remove ALL kernel images and headers EXCEPT the one in use |
## Aliases - Commands using `su`
-| Alias | Command |
-| -------- | ------------------------------------------------------------------------------|
-| `aac` | su -ls \'$apt_pref autoclean\' root |
-| `ac` | su -ls \'$apt_pref clean\' root |
-| `ad` | su -lc \'$apt_pref update\' root |
-| `adg` | su -lc \'$apt_pref update && aptitude $apt_upgr\' root |
-| `adu` | su -lc \'$apt_pref update && aptitude dist-upgrade\' root |
-| `afu` | su -lc "apt-file update |
-| `ag` | su -lc \'$apt_pref $apt_upgr\' root |
-| `dia` | su -lc "dpkg -i ./*.deb" root |
+| Alias | Command |
+| ----- | --------------------------------------------------------- |
+| `aac` | `su -ls "$apt_pref autoclean" root` |
+| `ac` | `su -ls "$apt_pref clean" root` |
+| `ad` | `su -lc "$apt_pref update" root` |
+| `adg` | `su -lc "$apt_pref update && aptitude $apt_upgr" root` |
+| `adu` | `su -lc "$apt_pref update && aptitude dist-upgrade" root` |
+| `afu` | `su -lc "apt-file update"` |
+| `au` | `su -lc "$apt_pref $apt_upgr" root` |
+| `dia` | `su -lc "dpkg -i ./*.deb" root` |
## Miscellaneous Aliases
-| Alias | Command | Description |
-| -------- | -------------------------------------------------|---------------------------------------- |
-| `allpkgs`| aptitude search -F "%p" --disable-columns ~i | Display all installed packages |
-| `mydeb` | time dpkg-buildpackage -rfakeroot -us -uc | Create a basic .deb package |
+| Alias | Command | Description |
+| --------- | ---------------------------------------------- | ------------------------------ |
+| `allpkgs` | `aptitude search -F "%p" --disable-columns ~i` | Display all installed packages |
+| `mydeb` | `time dpkg-buildpackage -rfakeroot -us -uc` | Create a basic .deb package |
## Functions
-| Fucntion | Description |
-|-----------------------|-------------------------------------------------------------------------------|
-| `apt-copy` | Create a simple script that can be used to 'duplicate' a system |
-| `apt-history` | Displays apt history for a command |
-| `kerndeb` | Builds kernel packages |
-| `apt-list-packages` | List packages by size |
+| Function | Description |
+| ------------------- | --------------------------------------------------------------- |
+| `apt-copy` | Create a simple script that can be used to 'duplicate' a system |
+| `apt-history` | Displays apt history for a command |
+| `kerndeb` | Builds kernel packages |
+| `apt-list-packages` | List packages by size |
+
+## Authors
+- [@AlexBio](https://github.com/AlexBio)
+- [@dbb](https://github.com/dbb)
+- [@Mappleconfusers](https://github.com/Mappleconfusers)
diff --git a/plugins/debian/debian.plugin.zsh b/plugins/debian/debian.plugin.zsh
index 654b692d2..68c6df1ae 100644
--- a/plugins/debian/debian.plugin.zsh
+++ b/plugins/debian/debian.plugin.zsh
@@ -1,25 +1,21 @@
-# Authors:
-# https://github.com/AlexBio
-# https://github.com/dbb
-# https://github.com/Mappleconfusers
-#
-# Debian-related zsh aliases and functions for zsh
-
# Use apt or aptitude if installed, fallback is apt-get
# You can just set apt_pref='apt-get' to override it.
-if [[ -e $( which -p apt 2>&1 ) ]]; then
- apt_pref='apt'
- apt_upgr='upgrade'
-elif [[ -e $( which -p aptitude 2>&1 ) ]]; then
- apt_pref='aptitude'
- apt_upgr='safe-upgrade'
-else
- apt_pref='apt-get'
- apt_upgr='upgrade'
+
+if [[ -z $apt_pref || -z $apt_upgr ]]; then
+ if [[ -e $commands[apt] ]]; then
+ apt_pref='apt'
+ apt_upgr='upgrade'
+ elif [[ -e $commands[aptitude] ]]; then
+ apt_pref='aptitude'
+ apt_upgr='safe-upgrade'
+ else
+ apt_pref='apt-get'
+ apt_upgr='upgrade'
+ fi
fi
# Use sudo by default if it's installed
-if [[ -e $( which -p sudo 2>&1 ) ]]; then
+if [[ -e $commands[sudo] ]]; then
use_sudo=1
fi
@@ -32,8 +28,7 @@ alias api='aptitude'
# Some self-explanatory aliases
alias acs="apt-cache search"
alias aps='aptitude search'
-alias as="aptitude -F \"* %p -> %d \n(%v/%V)\" \
- --no-gui --disable-columns search" # search package
+alias as="aptitude -F '* %p -> %d \n(%v/%V)' --no-gui --disable-columns search"
# apt-file
alias afs='apt-file search --regexp'
@@ -46,60 +41,59 @@ alias app='apt-cache policy'
# superuser operations ######################################################
if [[ $use_sudo -eq 1 ]]; then
# commands using sudo #######
- alias aac='sudo $apt_pref autoclean'
- alias abd='sudo $apt_pref build-dep'
- alias ac='sudo $apt_pref clean'
- alias ad='sudo $apt_pref update'
- alias adg='sudo $apt_pref update && sudo $apt_pref $apt_upgr'
- alias adu='sudo $apt_pref update && sudo $apt_pref dist-upgrade'
- alias afu='sudo apt-file update'
- alias au='sudo $apt_pref $apt_upgr'
- alias ai='sudo $apt_pref install'
+ alias aac="sudo $apt_pref autoclean"
+ alias abd="sudo $apt_pref build-dep"
+ alias ac="sudo $apt_pref clean"
+ alias ad="sudo $apt_pref update"
+ alias adg="sudo $apt_pref update && sudo $apt_pref $apt_upgr"
+ alias adu="sudo $apt_pref update && sudo $apt_pref dist-upgrade"
+ alias afu="sudo apt-file update"
+ alias au="sudo $apt_pref $apt_upgr"
+ alias ai="sudo $apt_pref install"
# Install all packages given on the command line while using only the first word of each line:
# acs ... | ail
- alias ail="sed -e 's/ */ /g' -e 's/ *//' | cut -s -d ' ' -f 1 | "' xargs sudo $apt_pref install'
- alias ap='sudo $apt_pref purge'
- alias ar='sudo $apt_pref remove'
+ alias ail="sed -e 's/ */ /g' -e 's/ *//' | cut -s -d ' ' -f 1 | xargs sudo $apt_pref install"
+ alias ap="sudo $apt_pref purge"
+ alias ar="sudo $apt_pref remove"
# apt-get only
- alias ads='sudo apt-get dselect-upgrade'
+ alias ads="sudo apt-get dselect-upgrade"
# Install all .deb files in the current directory.
# Warning: you will need to put the glob in single quotes if you use:
# glob_subst
- alias dia='sudo dpkg -i ./*.deb'
- alias di='sudo dpkg -i'
+ alias dia="sudo dpkg -i ./*.deb"
+ alias di="sudo dpkg -i"
# Remove ALL kernel images and headers EXCEPT the one in use
- alias kclean='sudo aptitude remove -P ?and(~i~nlinux-(ima|hea) \
- ?not(~n`uname -r`))'
+ alias kclean='sudo aptitude remove -P ?and(~i~nlinux-(ima|hea) ?not(~n$(uname -r)))'
# commands using su #########
else
- alias aac='su -ls \'$apt_pref autoclean\' root'
- abd() {
+ alias aac="su -ls '$apt_pref autoclean' root"
+ function abd() {
cmd="su -lc '$apt_pref build-dep $@' root"
print "$cmd"
eval "$cmd"
}
- alias ac='su -ls \'$apt_pref clean\' root'
- alias ad='su -lc \'$apt_pref update\' root'
- alias adg='su -lc \'$apt_pref update && aptitude $apt_upgr\' root'
- alias adu='su -lc \'$apt_pref update && aptitude dist-upgrade\' root'
- alias afu='su -lc "apt-file update"'
- alias ag='su -lc \'$apt_pref $apt_upgr\' root'
- ai() {
+ alias ac="su -ls '$apt_pref clean' root"
+ alias ad="su -lc '$apt_pref update' root"
+ alias adg="su -lc '$apt_pref update && aptitude $apt_upgr' root"
+ alias adu="su -lc '$apt_pref update && aptitude dist-upgrade' root"
+ alias afu="su -lc '$apt-file update'"
+ alias au="su -lc '$apt_pref $apt_upgr' root"
+ function ai() {
cmd="su -lc 'aptitude -P install $@' root"
print "$cmd"
eval "$cmd"
}
- ap() {
+ function ap() {
cmd="su -lc '$apt_pref -P purge $@' root"
print "$cmd"
eval "$cmd"
}
- ar() {
+ function ar() {
cmd="su -lc '$apt_pref -P remove $@' root"
print "$cmd"
eval "$cmd"
@@ -111,8 +105,7 @@ else
alias di='su -lc "dpkg -i" root'
# Remove ALL kernel images and headers EXCEPT the one in use
- alias kclean='su -lc '\''aptitude remove -P ?and(~i~nlinux-(ima|hea) \
- ?not(~n`uname -r`))'\'' root'
+ alias kclean='su -lc "aptitude remove -P ?and(~i~nlinux-(ima|hea) ?not(~n$(uname -r)))" root'
fi
# Completion ################################################################
@@ -121,16 +114,16 @@ fi
# Registers a compdef for $1 that calls $apt_pref with the commands $2
# To do that it creates a new completion function called _apt_pref_$2
#
-apt_pref_compdef() {
+function apt_pref_compdef() {
local f fb
f="_apt_pref_${2}"
eval "function ${f}() {
- shift words;
- service=\"\$apt_pref\";
- words=(\"\$apt_pref\" '$2' \$words);
- ((CURRENT++))
- test \"\${apt_pref}\" = 'aptitude' && _aptitude || _apt
+ shift words;
+ service=\"\$apt_pref\";
+ words=(\"\$apt_pref\" '$2' \$words);
+ ((CURRENT++))
+ test \"\${apt_pref}\" = 'aptitude' && _aptitude || _apt
}"
compdef "$f" "$1"
@@ -141,7 +134,7 @@ apt_pref_compdef abd "build-dep"
apt_pref_compdef ac "clean"
apt_pref_compdef ad "update"
apt_pref_compdef afu "update"
-apt_pref_compdef ag "$apt_upgr"
+apt_pref_compdef au "$apt_upgr"
apt_pref_compdef ai "install"
apt_pref_compdef ail "install"
apt_pref_compdef ap "purge"
@@ -158,7 +151,7 @@ alias mydeb='time dpkg-buildpackage -rfakeroot -us -uc'
# Functions #################################################################
# create a simple script that can be used to 'duplicate' a system
-apt-copy() {
+function apt-copy() {
print '#!/bin/sh'"\n" > apt-copy.sh
cmd='$apt_pref install'
@@ -180,7 +173,7 @@ apt-copy() {
# apt-history rollback
# apt-history list
# Based On: https://linuxcommando.blogspot.com/2008/08/how-to-show-apt-log-history.html
-apt-history () {
+function apt-history() {
case "$1" in
install)
zgrep --no-filename 'install ' $(ls -rt /var/log/dpkg*)
@@ -209,11 +202,11 @@ apt-history () {
}
# Kernel-package building shortcut
-kerndeb () {
+function kerndeb() {
# temporarily unset MAKEFLAGS ( '-j3' will fail )
MAKEFLAGS=$( print - $MAKEFLAGS | perl -pe 's/-j\s*[\d]+//g' )
print '$MAKEFLAGS set to '"'$MAKEFLAGS'"
- appendage='-custom' # this shows up in $ (uname -r )
+ appendage='-custom' # this shows up in $(uname -r )
revision=$(date +"%Y%m%d") # this shows up in the .deb file name
make-kpkg clean
@@ -223,10 +216,9 @@ kerndeb () {
}
# List packages by size
-function apt-list-packages {
+function apt-list-packages() {
dpkg-query -W --showformat='${Installed-Size} ${Package} ${Status}\n' | \
grep -v deinstall | \
sort -n | \
awk '{print $1" "$2}'
}
-
diff --git a/plugins/dircycle/README.md b/plugins/dircycle/README.md
index 3ac162f05..3c9b3a96f 100644
--- a/plugins/dircycle/README.md
+++ b/plugins/dircycle/README.md
@@ -15,10 +15,10 @@ This plugin enables directory navigation similar to using back and forward on br
)
```
-2. Reload the source file or restart your Terminal session:
+2. Restart the shell or restart your Terminal session:
```console
- $ source ~/.zshrc
+ $ exec zsh
$
```
diff --git a/plugins/dirhistory/dirhistory.plugin.zsh b/plugins/dirhistory/dirhistory.plugin.zsh
index 239915e48..35c43d76a 100644
--- a/plugins/dirhistory/dirhistory.plugin.zsh
+++ b/plugins/dirhistory/dirhistory.plugin.zsh
@@ -53,7 +53,8 @@ function push_future() {
}
# Called by zsh when directory changes
-chpwd_functions+=(chpwd_dirhistory)
+autoload -U add-zsh-hook
+add-zsh-hook chpwd chpwd_dirhistory
function chpwd_dirhistory() {
push_past $PWD
# If DIRHISTORY_CD is not set...
diff --git a/plugins/dirpersist/dirpersist.plugin.zsh b/plugins/dirpersist/dirpersist.plugin.zsh
index 616e2c3c6..daadc3850 100644
--- a/plugins/dirpersist/dirpersist.plugin.zsh
+++ b/plugins/dirpersist/dirpersist.plugin.zsh
@@ -11,7 +11,8 @@ if [[ -f ${dirstack_file} ]] && [[ ${#dirstack[*]} -eq 0 ]] ; then
[[ -d $dirstack[1] ]] && cd $dirstack[1] && cd $OLDPWD
fi
-chpwd_functions+=(chpwd_dirpersist)
+autoload -U add-zsh-hook
+add-zsh-hook chpwd chpwd_dirpersist
chpwd_dirpersist() {
if (( $DIRSTACKSIZE <= 0 )) || [[ -z $dirstack_file ]]; then return; fi
local -ax my_stack
diff --git a/plugins/django/django.plugin.zsh b/plugins/django/django.plugin.zsh
index 29a51d29d..c2d00c171 100644
--- a/plugins/django/django.plugin.zsh
+++ b/plugins/django/django.plugin.zsh
@@ -154,7 +154,7 @@ _managepy-makemessages(){
"--no-default-ignore[Don't ignore the common glob-style patterns 'CVS', '.*', '*~' and '*.pyc'.]" \
"--no-wrap[Don't break long message lines into several lines.]" \
"--no-location[Don't write '#: filename:line' lines.]" \
- '--no-obsolete[emove obsolete message strings.]' \
+ '--no-obsolete[Remove obsolete message strings.]' \
'--keep-pot[Keep .pot file after making messages.]' \
$nul_args && ret=0
}
@@ -374,7 +374,8 @@ _managepy-commands() {
_applist() {
local line
local -a apps
- _call_program help-command "python -c \"import os.path as op, re, django.conf, sys;\\
+ _call_program help-command "python -c \"import sys; del sys.path[0];\\
+ import os.path as op, re, django.conf;\\
bn=op.basename(op.abspath(op.curdir));[sys\\
.stdout.write(str(re.sub(r'^%s\.(.*?)$' %
bn, r'\1', i)) + '\n') for i in django.conf.settings.\\
diff --git a/plugins/dnote/README.md b/plugins/dnote/README.md
new file mode 100644
index 000000000..e1b9b7044
--- /dev/null
+++ b/plugins/dnote/README.md
@@ -0,0 +1,51 @@
+# Dnote Plugin
+
+This plugin adds auto-completion for [Dnote](https://dnote.io) project.
+
+To use it, add `dnote` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(dnote)
+```
+
+## Usage
+
+At the basic level, this plugin completes all Dnote commands.
+
+```zsh
+$ dnote a(press <TAB> here)
+```
+
+would result in:
+
+```zsh
+$ dnote add
+```
+
+For some commands, this plugin dynamically suggests matching book names.
+
+For instance, if you have three books that begin with 'j': 'javascript', 'job', 'js',
+
+```zsh
+$ dnote view j(press <TAB> here)
+```
+
+would result in:
+
+```zsh
+$ dnote v j
+javascript job js
+```
+
+As another example,
+
+```zsh
+$ dnote edit ja(press <TAB> here)
+```
+
+would result in:
+
+
+```zsh
+$ dnote v javascript
+``````
diff --git a/plugins/dnote/_dnote b/plugins/dnote/_dnote
new file mode 100644
index 000000000..c8b33486a
--- /dev/null
+++ b/plugins/dnote/_dnote
@@ -0,0 +1,39 @@
+#compdef dnote
+
+local -a _1st_arguments
+
+_1st_arguments=(
+ 'add:add a new note'
+ 'view:list books, notes, or view a content'
+ 'edit:edit a note or a book'
+ 'remove:remove a note or a book'
+ 'find:find notes by keywords'
+ 'sync:sync data with the server'
+ 'login:login to the dnote server'
+ 'logout:logout from the dnote server'
+ 'version:print the current version'
+ 'help:get help about any command'
+)
+
+get_booknames() {
+ local names=$(dnote view --name-only)
+ local -a ret
+
+ while read -r line; do
+ ret+=("${line}")
+ done <<< "$names"
+
+ echo "$ret"
+}
+
+if (( CURRENT == 2 )); then
+ _describe -t commands "dnote subcommand" _1st_arguments
+ return
+elif (( CURRENT == 3 )); then
+ case "$words[2]" in
+ v|view|a|add)
+ _alternative \
+ "names:book names:($(get_booknames))"
+ esac
+fi
+
diff --git a/plugins/docker-compose/_docker-compose b/plugins/docker-compose/_docker-compose
index c0a54cced..808b068a3 100644
--- a/plugins/docker-compose/_docker-compose
+++ b/plugins/docker-compose/_docker-compose
@@ -23,7 +23,7 @@ __docker-compose_all_services_in_compose_file() {
local already_selected
local -a services
already_selected=$(echo $words | tr " " "|")
- __docker-compose_q config --services \
+ __docker-compose_q ps --services "$@" \
| grep -Ev "^(${already_selected})$"
}
@@ -31,125 +31,42 @@ __docker-compose_all_services_in_compose_file() {
__docker-compose_services_all() {
[[ $PREFIX = -* ]] && return 1
integer ret=1
- services=$(__docker-compose_all_services_in_compose_file)
+ services=$(__docker-compose_all_services_in_compose_file "$@")
_alternative "args:services:($services)" && ret=0
return ret
}
-# All services that have an entry with the given key in their docker-compose.yml section
-__docker-compose_services_with_key() {
- local already_selected
- local -a buildable
- already_selected=$(echo $words | tr " " "|")
- # flatten sections to one line, then filter lines containing the key and return section name.
- __docker-compose_q config \
- | sed -n -e '/^services:/,/^[^ ]/p' \
- | sed -n 's/^ //p' \
- | awk '/^[a-zA-Z0-9]/{printf "\n"};{printf $0;next;}' \
- | grep " \+$1:" \
- | cut -d: -f1 \
- | grep -Ev "^(${already_selected})$"
-}
-
# All services that are defined by a Dockerfile reference
__docker-compose_services_from_build() {
[[ $PREFIX = -* ]] && return 1
- integer ret=1
- buildable=$(__docker-compose_services_with_key build)
- _alternative "args:buildable services:($buildable)" && ret=0
-
- return ret
+ __docker-compose_services_all --filter source=build
}
# All services that are defined by an image
__docker-compose_services_from_image() {
[[ $PREFIX = -* ]] && return 1
- integer ret=1
- pullable=$(__docker-compose_services_with_key image)
- _alternative "args:pullable services:($pullable)" && ret=0
-
- return ret
-}
-
-__docker-compose_get_services() {
- [[ $PREFIX = -* ]] && return 1
- integer ret=1
- local kind
- declare -a running paused stopped lines args services
-
- docker_status=$(docker ps > /dev/null 2>&1)
- if [ $? -ne 0 ]; then
- _message "Error! Docker is not running."
- return 1
- fi
-
- kind=$1
- shift
- [[ $kind =~ (stopped|all) ]] && args=($args -a)
-
- lines=(${(f)"$(_call_program commands docker $docker_options ps $args)"})
- services=(${(f)"$(_call_program commands docker-compose 2>/dev/null $compose_options ps -q)"})
-
- # Parse header line to find columns
- local i=1 j=1 k header=${lines[1]}
- declare -A begin end
- while (( j < ${#header} - 1 )); do
- i=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 1 ))
- j=$(( i + ${${header[$i,-1]}[(i) ]} - 1 ))
- k=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 2 ))
- begin[${header[$i,$((j-1))]}]=$i
- end[${header[$i,$((j-1))]}]=$k
- done
- lines=(${lines[2,-1]})
-
- # Container ID
- local line s name
- local -a names
- for line in $lines; do
- if [[ ${services[@]} == *"${line[${begin[CONTAINER ID]},${end[CONTAINER ID]}]%% ##}"* ]]; then
- names=(${(ps:,:)${${line[${begin[NAMES]},-1]}%% *}})
- for name in $names; do
- s="${${name%_*}#*_}:${(l:15:: :::)${${line[${begin[CREATED]},${end[CREATED]}]/ ago/}%% ##}}"
- s="$s, ${line[${begin[CONTAINER ID]},${end[CONTAINER ID]}]%% ##}"
- s="$s, ${${${line[${begin[IMAGE]},${end[IMAGE]}]}/:/\\:}%% ##}"
- if [[ ${line[${begin[STATUS]},${end[STATUS]}]} = Exit* ]]; then
- stopped=($stopped $s)
- else
- if [[ ${line[${begin[STATUS]},${end[STATUS]}]} = *\(Paused\)* ]]; then
- paused=($paused $s)
- fi
- running=($running $s)
- fi
- done
- fi
- done
-
- [[ $kind =~ (running|all) ]] && _describe -t services-running "running services" running "$@" && ret=0
- [[ $kind =~ (paused|all) ]] && _describe -t services-paused "paused services" paused "$@" && ret=0
- [[ $kind =~ (stopped|all) ]] && _describe -t services-stopped "stopped services" stopped "$@" && ret=0
-
- return ret
+ __docker-compose_services_all --filter source=image
}
__docker-compose_pausedservices() {
[[ $PREFIX = -* ]] && return 1
- __docker-compose_get_services paused "$@"
+ __docker-compose_services_all --filter status=paused
}
__docker-compose_stoppedservices() {
[[ $PREFIX = -* ]] && return 1
- __docker-compose_get_services stopped "$@"
+ __docker-compose_services_all --filter status=stopped
}
__docker-compose_runningservices() {
[[ $PREFIX = -* ]] && return 1
- __docker-compose_get_services running "$@"
+ __docker-compose_services_all --filter status=running
}
__docker-compose_services() {
[[ $PREFIX = -* ]] && return 1
- __docker-compose_get_services all "$@"
+ __docker-compose_services_all
}
__docker-compose_caching_policy() {
@@ -196,9 +113,12 @@ __docker-compose_subcommand() {
$opts_help \
"*--build-arg=[Set build-time variables for one service.]:<varname>=<value>: " \
'--force-rm[Always remove intermediate containers.]' \
- '--memory[Memory limit for the build container.]' \
+ '(--quiet -q)'{--quiet,-q}'[Curb build output]' \
+ '(--memory -m)'{--memory,-m}'[Memory limit for the build container.]' \
'--no-cache[Do not use cache when building the image.]' \
'--pull[Always attempt to pull a newer version of the image.]' \
+ '--compress[Compress the build context using gzip.]' \
+ '--parallel[Build images in parallel.]' \
'*:services:__docker-compose_services_from_build' && ret=0
;;
(bundle)
@@ -213,7 +133,8 @@ __docker-compose_subcommand() {
'(--quiet -q)'{--quiet,-q}"[Only validate the configuration, don't print anything.]" \
'--resolve-image-digests[Pin image tags to digests.]' \
'--services[Print the service names, one per line.]' \
- '--volumes[Print the volume names, one per line.]' && ret=0
+ '--volumes[Print the volume names, one per line.]' \
+ '--hash[Print the service config hash, one per line. Set "service1,service2" for a list of specified services.]' \ && ret=0
;;
(create)
_arguments \
@@ -222,11 +143,12 @@ __docker-compose_subcommand() {
$opts_no_recreate \
$opts_no_build \
"(--no-build)--build[Build images before creating containers.]" \
- '*:services:__docker-compose_services_all' && ret=0
+ '*:services:__docker-compose_services' && ret=0
;;
(down)
_arguments \
$opts_help \
+ $opts_timeout \
"--rmi[Remove images. Type must be one of: 'all': Remove all images used by any service. 'local': Remove only images that don't have a custom tag set by the \`image\` field.]:type:(all local)" \
'(-v --volumes)'{-v,--volumes}"[Remove named volumes declared in the \`volumes\` section of the Compose file and anonymous volumes attached to containers.]" \
$opts_remove_orphans && ret=0
@@ -235,16 +157,18 @@ __docker-compose_subcommand() {
_arguments \
$opts_help \
'--json[Output events as a stream of json objects]' \
- '*:services:__docker-compose_services_all' && ret=0
+ '*:services:__docker-compose_services' && ret=0
;;
(exec)
_arguments \
$opts_help \
'-d[Detached mode: Run command in the background.]' \
'--privileged[Give extended privileges to the process.]' \
- '(-u --user)'{-u,--user=}'[Run the command as this user.]:username:_users' \
+ '(-u --user)'{-u,--user=}'[Run the command as this user.]:username:_users' \
'-T[Disable pseudo-tty allocation. By default `docker-compose exec` allocates a TTY.]' \
'--index=[Index of the container if there are multiple instances of a service \[default: 1\]]:index: ' \
+ '*'{-e,--env}'[KEY=VAL Set an environment variable (can be used multiple times)]:environment variable KEY=VAL: ' \
+ '(-w --workdir)'{-w,--workdir=}'[Working directory inside the container]:workdir: ' \
'(-):running services:__docker-compose_runningservices' \
'(-):command: _command_names -e' \
'*::arguments: _normal' && ret=0
@@ -252,12 +176,12 @@ __docker-compose_subcommand() {
(help)
_arguments ':subcommand:__docker-compose_commands' && ret=0
;;
- (images)
- _arguments \
- $opts_help \
- '-q[Only display IDs]' \
- '*:services:__docker-compose_services_all' && ret=0
- ;;
+ (images)
+ _arguments \
+ $opts_help \
+ '-q[Only display IDs]' \
+ '*:services:__docker-compose_services' && ret=0
+ ;;
(kill)
_arguments \
$opts_help \
@@ -271,7 +195,7 @@ __docker-compose_subcommand() {
$opts_no_color \
'--tail=[Number of lines to show from the end of the logs for each container.]:number of lines: ' \
'(-t --timestamps)'{-t,--timestamps}'[Show timestamps]' \
- '*:services:__docker-compose_services_all' && ret=0
+ '*:services:__docker-compose_services' && ret=0
;;
(pause)
_arguments \
@@ -290,12 +214,16 @@ __docker-compose_subcommand() {
_arguments \
$opts_help \
'-q[Only display IDs]' \
- '*:services:__docker-compose_services_all' && ret=0
+ '--filter KEY=VAL[Filter services by a property]:<filtername>=<value>:' \
+ '*:services:__docker-compose_services' && ret=0
;;
(pull)
_arguments \
$opts_help \
'--ignore-pull-failures[Pull what it can and ignores images with pull failures.]' \
+ '--no-parallel[Disable parallel pulling]' \
+ '(-q --quiet)'{-q,--quiet}'[Pull without printing progress information]' \
+ '--include-deps[Also pull services declared as dependencies]' \
'*:services:__docker-compose_services_from_image' && ret=0
;;
(push)
@@ -317,6 +245,7 @@ __docker-compose_subcommand() {
$opts_no_deps \
'-d[Detached mode: Run container in the background, print new container name.]' \
'*-e[KEY=VAL Set an environment variable (can be used multiple times)]:environment variable KEY=VAL: ' \
+ '*'{-l,--label}'[KEY=VAL Add or override a label (can be used multiple times)]:label KEY=VAL: ' \
'--entrypoint[Overwrite the entrypoint of the image.]:entry point: ' \
'--name=[Assign a name to the container]:name: ' \
'(-p --publish)'{-p,--publish=}"[Publish a container's port(s) to the host]" \
@@ -326,6 +255,7 @@ __docker-compose_subcommand() {
'(-u --user)'{-u,--user=}'[Run as specified username or uid]:username or uid:_users' \
'(-v --volume)*'{-v,--volume=}'[Bind mount a volume]:volume: ' \
'(-w --workdir)'{-w,--workdir=}'[Working directory inside the container]:workdir: ' \
+ "--use-aliases[Use the services network aliases in the network(s) the container connects to]" \
'(-):services:__docker-compose_services' \
'(-):command: _command_names -e' \
'*::arguments: _normal' && ret=0
@@ -369,8 +299,10 @@ __docker-compose_subcommand() {
"(--no-build)--build[Build images before starting containers.]" \
"(-d)--abort-on-container-exit[Stops all containers if any container was stopped. Incompatible with -d.]" \
'(-t --timeout)'{-t,--timeout}"[Use this timeout in seconds for container shutdown when attached or when containers are already running. (default: 10)]:seconds: " \
+ '--scale[SERVICE=NUM Scale SERVICE to NUM instances. Overrides the `scale` setting in the Compose file if present.]:service scale SERVICE=NUM: ' \
+ '--exit-code-from=[Return the exit code of the selected service container. Implies --abort-on-container-exit]:service:__docker-compose_services' \
$opts_remove_orphans \
- '*:services:__docker-compose_services_all' && ret=0
+ '*:services:__docker-compose_services' && ret=0
;;
(version)
_arguments \
@@ -409,8 +341,11 @@ _docker-compose() {
'(- :)'{-h,--help}'[Get help]' \
'*'{-f,--file}"[${file_description}]:file:_files -g '*.yml'" \
'(-p --project-name)'{-p,--project-name}'[Specify an alternate project name (default: directory name)]:project name:' \
- '--verbose[Show more output]' \
+ "--compatibility[If set, Compose will attempt to convert keys in v3 files to their non-Swarm equivalent]" \
'(- :)'{-v,--version}'[Print version and exit]' \
+ '--verbose[Show more output]' \
+ '--log-level=[Set log level]:level:(DEBUG INFO WARNING ERROR CRITICAL)' \
+ '--no-ansi[Do not print ANSI control characters]' \
'(-H --host)'{-H,--host}'[Daemon socket to connect to]:host:' \
'--tls[Use TLS; implied by --tlsverify]' \
'--tlscacert=[Trust certs signed only by this CA]:ca path:' \
@@ -421,7 +356,7 @@ _docker-compose() {
'(-): :->command' \
'(-)*:: :->option-or-argument' && ret=0
- local -a relevant_compose_flags relevant_docker_flags compose_options docker_options
+ local -a relevant_compose_flags relevant_compose_repeatable_flags relevant_docker_flags compose_options docker_options
relevant_compose_flags=(
"--file" "-f"
@@ -435,6 +370,10 @@ _docker-compose() {
"--skip-hostname-check"
)
+ relevant_compose_repeatable_flags=(
+ "--file" "-f"
+ )
+
relevant_docker_flags=(
"--host" "-H"
"--tls"
@@ -452,9 +391,18 @@ _docker-compose() {
fi
fi
if [[ -n "${relevant_compose_flags[(r)$k]}" ]]; then
- compose_options+=$k
- if [[ -n "$opt_args[$k]" ]]; then
- compose_options+=$opt_args[$k]
+ if [[ -n "${relevant_compose_repeatable_flags[(r)$k]}" ]]; then
+ values=("${(@s/:/)opt_args[$k]}")
+ for value in $values
+ do
+ compose_options+=$k
+ compose_options+=$value
+ done
+ else
+ compose_options+=$k
+ if [[ -n "$opt_args[$k]" ]]; then
+ compose_options+=$opt_args[$k]
+ fi
fi
fi
done
diff --git a/plugins/docker/README.md b/plugins/docker/README.md
index e91798485..4d9f3ae9b 100644
--- a/plugins/docker/README.md
+++ b/plugins/docker/README.md
@@ -1,5 +1,11 @@
-## Docker autocomplete plugin
+# Docker plugin
-A copy of the completion script from the
-[docker/cli](https://github.com/docker/cli/blob/master/contrib/completion/zsh/_docker)
-git repo.
+This plugin adds auto-completion for [docker](https://www.docker.com/).
+
+To use it add `docker` to the plugins array in your zshrc file.
+```zsh
+plugins=(... docker)
+```
+
+A copy of the completion script from the docker/cli git repo:
+https://github.com/docker/cli/blob/master/contrib/completion/zsh/_docker
diff --git a/plugins/dotenv/README.md b/plugins/dotenv/README.md
index e880e9d69..cac552485 100644
--- a/plugins/dotenv/README.md
+++ b/plugins/dotenv/README.md
@@ -32,6 +32,17 @@ PORT=3001
```
You can even mix both formats, although it's probably a bad idea.
+### ZSH_DOTENV_FILE
+
+You can also modify the name of the file to be loaded with the variable `ZSH_DOTENV_FILE`.
+If the variable isn't set, the plugin will default to use `.env`.
+For example, this will make the plugin look for files named `.dotenv` and load them:
+
+```
+# in ~/.zshrc, before Oh My Zsh is sourced:
+ZSH_DOTENV_FILE=.dotenv
+```
+
## Version Control
**It's strongly recommended to add `.env` file to `.gitignore`**, because usually it contains sensitive information such as your credentials, secret keys, passwords etc. You don't want to commit this file, it's supposed to be local only.
diff --git a/plugins/dotenv/dotenv.plugin.zsh b/plugins/dotenv/dotenv.plugin.zsh
index b701b5596..89763d0ee 100644
--- a/plugins/dotenv/dotenv.plugin.zsh
+++ b/plugins/dotenv/dotenv.plugin.zsh
@@ -1,13 +1,13 @@
source_env() {
- if [[ -f .env ]]; then
+ if [[ -f $ZSH_DOTENV_FILE ]]; then
# test .env syntax
- zsh -fn .env || echo 'dotenv: error when sourcing `.env` file' >&2
+ zsh -fn $ZSH_DOTENV_FILE || echo "dotenv: error when sourcing '$ZSH_DOTENV_FILE' file" >&2
if [[ -o a ]]; then
- source .env
+ source $ZSH_DOTENV_FILE
else
set -a
- source .env
+ source $ZSH_DOTENV_FILE
set +a
fi
fi
@@ -16,4 +16,8 @@ source_env() {
autoload -U add-zsh-hook
add-zsh-hook chpwd source_env
+if [[ -z $ZSH_DOTENV_FILE ]]; then
+ ZSH_DOTENV_FILE=.env
+fi
+
source_env
diff --git a/plugins/eecms/README.md b/plugins/eecms/README.md
new file mode 100644
index 000000000..c53835521
--- /dev/null
+++ b/plugins/eecms/README.md
@@ -0,0 +1,11 @@
+# eecms plugin
+
+This plugin adds auto-completion of console commands for [`eecms`](https://github.com/ExpressionEngine/ExpressionEngine).
+
+To use it, add `eecms` to the plugins array of your `.zshrc` file:
+```
+plugins=(... eecms)
+```
+
+It also adds the alias `eecms` which finds the eecms file in the current project
+and runs it with php.
diff --git a/plugins/emacs/emacsclient.sh b/plugins/emacs/emacsclient.sh
index 26b28d495..0aa8d6f40 100755
--- a/plugins/emacs/emacsclient.sh
+++ b/plugins/emacs/emacsclient.sh
@@ -20,7 +20,8 @@ _emacsfun()
# tempfile. (first argument will be `--no-wait` passed in by the plugin.zsh)
if [ "$#" -ge "2" -a "$2" = "-" ]
then
- tempfile="$(mktemp emacs-stdin-$USER.XXXXXXX --tmpdir)"
+ tempfile="$(mktemp --tmpdir emacs-stdin-$USER.XXXXXXX 2>/dev/null \
+ || mktemp -t emacs-stdin-$USER)" # support BSD mktemp
cat - > "$tempfile"
_emacsfun --no-wait $tempfile
else
diff --git a/plugins/emoji-clock/emoji-clock.plugin.zsh b/plugins/emoji-clock/emoji-clock.plugin.zsh
index 0a55528f0..bdd606f89 100644
--- a/plugins/emoji-clock/emoji-clock.plugin.zsh
+++ b/plugins/emoji-clock/emoji-clock.plugin.zsh
@@ -2,7 +2,7 @@
# FILE: emoji-clock.plugin.zsh
# DESCRIPTION: The current time with half hour accuracy as an emoji symbol.
# Inspired by Andre Torrez' "Put A Burger In Your Shell"
-# http://notes.torrez.org/2013/04/put-a-burger-in-your-shell.html
+# https://notes.torrez.org/2013/04/put-a-burger-in-your-shell.html
# AUTHOR: Alexis Hildebrandt (afh[at]surryhill.net)
# VERSION: 1.0.0
# -----------------------------------------------------------------------------
diff --git a/plugins/emotty/README.md b/plugins/emotty/README.md
new file mode 100644
index 000000000..ee571705a
--- /dev/null
+++ b/plugins/emotty/README.md
@@ -0,0 +1,39 @@
+# emotty plugin
+
+This plugin returns an emoji for the current $TTY number so it can be used
+in a prompt.
+
+To use it, add emotty to the plugins array in your zshrc file:
+```
+plugins=(... emotty)
+```
+
+**NOTE:** it requires the [emoji plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/emoji).
+
+## Usage
+
+The function `emotty` displays an emoji from the current character set (default: `emoji`), based
+on the number associated to the `$TTY`.
+
+There are different sets of emoji characters available, to choose a different
+set, set `$emotty_set` to the name of the set you would like to use, e.g.:
+```
+emotty_set=nature
+```
+
+### Character Sets
+
+- emoji
+- loral
+- love
+- nature
+- stellar
+- zodiac
+
+Use the `display_emotty` function to list the emojis in the current character set, or
+the character set passed as the first argument. For example:
+
+```
+$ display_emotty zodiac
+<list of all the emojis in the zodiac character set>
+```
diff --git a/plugins/emotty/emotty.plugin.zsh b/plugins/emotty/emotty.plugin.zsh
index b0d24c322..e288b5cfb 100644
--- a/plugins/emotty/emotty.plugin.zsh
+++ b/plugins/emotty/emotty.plugin.zsh
@@ -25,8 +25,14 @@ emotty_default_set=emoji
function emotty() {
# Use emotty set defined by user, fallback to default
local emotty=${_emotty_sets[${emotty_set:-$emotty_default_set}]}
- # Parse $TTY number, normalizing it to an emotty set index
- (( tty = (${TTY##/dev/tty} % ${#${=emotty}}) + 1 ))
+
+ # Parse tty number via prompt expansion. %l equals:
+ # - N if tty = /dev/ttyN
+ # - pts/N if tty = /dev/pts/N
+ local tty = ${${(%):-%l}##pts/}
+ # Normalize it to an emotty set index
+ (( tty = (tty % ${#${=emotty}}) + 1 ))
+
local character_name=${${=emotty}[tty]}
echo "${emoji[${character_name}]}${emoji2[emoji_style]}"
}
diff --git a/plugins/encode64/README.md b/plugins/encode64/README.md
index 9850da85f..66fc7cba4 100644
--- a/plugins/encode64/README.md
+++ b/plugins/encode64/README.md
@@ -20,10 +20,10 @@ Alias plugin for encoding or decoding using `base64` command
)
```
-2. Restart your terminal session or reload configuration by running:
+2. Restart your terminal session or restart the shell:
```sh
- source ~/.zshrc
+ exec zsh
```
## Usage and examples
diff --git a/plugins/extract/README.md b/plugins/extract/README.md
index 83b878c32..d6e4fa116 100644
--- a/plugins/extract/README.md
+++ b/plugins/extract/README.md
@@ -27,21 +27,26 @@ plugins=(... extract)
| `jar` | Java Archive |
| `lzma` | LZMA archive |
| `rar` | WinRAR archive |
+| `rpm` | RPM package |
| `sublime-package` | Sublime Text package |
| `tar` | Tarball |
| `tar.bz2` | Tarball with bzip2 compression |
| `tar.gz` | Tarball with gzip compression |
+| `tar.lz` | Tarball with lzip compression |
| `tar.xz` | Tarball with lzma2 compression |
| `tar.zma` | Tarball with lzma compression |
+| `tar.zst` | Tarball with zstd compression |
| `tbz` | Tarball with bzip compression |
| `tbz2` | Tarball with bzip2 compression |
| `tgz` | Tarball with gzip compression |
| `tlz` | Tarball with lzma compression |
| `txz` | Tarball with lzma2 compression |
+| `tzst` | Tarball with zstd compression |
| `war` | Web Application archive (Java-based) |
| `xpi` | Mozilla XPI module file |
| `xz` | LZMA2 archive |
| `zip` | Zip archive |
+| `zst` | Zstandard file (zstd) |
See [list of archive formats](https://en.wikipedia.org/wiki/List_of_archive_formats) for
more information regarding archive formats.
diff --git a/plugins/extract/_extract b/plugins/extract/_extract
index 33d49fcc5..e9d12d4d3 100644
--- a/plugins/extract/_extract
+++ b/plugins/extract/_extract
@@ -3,5 +3,5 @@
_arguments \
'(-r --remove)'{-r,--remove}'[Remove archive.]' \
- "*::archive file:_files -g '(#i)*.(7z|Z|apk|aar|bz2|deb|gz|ipsw|jar|lzma|rar|sublime-package|tar|tar.bz2|tar.gz|tar.xz|tar.zma|tbz|tbz2|tgz|tlz|txz|war|whl|xpi|xz|zip)(-.)'" \
+ "*::archive file:_files -g '(#i)*.(7z|Z|apk|aar|bz2|deb|gz|ipsw|jar|lzma|rar|rpm|sublime-package|tar|tar.bz2|tar.gz|tar.lz|tar.xz|tar.zma|tar.zst|tbz|tbz2|tgz|tlz|txz|tzst|war|whl|xpi|xz|zip|zst)(-.)'" \
&& return 0
diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh
index 5e9b9ff24..5cc30d1ce 100644
--- a/plugins/extract/extract.plugin.zsh
+++ b/plugins/extract/extract.plugin.zsh
@@ -40,14 +40,20 @@ extract() {
tar --lzma --help &> /dev/null \
&& tar --lzma -xvf "$1" \
|| lzcat "$1" | tar xvf - ;;
+ (*.tar.zst|*.tzst)
+ tar --zstd --help &> /dev/null \
+ && tar --zstd -xvf "$1" \
+ || zstdcat "$1" | tar xvf - ;;
(*.tar) tar xvf "$1" ;;
- (*.gz) (( $+commands[pigz] )) && pigz -d "$1" || gunzip "$1" ;;
+ (*.tar.lz) (( $+commands[lzip] )) && tar xvf "$1" ;;
+ (*.gz) (( $+commands[pigz] )) && pigz -dk "$1" || gunzip -k "$1" ;;
(*.bz2) bunzip2 "$1" ;;
(*.xz) unxz "$1" ;;
(*.lzma) unlzma "$1" ;;
(*.z) uncompress "$1" ;;
(*.zip|*.war|*.jar|*.sublime-package|*.ipsw|*.xpi|*.apk|*.aar|*.whl) unzip "$1" -d $extract_dir ;;
(*.rar) unrar x -ad "$1" ;;
+ (*.rpm) mkdir "$extract_dir" && cd "$extract_dir" && rpm2cpio "../$1" | cpio --quiet -id && cd .. ;;
(*.7z) 7za x "$1" ;;
(*.deb)
mkdir -p "$extract_dir/control"
@@ -58,6 +64,7 @@ extract() {
cd ..; rm *.tar.* debian-binary
cd ..
;;
+ (*.zst) unzstd "$1" ;;
(*)
echo "extract: '$1' cannot be extracted" >&2
success=1
diff --git a/plugins/fabric/_fab b/plugins/fabric/_fab
index 9628e1224..9102dadef 100644
--- a/plugins/fabric/_fab
+++ b/plugins/fabric/_fab
@@ -4,10 +4,19 @@
local curcontext=$curcontext state line
declare -A opt_args
-declare target_list
-target_list=(`fab --shortlist 2>/dev/null`)
+declare -a target_list
+target_list=("${(@f)$(fab -l 2>/dev/null | awk '{
+ if (NF == 0 || NR == 1) next
+ if (NF < 2) print $1
+ else {
+ docstring=substr($0, index($0,$2))
+ gsub(":", "\\:", docstring)
+ print $1":"docstring
+ }
+}')}")
-_targets() {
+_fab_targets() {
+ [[ -n "$target_list" ]] || return
_describe -t commands "fabric targets" target_list
}
@@ -28,7 +37,7 @@ _arguments -w -S -C \
'(-)--shortlist[print non-verbose list of possible commands and exit]: :->noargs' \
'(--reject-unknown-hosts)--reject-unknown-hosts[reject unknown hosts]' \
'(--no-pty)--no-pty[do not use pseudo-terminal in run/sudo]' \
- "(-d+ --display=-)"{-d+,--display=-}"[print detailed info about a given command]: :_targets" \
+ "(-d+ --display=-)"{-d+,--display=-}"[print detailed info about a given command]: :_fab_targets" \
'(-D --disable-known-hosts)'{-D,--disable-known-hosts}'[do not load user known_hosts file]' \
'(-r --reject-unknown-hosts)'{-r,--reject-unknown-hosts}'[reject unknown hosts]' \
'(-u+ --user=-)'{-u+,--user=-}'[username to use when connecting to remote hosts]: :' \
@@ -53,7 +62,7 @@ if [[ CURRENT -ge 1 ]]; then
levels)
_describe -t commands "output levels" output_levels;;
*)
- _targets;;
+ _fab_targets;;
esac
return
diff --git a/plugins/fasd/README.md b/plugins/fasd/README.md
new file mode 100644
index 000000000..a5c74e5b8
--- /dev/null
+++ b/plugins/fasd/README.md
@@ -0,0 +1,21 @@
+# fasd
+
+[`Fasd`](https://github.com/clvv/fasd) (pronounced similar to "fast") is a command-line productivity booster. Fasd offers quick access to files and directories for POSIX shells.
+
+To use it, add `fasd` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... fasd)
+```
+
+## Installation
+
+Please find detailed installation guide [`here`](https://github.com/clvv/fasd#install)
+
+## Aliases
+
+| Alias | Command | Description |
+|-------|-------------------------------------------|-------------------------------------------------------------|
+| v | `fasd -f -e "$EDITOR"` | List frequent/recent files matching the given filename. |
+| o | `fasd -a -e xdg-open` | List frequent/recent files and directories matching. |
+| j | `fasd_cd -d -i` | cd with interactive selection |
diff --git a/plugins/fasd/fasd.plugin.zsh b/plugins/fasd/fasd.plugin.zsh
index 36a0428a7..ec2e5183a 100644
--- a/plugins/fasd/fasd.plugin.zsh
+++ b/plugins/fasd/fasd.plugin.zsh
@@ -6,7 +6,7 @@ if [ $commands[fasd] ]; then # check if fasd is installed
source "$fasd_cache"
unset fasd_cache
- alias v="f -e \"$EDITOR\""
+ alias v='f -e "$EDITOR"'
alias o='a -e xdg-open'
alias j='zz'
fi
diff --git a/plugins/fbterm/README.md b/plugins/fbterm/README.md
new file mode 100644
index 000000000..eec33d7ee
--- /dev/null
+++ b/plugins/fbterm/README.md
@@ -0,0 +1,9 @@
+# fbterm
+
+This plugin automatically starts [fbterm](https://github.com/zhangyuanwei/fbterm)
+if on a real TTY (`/dev/tty*`).
+
+To use it, add fbterm to the plugins array of your zshrc file:
+```
+plugins=(... fbterm)
+```
diff --git a/plugins/fedora/README.md b/plugins/fedora/README.md
index 6594799b3..85d8d7dea 100644
--- a/plugins/fedora/README.md
+++ b/plugins/fedora/README.md
@@ -1 +1 @@
-The fedora plugin is deprecated. Use the [dnf plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/dnf) instead.
+The fedora plugin is deprecated. Use the [dnf plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/dnf) instead.
diff --git a/plugins/flutter/README.md b/plugins/flutter/README.md
new file mode 100644
index 000000000..be419144f
--- /dev/null
+++ b/plugins/flutter/README.md
@@ -0,0 +1,21 @@
+## Flutter plugin
+
+The Flutter plugin provides completion and useful aliases
+
+To use it, add flutter to the plugins array of your zshrc file:
+
+```
+plugins=(... flutter)
+```
+
+## Aliases
+
+| Alias | Command | Description |
+| :--------- | :--------------------- | :------------------------------------------------------------------------- |
+| `fl` | `flutter` | Shorthand for flutter command |
+| `flr` | `flutter run` | Runs flutter app |
+| `fldoc` | `flutter doctor` | Runs flutter doctor |
+| `flb` | `flutter build` | Build flutter application |
+| `flattach` | `flutter attach` | Attaches flutter to a running flutter application with enabled observatory |
+| `flget` | `flutter packages get` | Installs dependencies |
+| `flc` | `flutter clean` | Cleans flutter porject |
diff --git a/plugins/flutter/_flutter b/plugins/flutter/_flutter
new file mode 100644
index 000000000..ab6ce4265
--- /dev/null
+++ b/plugins/flutter/_flutter
@@ -0,0 +1,37 @@
+#compdef flutter
+#autoload
+
+local -a _1st_arguments
+_1st_arguments=(
+ "analyze":"Analyze the project's Dart code."
+ "assemble":"Assemble and build flutter resources."
+ "attach":"Attach to a running application."
+ "build":"Flutter build commands."
+ "channel":"List or switch flutter channels."
+ "clean":"Delete the build/ and .dart_tool/ directories."
+ "config":"Configure Flutter settings."
+ "create":"Create a new Flutter project."
+ "devices":"List all connected devices."
+ "doctor":"Show information about the installed tooling."
+ "drive":"Runs Flutter Driver tests for the current project."
+ "emulators":"List, launch and create emulators."
+ "format":" Format one or more dart files."
+ "help":"Display help information for flutter."
+ "install":"Install a Flutter app on an attached device."
+ "logs":"Show log output for running Flutter apps."
+ "make-host-app-editable":"Moves host apps from generated directories to non-generated directories so that they can be edited by developers."
+ "precache":"Populates the Flutter tool's cache of binary artifacts."
+ "pub":"Commands for managing Flutter packages."
+ "run":"Run your Flutter app on an attached device."
+ "screenshot":"Take a screenshot from a connected device."
+ "test":"Run Flutter unit tests for the current project."
+ "upgrade":"Upgrade your copy of Flutter."
+ "version":"List or switch flutter versions."
+)
+
+_arguments -C '*:: :->subcmds'
+
+if (( CURRENT == 1 )); then
+ _describe -t commands "flutter command" _1st_arguments
+ return
+fi
diff --git a/plugins/flutter/flutter.plugin.zsh b/plugins/flutter/flutter.plugin.zsh
new file mode 100644
index 000000000..01c4c9f5f
--- /dev/null
+++ b/plugins/flutter/flutter.plugin.zsh
@@ -0,0 +1,7 @@
+alias fl="flutter"
+alias flr="flutter run"
+alias fldoc="flutter doctor"
+alias flb="flutter build"
+alias flattach="flutter attach"
+alias flget="flutter packages get"
+alias flc="flutter clean"
diff --git a/plugins/frontend-search/README.md b/plugins/frontend-search/README.md
index f06e79102..ddcb3d72b 100644
--- a/plugins/frontend-search/README.md
+++ b/plugins/frontend-search/README.md
@@ -1,9 +1,8 @@
-## Introduction ##
+## Introduction
> Searches for your frontend web development made easier
-
-## Installation ##
+## Installation
Open your `~/.zshrc` file and enable the `frontend-search` plugin:
@@ -13,53 +12,63 @@ plugins=( ... frontend-search)
```
-
-## Usage ##
+## Usage
You can use the frontend-search plugin in these two forms:
-* `frontend <context> <term> [more terms if you want]`
-* `<context> <term> [more terms if you want]`
+- `frontend <context> <term> [more terms if you want]`
+- `<context> <term> [more terms if you want]`
For example, these two are equivalent:
```zsh
-$ frontend angularjs dependency injection
-$ angularjs dependency injection
+$ angular dependency injection
+# Will turn into ...
+$ frontend angular dependency injection
```
Available search contexts are:
-| context | URL |
-|---------------|--------------------------------------------------------------------------|
-| angularjs | `https://google.com/search?as_sitesearch=angularjs.org&as_q=` |
-| aurajs | `http://aurajs.com/api/#stq=` |
-| bem | `https://google.com/search?as_sitesearch=bem.info&as_q=` |
-| bootsnipp | `https://bootsnipp.com/search?q=` |
-| caniuse | `https://caniuse.com/#search=` |
-| codepen | `https://codepen.io/search?q=` |
-| compassdoc | `http://compass-style.org/search?q=` |
-| cssflow | `http://www.cssflow.com/search?q=` |
-| dartlang | `https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart:` |
-| emberjs | `https://emberjs.com/api/#stp=1&stq=` |
-| fontello | `http://fontello.com/#search=` |
-| html5please | `http://html5please.com/#` |
-| jquery | `https://api.jquery.com/?s=` |
-| lodash | `https://devdocs.io/lodash/index#` |
-| mdn | `https://developer.mozilla.org/search?q=` |
-| npmjs | `https://www.npmjs.com/search?q=` |
-| qunit | `https://api.qunitjs.com/?s=` |
-| reactjs | `https://google.com/search?as_sitesearch=facebook.github.io/react&as_q=` |
-| smacss | `https://google.com/search?as_sitesearch=smacss.com&as_q=` |
-| stackoverflow | `https://stackoverflow.com/search?q=` |
-| unheap | `http://www.unheap.com/?s=` |
+| context | URL |
+| ------------- | --------------------------------------------------------------------------- |
+| angular | `https://angular.io/?search=` |
+| angularjs | `https://google.com/search?as_sitesearch=angularjs.org&as_q=` |
+| bem | `https://google.com/search?as_sitesearch=bem.info&as_q=` |
+| bootsnipp | `https://bootsnipp.com/search?q=` |
+| bundlephobia | `https://bundlephobia.com/result?p=` |
+| caniuse | `https://caniuse.com/#search=` |
+| codepen | `https://codepen.io/search?q=` |
+| compassdoc | `http://compass-style.org/search?q=` |
+| cssflow | `http://www.cssflow.com/search?q=` |
+| dartlang | `https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart:` |
+| emberjs | `https://www.google.com/search?as_sitesearch=emberjs.com/&as_q=` |
+| flowtype | `https://google.com/search?as_sitesearch=flow.org/en/docs/&as_q=` |
+| fontello | `http://fontello.com/#search=` |
+| github | `https://github.com/search?q=` |
+| html5please | `https://html5please.com/#` |
+| jestjs | `https://www.google.com/search?as_sitesearch=jestjs.io&as_q=` |
+| jquery | `https://api.jquery.com/?s=` |
+| lodash | `https://devdocs.io/lodash/index#` |
+| mdn | `https://developer.mozilla.org/search?q=` |
+| nodejs | `https://www.google.com/search?as_sitesearch=nodejs.org/en/docs/&as_q=` |
+| npmjs | `https://www.npmjs.com/search?q=` |
+| qunit | `https://api.qunitjs.com/?s=` |
+| reactjs | `https://google.com/search?as_sitesearch=facebook.github.io/react&as_q=` |
+| smacss | `https://google.com/search?as_sitesearch=smacss.com&as_q=` |
+| stackoverflow | `https://stackoverflow.com/search?q=` |
+| typescript | `https://google.com/search?as_sitesearch=www.typescriptlang.org/docs&as_q=` |
+| unheap | `http://www.unheap.com/?s=` |
+| vuejs | `https://www.google.com/search?as_sitesearch=vuejs.org&as_q=` |
If you want to have another context, open an Issue and tell us!
+## Fallback search behaviour
+
+The plugin will use Google as a fallback if the docs site for a search context does not have a search function. You can set the fallback search engine to DuckDuckGo by setting `FRONTEND_SEARCH_FALLBACK='duckduckgo'` in your `~/.zshrc` file before Oh My Zsh is sourced.
## Author
**Wilson Mendes (willmendesneto)**
-+ <https://plus.google.com/+WilsonMendes>
-+ <https://twitter.com/willmendesneto>
-+ <https://github.com/willmendesneto>
+
+- <https://twitter.com/willmendesneto>
+- <https://github.com/willmendesneto>
diff --git a/plugins/frontend-search/_frontend-search.sh b/plugins/frontend-search/_frontend-search.sh
index 9aad76f76..c59640e74 100644
--- a/plugins/frontend-search/_frontend-search.sh
+++ b/plugins/frontend-search/_frontend-search.sh
@@ -17,27 +17,34 @@ function _frontend() {
frontend_points=( "${(f)mapfile[$CONFIG]//$HOME/~}" )
commands=(
- 'jquery: Search in jQuery website'
- 'mdn: Search in MDN website'
- 'compassdoc: Search in COMPASS website'
- 'html5please: Search in HTML5 Please website'
+ 'angular: Search in Angular.io website'
+ 'angularjs: Search in docs.angularjs.org website'
+ 'bem: Search in BEM website'
+ 'bootsnipp: Search in bootsnipp website'
+ 'bundlephobia: Search in Bundlephobia website'
'caniuse: Search in Can I Use website'
- 'aurajs: Search in AuraJs website'
+ 'codepen: Search in codepen website'
+ 'compassdoc: Search in COMPASS website'
+ 'cssflow: Search in cssflow website'
'dartlang: Search in Dart website'
+ 'emberjs: Search in Ember website'
+ 'flowtype: Search in Flowtype website'
+ 'fontello: Search in fontello website'
+ 'github: Search in GitHub website'
+ 'html5please: Search in HTML5 Please website'
+ 'jestjs: Search in Jest website'
+ 'jquery: Search in jQuery website'
'lodash: Search in Lo-Dash website'
+ 'mdn: Search in MDN website'
+ 'nodejs: Search in NodeJS website'
+ 'npmjs: Search in NPMJS 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'
+ 'smacss: Search in SMACSS website'
'stackoverflow: Search in StackOverflow website'
- 'npmjs: Search in NPMJS website'
+ 'typescript: Search in TypeScript website'
+ 'unheap: Search in unheap website'
+ 'vuejs: Search in VueJS website'
)
_arguments -C \
@@ -66,9 +73,6 @@ function _frontend() {
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
;;
@@ -81,6 +85,9 @@ function _frontend() {
fontello)
_describe -t points "Warp points" frontend_points && ret=0
;;
+ github)
+ _describe -t points "Warp points" frontend_points && ret=0
+ ;;
bootsnipp)
_describe -t points "Warp points" frontend_points && ret=0
;;
@@ -114,6 +121,24 @@ function _frontend() {
npmjs)
_describe -t points "Warp points" frontend_points && ret=0
;;
+ bundlephobia)
+ _describe -t points "Warp points" frontend_points && ret=0
+ ;;
+ flowtype)
+ _describe -t points "Warp points" frontend_points && ret=0
+ ;;
+ typescript)
+ _describe -t points "Warp points" frontend_points && ret=0
+ ;;
+ vuejs)
+ _describe -t points "Warp points" frontend_points && ret=0
+ ;;
+ nodejs)
+ _describe -t points "Warp points" frontend_points && ret=0
+ ;;
+ jestjs)
+ _describe -t points "Warp points" frontend_points && ret=0
+ ;;
esac
;;
esac
diff --git a/plugins/frontend-search/frontend-search.plugin.zsh b/plugins/frontend-search/frontend-search.plugin.zsh
index 14877fb0d..ed19280c4 100644
--- a/plugins/frontend-search/frontend-search.plugin.zsh
+++ b/plugins/frontend-search/frontend-search.plugin.zsh
@@ -1,24 +1,42 @@
+alias angular='frontend angular'
alias angularjs='frontend angularjs'
-alias aurajs='frontend aurajs'
alias bem='frontend bem'
alias bootsnipp='frontend bootsnipp'
+alias bundlephobia='frontend bundlephobia'
alias caniuse='frontend caniuse'
alias codepen='frontend codepen'
alias compassdoc='frontend compassdoc'
alias cssflow='frontend cssflow'
alias dartlang='frontend dartlang'
alias emberjs='frontend emberjs'
+alias flowtype='frontend flowtype'
alias fontello='frontend fontello'
+alias github='frontend github'
alias html5please='frontend html5please'
+alias jestjs='frontend jestjs'
alias jquery='frontend jquery'
alias lodash='frontend lodash'
alias mdn='frontend mdn'
+alias nodejs='frontend nodejs'
alias npmjs='frontend npmjs'
alias qunit='frontend qunit'
alias reactjs='frontend reactjs'
alias smacss='frontend smacss'
alias stackoverflow='frontend stackoverflow'
+alias typescript='frontend typescript'
alias unheap='frontend unheap'
+alias vuejs='frontend vuejs'
+
+function _frontend_fallback() {
+ local url
+ if [[ "$FRONTEND_SEARCH_FALLBACK" == duckduckgo ]]; then
+ url="https://duckduckgo.com/?sites=$1&q="
+ else
+ url="https://google.com/search?as_sitesearch=$1&as_q="
+ fi
+
+ echo "$url"
+}
function frontend() {
emulate -L zsh
@@ -26,27 +44,34 @@ function frontend() {
# define search context URLS
typeset -A urls
urls=(
- angularjs 'https://google.com/search?as_sitesearch=angularjs.org&as_q='
- aurajs 'http://aurajs.com/api/#stq='
- bem 'https://google.com/search?as_sitesearch=bem.info&as_q='
+ angular 'https://angular.io/?search='
+ angularjs $(_frontend_fallback 'angularjs.org')
+ bem $(_frontend_fallback 'bem.info')
bootsnipp 'https://bootsnipp.com/search?q='
+ bundlephobia 'https://bundlephobia.com/result?p='
caniuse 'https://caniuse.com/#search='
codepen 'https://codepen.io/search?q='
compassdoc 'http://compass-style.org/search?q='
cssflow 'http://www.cssflow.com/search?q='
dartlang 'https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart:'
- emberjs 'https://emberjs.com/api/#stp=1&stq='
+ emberjs $(_frontend_fallback 'emberjs.com/')
+ flowtype $(_frontend_fallback 'flow.org/en/docs/')
fontello 'http://fontello.com/#search='
- html5please 'http://html5please.com/#'
+ github 'https://github.com/search?q='
+ html5please 'https://html5please.com/#'
+ jestjs $(_frontend_fallback 'jestjs.io')
jquery 'https://api.jquery.com/?s='
lodash 'https://devdocs.io/lodash/index#'
mdn 'https://developer.mozilla.org/search?q='
+ nodejs $(_frontend_fallback 'nodejs.org/en/docs/')
npmjs 'https://www.npmjs.com/search?q='
qunit 'https://api.qunitjs.com/?s='
- reactjs 'https://google.com/search?as_sitesearch=facebook.github.io/react&as_q='
- smacss 'https://google.com/search?as_sitesearch=smacss.com&as_q='
+ reactjs $(_frontend_fallback 'reactjs.org/')
+ smacss $(_frontend_fallback 'smacss.com')
stackoverflow 'https://stackoverflow.com/search?q='
+ typescript $(_frontend_fallback 'www.typescriptlang.org/docs')
unheap 'http://www.unheap.com/?s='
+ vuejs $(_frontend_fallback 'vuejs.org')
)
# show help for command list
@@ -57,9 +82,9 @@ function frontend() {
print -P "%Uterm%u and what follows is what will be searched for in the %Ucontext%u website,"
print -P "and %Ucontext%u is one of the following:"
print -P ""
- print -P " angularjs, aurajs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow,"
- print -P " dartlang, emberjs, fontello, html5please, jquery, lodash, mdn, npmjs,"
- print -P " qunit, reactjs, smacss, stackoverflow, unheap"
+ print -P " angular, angularjs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow,"
+ print -P " dartlang, emberjs, fontello, flowtype, github, html5please, jestjs, jquery, lodash,"
+ print -P " mdn, npmjs, nodejs, qunit, reactjs, smacss, stackoverflow, unheap, vuejs, bundlephobia"
print -P ""
print -P "For example: frontend npmjs mocha (or just: npmjs mocha)."
print -P ""
@@ -73,17 +98,17 @@ function frontend() {
echo ""
echo "Valid contexts are:"
echo ""
- echo " angularjs, aurajs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow, "
- echo " dartlang, emberjs, fontello, html5please, jquery, lodash, mdn, npmjs, "
- echo " qunit, reactjs, smacss, stackoverflow, unheap"
+ echo " angular, angularjs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow,"
+ echo " dartlang, emberjs, fontello, github, html5please, jest, jquery, lodash,"
+ echo " mdn, npmjs, nodejs, qunit, reactjs, smacss, stackoverflow, unheap, vuejs, bundlephobia"
echo ""
return 1
fi
# build search url:
- # join arguments passed with '+', then append to search context URL
+ # join arguments passed with '%20', then append to search context URL
# TODO substitute for proper urlencode method
- url="${urls[$1]}${(j:+:)@[2,-1]}"
+ url="${urls[$1]}${(j:%20:)@[2,-1]}"
echo "Opening $url ..."
diff --git a/plugins/fzf/fzf.plugin.zsh b/plugins/fzf/fzf.plugin.zsh
index 27e2d9246..c8aefd7ab 100644
--- a/plugins/fzf/fzf.plugin.zsh
+++ b/plugins/fzf/fzf.plugin.zsh
@@ -1,57 +1,99 @@
-test -d "${FZF_BASE}" && fzf_base="${FZF_BASE}"
-
-if [[ -z "${fzf_base}" ]]; then
- fzfdirs=(
- "${HOME}/.fzf"
- "/usr/local/opt/fzf"
- "/usr/share/fzf"
- )
- for dir in ${fzfdirs}; do
- if [[ -d "${dir}" ]]; then
- fzf_base="${dir}"
- break
- fi
- done
-
- if [[ -z "${fzf_base}" ]]; then
- if (( ${+commands[brew]} )) && dir="$(brew --prefix fzf 2>/dev/null)"; then
- if [[ -d "${dir}" ]]; then
- fzf_base="${dir}"
- fi
- fi
- fi
-fi
-
-if [[ -n "${fzf_base}" ]]; then
-
- # Fix fzf shell directory for Archlinux package
- if [[ ! -d "${fzf_base}/shell" ]] && [[ -f /etc/arch-release ]]; then
- fzf_shell="${fzf_base}"
- else
- fzf_shell="${fzf_base}/shell"
- fi
-
- # Setup fzf
- # ---------
- if ! (( ${+commands[fzf]} )) && [[ ! "$PATH" == *$fzf_base/bin* ]]; then
- export PATH="$PATH:$fzf_base/bin"
- fi
-
- # Auto-completion
- # ---------------
- if [[ ! "$DISABLE_FZF_AUTO_COMPLETION" == "true" ]]; then
- [[ $- == *i* ]] && source "${fzf_shell}/completion.zsh" 2> /dev/null
- fi
-
- # Key bindings
- # ------------
- if [[ ! "$DISABLE_FZF_KEY_BINDINGS" == "true" ]]; then
- source "${fzf_shell}/key-bindings.zsh"
- fi
-
-else
- print "[oh-my-zsh] fzf plugin: Cannot find fzf installation directory.\n"\
- "Please add \`export FZF_BASE=/path/to/fzf/install/dir\` to your .zshrc" >&2
-fi
-
-unset fzf_base fzf_shell dir fzfdirs
+function setup_using_base_dir() {
+ # Declare all variables local not no mess with outside env in any way
+ local fzf_base
+ local fzf_shell
+ local fzfdirs
+ local dir
+
+ test -d "${FZF_BASE}" && fzf_base="${FZF_BASE}"
+
+ if [[ -z "${fzf_base}" ]]; then
+ fzfdirs=(
+ "${HOME}/.fzf"
+ "/usr/local/opt/fzf"
+ "/usr/share/fzf"
+ "/usr/local/share/examples/fzf"
+ )
+ for dir in ${fzfdirs}; do
+ if [[ -d "${dir}" ]]; then
+ fzf_base="${dir}"
+ break
+ fi
+ done
+
+ if [[ -z "${fzf_base}" ]]; then
+ if (( ${+commands[brew]} )) && dir="$(brew --prefix fzf 2>/dev/null)"; then
+ if [[ -d "${dir}" ]]; then
+ fzf_base="${dir}"
+ fi
+ fi
+ fi
+ fi
+
+ if [[ -d "${fzf_base}" ]]; then
+ # Fix fzf shell directory for Archlinux package
+ if [[ ! -d "${fzf_base}/shell" ]] && [[ -f /etc/arch-release ]]; then
+ fzf_shell="${fzf_base}"
+ else
+ fzf_shell="${fzf_base}/shell"
+ fi
+
+ # Setup fzf binary path
+ if ! (( ${+commands[fzf]} )) && [[ ! "$PATH" == *$fzf_base/bin* ]]; then
+ export PATH="$PATH:$fzf_base/bin"
+ fi
+
+ # Auto-completion
+ if [[ ! "$DISABLE_FZF_AUTO_COMPLETION" == "true" ]]; then
+ [[ $- == *i* ]] && source "${fzf_shell}/completion.zsh" 2> /dev/null
+ fi
+
+ # Key bindings
+ if [[ ! "$DISABLE_FZF_KEY_BINDINGS" == "true" ]]; then
+ source "${fzf_shell}/key-bindings.zsh"
+ fi
+ else
+ return 1
+ fi
+}
+
+
+function setup_using_debian_package() {
+ (( $+commands[dpkg] )) && dpkg -s fzf &> /dev/null
+ if (( $? )); then
+ # Either not a debian based distro, or no fzf installed. In any case skip ahead
+ return 1
+ fi
+
+ # NOTE: There is no need to configure PATH for debian package, all binaries
+ # are installed to /usr/bin by default
+
+ # Determine completion file path: first bullseye/sid, then buster/stretch
+ local completions="/usr/share/doc/fzf/examples/completion.zsh"
+ [[ -f "$completions" ]] || completions="/usr/share/zsh/vendor-completions/_fzf"
+
+ local key_bindings="/usr/share/doc/fzf/examples/key-bindings.zsh"
+
+ # Auto-completion
+ if [[ $- == *i* ]] && [[ ! "$DISABLE_FZF_AUTO_COMPLETION" == "true" ]]; then
+ source $completions 2> /dev/null
+ fi
+
+ # Key bindings
+ if [[ ! "$DISABLE_FZF_KEY_BINDINGS" == "true" ]]; then
+ source $key_bindings
+ fi
+
+ return 0
+}
+
+function indicate_error() {
+ print "[oh-my-zsh] fzf plugin: Cannot find fzf installation directory.\n"\
+ "Please add \`export FZF_BASE=/path/to/fzf/install/dir\` to your .zshrc" >&2
+}
+
+# Check for debian package first, because it easy to short cut
+# Indicate to user that fzf installation not found if nothing worked
+setup_using_debian_package || setup_using_base_dir || indicate_error
+
+unset -f setup_using_debian_package setup_using_base_dir indicate_error
diff --git a/plugins/gatsby/README.md b/plugins/gatsby/README.md
new file mode 100644
index 000000000..36846a228
--- /dev/null
+++ b/plugins/gatsby/README.md
@@ -0,0 +1,7 @@
+# gatsby autocomplete plugin
+
+* Adds autocomplete options for all gatsby commands.
+
+## Requirements
+
+In order to make this work, you will need to have gatsby set up in your path.
diff --git a/plugins/gatsby/_gatsby b/plugins/gatsby/_gatsby
new file mode 100644
index 000000000..66eb02f00
--- /dev/null
+++ b/plugins/gatsby/_gatsby
@@ -0,0 +1,24 @@
+#compdef gatsby
+#autoload
+
+# in order to make this work, you will need to have gatsby
+# https://www.gatsbyjs.org/
+
+local -a _1st_arguments
+_1st_arguments=(
+'develop:Start development server. Watches files, rebuilds, and hot reloads if something changes'
+'build:Build a Gatsby project.'
+'serve:Serve previously built Gatsby site.'
+'info:Get environment information for debugging and issue reporting'
+'clean:Wipe the local gatsby environment including built assets and cache'
+'repl:Get a node repl with context of Gatsby environment, see (add docs link here)'
+'new: [rootPath] [starter] Create new Gatsby project.'
+'telemetry:Enable or disable Gatsby anonymous analytics collection.'
+)
+
+_arguments -C '*:: :->subcmds' && return 0
+
+if (( CURRENT == 1 )); then
+ _describe -t commands "gatsby subcommand" _1st_arguments
+ return
+fi
diff --git a/plugins/gcloud/README.md b/plugins/gcloud/README.md
new file mode 100644
index 000000000..e7ce0e0f1
--- /dev/null
+++ b/plugins/gcloud/README.md
@@ -0,0 +1,24 @@
+# gcloud
+
+This plugin provides completion support for the
+[Google Cloud SDK CLI](https://cloud.google.com/sdk/gcloud/).
+
+To use it, add `gcloud` to the plugins array in your zshrc file.
+
+```zsh
+plugins=(... gcloud)
+```
+
+It relies on you having installed the SDK using one of the supported options
+listed [here](https://cloud.google.com/sdk/install).
+
+## Plugin Options
+
+* Set `CLOUDSDK_HOME` in your `zshrc` file before you load oh-my-zsh if you have
+your GCloud SDK installed in a non-standard location. The plugin will use this
+as the base for your SDK if it finds it set already.
+
+* If you do not have a `python2` in your `PATH` you'll also need to set the
+`CLOUDSDK_PYTHON` environment variable at the end of your `.zshrc`. This is
+used by the SDK to call a compatible interpreter when you run one of the
+SDK commands.
diff --git a/plugins/gcloud/gcloud.plugin.zsh b/plugins/gcloud/gcloud.plugin.zsh
new file mode 100644
index 000000000..c7aebe697
--- /dev/null
+++ b/plugins/gcloud/gcloud.plugin.zsh
@@ -0,0 +1,33 @@
+#####################################################
+# gcloud plugin for oh-my-zsh #
+# Author: Ian Chesal (github.com/ianchesal) #
+#####################################################
+
+if [[ -z "${CLOUDSDK_HOME}" ]]; then
+ search_locations=(
+ "$HOME/google-cloud-sdk"
+ "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk"
+ "/usr/share/google-cloud-sdk"
+ "/snap/google-cloud-sdk/current"
+ "/usr/lib64/google-cloud-sdk/"
+ "/opt/google-cloud-sdk"
+ )
+
+ for gcloud_sdk_location in $search_locations; do
+ if [[ -d "${gcloud_sdk_location}" ]]; then
+ CLOUDSDK_HOME="${gcloud_sdk_location}"
+ break
+ fi
+ done
+fi
+
+if (( ${+CLOUDSDK_HOME} )); then
+ if (( ! $+commands[gcloud] )); then
+ # Only source this if GCloud isn't already on the path
+ if [[ -f "${CLOUDSDK_HOME}/path.zsh.inc" ]]; then
+ source "${CLOUDSDK_HOME}/path.zsh.inc"
+ fi
+ fi
+ source "${CLOUDSDK_HOME}/completion.zsh.inc"
+ export CLOUDSDK_HOME
+fi
diff --git a/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh b/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh
index 1d20bc04b..5c42c21a7 100644
--- a/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh
+++ b/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh
@@ -1,16 +1,17 @@
GIT_AUTO_FETCH_INTERVAL=${GIT_AUTO_FETCH_INTERVAL:=60}
function git-fetch-all {
- (`git rev-parse --is-inside-work-tree 2>/dev/null` &&
- dir=`git rev-parse --git-dir` &&
+ (`command git rev-parse --is-inside-work-tree 2>/dev/null` &&
+ dir=`command git rev-parse --git-dir` &&
[[ ! -f $dir/NO_AUTO_FETCH ]] &&
(( `date +%s` - `date -r $dir/FETCH_LOG +%s 2>/dev/null || echo 0` > $GIT_AUTO_FETCH_INTERVAL )) &&
- git fetch --all &>! $dir/FETCH_LOG &)
+ GIT_SSH_COMMAND="command ssh -o BatchMode=yes" \
+ command git fetch --all 2>/dev/null &>! $dir/FETCH_LOG &)
}
function git-auto-fetch {
- `git rev-parse --is-inside-work-tree 2>/dev/null` || return
- guard="`git rev-parse --git-dir`/NO_AUTO_FETCH"
+ `command git rev-parse --is-inside-work-tree 2>/dev/null` || return
+ guard="`command git rev-parse --git-dir`/NO_AUTO_FETCH"
(rm $guard 2>/dev/null &&
echo "${fg_bold[green]}enabled${reset_color}") ||
@@ -18,10 +19,18 @@ function git-auto-fetch {
echo "${fg_bold[red]}disabled${reset_color}")
}
-eval "override-git-auto-fetch-$(declare -f zle-line-init)"
-
-function zle-line-init () {
- git-fetch-all
- override-git-auto-fetch-zle-line-init
-}
+# Override zle-line-init if it exists
+if (( $+functions[zle-line-init] )); then
+ eval "override-git-auto-fetch-$(declare -f zle-line-init)"
+
+ function zle-line-init () {
+ git-fetch-all
+ override-git-auto-fetch-zle-line-init
+ }
+else
+ function zle-line-init () {
+ git-fetch-all
+ }
+fi
+
zle -N zle-line-init
diff --git a/plugins/git-escape-magic/README.md b/plugins/git-escape-magic/README.md
new file mode 100644
index 000000000..7fefed39d
--- /dev/null
+++ b/plugins/git-escape-magic/README.md
@@ -0,0 +1,16 @@
+# Git Escape Magic
+
+This plugin is copied from the original at
+https://github.com/knu/zsh-git-escape-magic. All credit for the
+functionality enabled by this plugin should go to @knu.
+
+An excerpt from that project's readme explains its purpose.
+
+> It eliminates the need for manually escaping those meta-characters. The zle function it provides is context aware and recognizes the characteristics of each subcommand of git. Every time you type one of these meta-characters on a git command line, it automatically escapes the meta-character with a backslash as necessary and as appropriate.
+
+## Usage
+
+To use this plugin, add it to your list of plugins in your `.zshrc` file.
+
+**NOTE**: If you use url-quote-magic, it must be included before this
+plugin runs to prevent any conflicts.
diff --git a/plugins/git-escape-magic/git-escape-magic b/plugins/git-escape-magic/git-escape-magic
new file mode 100644
index 000000000..94a8d7b0f
--- /dev/null
+++ b/plugins/git-escape-magic/git-escape-magic
@@ -0,0 +1,135 @@
+# -*- mode: sh -*-
+#
+# git-escape-magic - zle tweak for git command line arguments
+#
+# Copyright (c) 2011, 2012, 2014 Akinori MUSHA
+# Licensed under the 2-clause BSD license.
+#
+# This tweak eliminates the need for manually escaping shell
+# meta-characters such as [~^{}] that are used for specifying a git
+# object (commit or tree). Every time you type one of these
+# characters on a git command line, it is automatically escaped with a
+# backslash as necessary and as appropriate.
+#
+# If you want to use this with url-quote-magic, make sure to enable it
+# first.
+#
+# Usage:
+# autoload -Uz git-escape-magic
+# git-escape-magic
+#
+
+git-escape-magic.self-insert() {
+ emulate -L zsh
+ setopt extendedglob
+ local self_insert_function
+ zstyle -s ':git-escape-magic' self-insert-function self_insert_function
+
+ if [[ "$KEYS" == [{}~^]* ]] && {
+ local qkey="${(q)KEYS}"
+ [[ "$KEYS" != "$qkey" ]]
+ } && {
+ local lbuf="$LBUFFER$qkey"
+ [[ "${(Q)LBUFFER}$KEYS" == "${(Q)lbuf}" ]]
+ } && {
+ local -a words
+ words=("${(@Q)${(z)lbuf}}")
+ [[ "$words[(i)(*/|)git(|-[^/]##)]" -le $#words ]]
+ }
+ then
+ local i
+ i="$words[(I)([;(){\&]|\&[\&\!]|\|\||[=<>]\(*)]"
+ if [[ $i -gt 0 ]]; then
+ shift $((i-1)) words
+ if [[ "$words[1]" == [\=\<\>]\(* ]]; then
+ words[1]="${words[1]#[=<>]\(}"
+ else
+ [[ "$words[1]" == \; && $words[2] == (then|else|elif|do) ]] && shift words
+ shift words
+ fi
+ fi
+ while [[ "$words[1]" == (if|while|until|\!) ]]; do
+ shift words
+ done
+ while [[ "$words[1]" == [A-Za-z_][A-Za-z0-9_]#=* ]]; do
+ shift words
+ done
+ [[ "$words[1]" == (*/|)git(|-[^/]##) ]] && {
+ local subcommand
+ subcommand="${words[1]##*/git-}"
+ if [[ -z "$subcommand" ]]; then
+ shift words
+ subcommand="$words[1]"
+ fi
+ [[ $#words -ge 2 ]]
+ } &&
+ case "$subcommand" in
+ # commands that may take pathspec but never take refspec with [{}~^]
+ (add|rm|am|apply|check-attr|checkout-index|clean|clone|config|diff-files|hash-object|help|index-pack|mailinfo|mailsplit|merge-file|merge-index|mergetool|mktag|mv|pack-objects|pack-redundant|relink|send-email|show-index|show-ref|stage|status|verify-pack)
+ false ;;
+ # commands that may take pathspec but rarely take refspec with [{}~^]
+ (for-each-ref|grep|ls-files|update-index)
+ false ;;
+ (archive|ls-tree)
+ ! [[ $#words -ge 3 &&
+ "$words[-2]" == [^-]* ]] ;;
+ (diff-tree)
+ ! [[ $#words -ge 4 &&
+ "$words[-2]" == [^-]* &&
+ "$words[-3]" == [^-]* ]] ;;
+ (*)
+ [[ $words[(i)--] -gt $#words ]] ;;
+ esac &&
+ case "${words[-1]%%"$KEYS"}" in
+ (*[@^])
+ [[ "$KEYS" == [{~^]* ]] ;;
+ (*[@^]\{[^}]##)
+ [[ "$KEYS" == \}* ]] ;;
+ (?*)
+ [[ "$KEYS" == [~^]* ]] ;;
+ (*)
+ false ;;
+ esac &&
+ LBUFFER="$LBUFFER\\"
+ fi
+
+ zle "$self_insert_function"
+}
+
+git-escape-magic.on() {
+ emulate -L zsh
+ local self_insert_function="${$(zle -lL | awk \
+ '$1=="zle"&&$2=="-N"&&$3=="self-insert"{print $4;exit}'):-.self-insert}"
+
+ [[ "$self_insert_function" == git-escape-magic.self-insert ]] &&
+ return 0
+
+ # For url-quote-magic which does not zle -N itself
+ zle -la "$self_insert_function" || zle -N "$self_insert_function"
+
+ zstyle ':git-escape-magic' self-insert-function "$self_insert_function"
+
+ zle -A git-escape-magic.self-insert self-insert
+ return 0
+}
+
+git-escape-magic.off() {
+ emulate -L zsh
+ local self_insert_function
+ zstyle -s ':git-escape-magic' self-insert-function self_insert_function
+
+ [[ -n "$self_insert_function" ]] &&
+ zle -A "$self_insert_function" self-insert
+ return 0
+}
+
+zle -N git-escape-magic.self-insert
+zle -N git-escape-magic.on
+zle -N git-escape-magic.off
+
+git-escape-magic() {
+ git-escape-magic.on
+}
+
+[[ -o kshautoload ]] || git-escape-magic "$@"
+
diff --git a/plugins/git-escape-magic/git-escape-magic.plugin.zsh b/plugins/git-escape-magic/git-escape-magic.plugin.zsh
new file mode 100644
index 000000000..c021ea707
--- /dev/null
+++ b/plugins/git-escape-magic/git-escape-magic.plugin.zsh
@@ -0,0 +1,9 @@
+# Automatically detect and escape zsh globbing meta-characters when used with
+# git refspec characters like `[^~{}]`. NOTE: This must be loaded _after_
+# url-quote-magic.
+#
+# This trick is detailed at https://github.com/knu/zsh-git-escape-magic and is
+# what allowed this plugin to exist.
+
+autoload -Uz git-escape-magic
+git-escape-magic
diff --git a/plugins/git-extras/git-extras.plugin.zsh b/plugins/git-extras/git-extras.plugin.zsh
index ef6c35988..b86d7c5b6 100644
--- a/plugins/git-extras/git-extras.plugin.zsh
+++ b/plugins/git-extras/git-extras.plugin.zsh
@@ -454,9 +454,9 @@ zstyle ':completion:*:*:git:*' user-commands $existing_user_commands \
extras:'awesome git utilities' \
feature:'create/merge feature branch' \
force-clone:'overwrite local repositories with clone' \
- fork:'fork a repo on github' \
+ fork:'fork a repo on GitHub' \
fresh-branch:'create fresh branches' \
- gh-pages:'create the github pages branch' \
+ gh-pages:'create the GitHub pages branch' \
graft:'merge and destroy a given branch' \
guilt:'calculate change between two revisions' \
ignore-io:'get sample gitignore file' \
diff --git a/plugins/git-hubflow/git-hubflow.plugin.zsh b/plugins/git-hubflow/git-hubflow.plugin.zsh
index 05479f7e6..50d7b23ce 100644
--- a/plugins/git-hubflow/git-hubflow.plugin.zsh
+++ b/plugins/git-hubflow/git-hubflow.plugin.zsh
@@ -75,8 +75,8 @@ __git-hf-release ()
'finish:Finish a release branch.'
'list:List all your release branches. (Alias to `git hf release`)'
'cancel:Cancel release'
- 'push:Push release to github'
- 'pull:Pull release from github'
+ 'push:Push release to GitHub'
+ 'pull:Pull release from GitHub'
'track:Track release'
)
_describe -t commands 'git hf release' subcommands
@@ -133,8 +133,8 @@ __git-hf-hotfix ()
'list:List all your hotfix branches. (Alias to `git hf hotfix`)'
'publish:Publish the hotfix branch.'
'track:Track the hotfix branch.'
- 'pull:Pull the hotfix from github.'
- 'push:Push the hotfix to github.'
+ 'pull:Pull the hotfix from GitHub.'
+ 'push:Push the hotfix to GitHub.'
'cancel:Cancel the hotfix.'
)
_describe -t commands 'git hf hotfix' subcommands
@@ -195,8 +195,8 @@ __git-hf-feature ()
'diff:Diff'
'rebase:Rebase feature branch against develop'
'checkout:Checkout feature'
- 'pull:Pull feature branch from github'
- 'push:Push feature branch to github'
+ 'pull:Pull feature branch from GitHub'
+ 'push:Push feature branch to GitHub'
'cancel:Cancel feature'
)
_describe -t commands 'git hf feature' subcommands
diff --git a/plugins/git-prompt/README.md b/plugins/git-prompt/README.md
new file mode 100644
index 000000000..e3b2d623a
--- /dev/null
+++ b/plugins/git-prompt/README.md
@@ -0,0 +1,61 @@
+# git-prompt plugin
+
+A `zsh` prompt that displays information about the current git repository. In particular:
+the branch name, difference with remote branch, number of files staged or changed, etc.
+
+To use it, add `git-prompt` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... git-prompt)
+```
+
+See the [original repository](https://github.com/olivierverdier/zsh-git-prompt).
+
+## Examples
+
+The prompt may look like the following:
+
+- `(master↑3|✚1)`: on branch `master`, ahead of remote by 3 commits, 1 file changed but not staged
+- `(status|●2)`: on branch `status`, 2 files staged
+- `(master|✚7…)`: on branch `master`, 7 files changed, some files untracked
+- `(master|✖2✚3)`: on branch `master`, 2 conflicts, 3 files changed
+- `(experimental↓2↑3|✔)`: on branch `experimental`; your branch has diverged by 3 commits, remote by 2 commits; the repository is otherwise clean
+- `(:70c2952|✔)`: not on any branch; parent commit has hash `70c2952`; the repository is otherwise clean
+
+## Prompt Structure
+
+By default, the general appearance of the prompt is:
+
+```
+(<branch><branch tracking>|<local status>)
+```
+
+The symbols are as follows:
+
+### Local Status Symbols
+
+| Symbol | Meaning |
+|--------|--------------------------------|
+| ✔ | repository clean |
+| ●n | there are `n` staged files |
+| ✖n | there are `n` unmerged files |
+| ✚n | there are `n` unstaged files |
+| … | there are some untracked files |
+
+### Branch Tracking Symbols
+
+| Symbol | Meaning |
+|--------|---------------------------------------------------------------|
+| ↑n | ahead of remote by `n` commits |
+| ↓n | behind remote by `n` commits |
+| ↓m↑n | branches diverged: other by `m` commits, yours by `n` commits |
+
+## Customisation
+
+- Set the variable `ZSH_THEME_GIT_PROMPT_CACHE` to any value in order to enable caching.
+- You may also change a number of variables (whose name start with `ZSH_THEME_GIT_PROMPT_`)
+ to change the appearance of the prompt. Take a look at the bottom of the [plugin file](git-prompt.plugin.zsh)`
+ to see what variables are available.
+
+
+**Enjoy!**
diff --git a/plugins/git-prompt/git-prompt.plugin.zsh b/plugins/git-prompt/git-prompt.plugin.zsh
index 2776f297f..da674af98 100644
--- a/plugins/git-prompt/git-prompt.plugin.zsh
+++ b/plugins/git-prompt/git-prompt.plugin.zsh
@@ -1,6 +1,3 @@
-# ZSH Git Prompt Plugin from:
-# https://github.com/olivierverdier/zsh-git-prompt
-
__GIT_PROMPT_DIR="${0:A:h}"
## Hook function definitions
@@ -23,9 +20,10 @@ function precmd_update_git_vars() {
fi
}
-chpwd_functions+=(chpwd_update_git_vars)
-precmd_functions+=(precmd_update_git_vars)
-preexec_functions+=(preexec_update_git_vars)
+autoload -U add-zsh-hook
+add-zsh-hook chpwd chpwd_update_git_vars
+add-zsh-hook precmd precmd_update_git_vars
+add-zsh-hook preexec preexec_update_git_vars
## Function definitions
diff --git a/plugins/git-prompt/gitstatus.py b/plugins/git-prompt/gitstatus.py
index a4d07cde6..390a50a6f 100644
--- a/plugins/git-prompt/gitstatus.py
+++ b/plugins/git-prompt/gitstatus.py
@@ -1,6 +1,7 @@
#!/usr/bin/env python
from __future__ import print_function
+import os
import sys
import re
import shlex
@@ -30,7 +31,7 @@ def get_tagname_or_hash():
# `git status --porcelain --branch` can collect all information
# branch, remote_branch, untracked, staged, changed, conflicts, ahead, behind
-po = Popen(['git', 'status', '--porcelain', '--branch'], stdout=PIPE, stderr=PIPE)
+po = Popen(['git', 'status', '--porcelain', '--branch'], env=dict(os.environ, LANG="C"), stdout=PIPE, stderr=PIPE)
stdout, sterr = po.communicate()
if po.returncode != 0:
sys.exit(0) # Not a git repository
diff --git a/plugins/git-remote-branch/README.md b/plugins/git-remote-branch/README.md
new file mode 100644
index 000000000..bd73e5dec
--- /dev/null
+++ b/plugins/git-remote-branch/README.md
@@ -0,0 +1,14 @@
+# git-remote-branch plugin
+
+This plugin adds completion for [`grb`](https://github.com/webmat/git_remote_branch),
+or `git_remote_branch`.
+
+To use it, add `git-remote-branch` to the plugins array of your `.zshrc` file:
+```
+plugins=(... git-remote-branch)
+```
+
+## Deprecation
+
+[git_remote_branch was archived in 2018](https://github.com/webmat/git_remote_branch#archived),
+meaning it's not actively maintained anymore. Use at your own risk.
diff --git a/plugins/git/README.md b/plugins/git/README.md
index 76da2a8ae..7878f747b 100644
--- a/plugins/git/README.md
+++ b/plugins/git/README.md
@@ -1,10 +1,216 @@
-## git
+# git plugin
-**Maintainer:** [@ncanceill](https://github.com/ncanceill)
+The git plugin provides many [aliases](#aliases) and a few useful [functions](#functions).
-This plugin adds many useful aliases and functions.
+To use it, add `git` to the plugins array in your zshrc file:
-### Usage
+```zsh
+plugins=(... git)
+```
-See the [wiki](https://github.com/robbyrussell/oh-my-zsh/wiki/Plugin:git) for a list of aliases and functions provided by the plugin.
+## Aliases
+| Alias | Command |
+|:---------------------|:------------------------------------------------------------------------------------------------------------------------------|
+| g | git |
+| ga | git add |
+| gaa | git add --all |
+| gapa | git add --patch |
+| gau | git add --update |
+| gav | git add --verbose |
+| gap | git apply |
+| gb | git branch |
+| gba | git branch -a |
+| gbd | git branch -d |
+| gbda | git branch --no-color --merged \| command grep -vE "^(\+|\*\|\s*(master\|develop\|dev)\s*$)" \| command xargs -n 1 git branch -d |
+| gbD | git branch -D |
+| gbl | git blame -b -w |
+| gbnm | git branch --no-merged |
+| gbr | git branch --remote |
+| gbs | git bisect |
+| gbsb | git bisect bad |
+| gbsg | git bisect good |
+| gbsr | git bisect reset |
+| gbss | git bisect start |
+| gc | git commit -v |
+| gc! | git commit -v --amend |
+| gcn! | git commit -v --no-edit --amend |
+| gca | git commit -v -a |
+| gca! | git commit -v -a --amend |
+| gcan! | git commit -v -a --no-edit --amend |
+| gcans! | git commit -v -a -s --no-edit --amend |
+| gcam | git commit -a -m |
+| gcsm | git commit -s -m |
+| gcb | git checkout -b |
+| gcf | git config --list |
+| gcl | git clone --recurse-submodules |
+| gclean | git clean -id |
+| gpristine | git reset --hard && git clean -dfx |
+| gcm | git checkout master |
+| gcd | git checkout develop |
+| gcmsg | git commit -m |
+| gco | git checkout |
+| gcount | git shortlog -sn |
+| gcp | git cherry-pick |
+| gcpa | git cherry-pick --abort |
+| gcpc | git cherry-pick --continue |
+| gcs | git commit -S |
+| gd | git diff |
+| gdca | git diff --cached |
+| gdcw | git diff --cached --word-diff |
+| gdct | git describe --tags $(git rev-list --tags --max-count=1) |
+| gds | git diff --staged |
+| gdt | git diff-tree --no-commit-id --name-only -r |
+| gdv | git diff -w $@ \| view - |
+| gdw | git diff --word-diff |
+| gf | git fetch |
+| gfa | git fetch --all --prune |
+| gfg | git ls-files \| grep |
+| gfo | git fetch origin |
+| gg | git gui citool |
+| gga | git gui citool --amend |
+| ggf | git push --force origin $(current_branch) |
+| ggfl | git push --force-with-lease origin $(current_branch) |
+| ggl | git pull origin $(current_branch) |
+| ggp | git push origin $(current_branch) |
+| ggpnp | ggl && ggp |
+| ggpull | git pull origin "$(git_current_branch)" |
+| ggpur | ggu |
+| ggpush | git push origin "$(git_current_branch)" |
+| ggsup | git branch --set-upstream-to=origin/$(git_current_branch) |
+| ggu | git pull --rebase origin $(current_branch) |
+| gpsup | git push --set-upstream origin $(git_current_branch) |
+| ghh | git help |
+| gignore | git update-index --assume-unchanged |
+| gignored | git ls-files -v \| grep "^[[:lower:]]" |
+| git-svn-dcommit-push | git svn dcommit && git push github master:svntrunk |
+| gk | gitk --all --branches |
+| gke | gitk --all $(git log -g --pretty=%h) |
+| gl | git pull |
+| glg | git log --stat |
+| glgp | git log --stat -p |
+| glgg | git log --graph |
+| glgga | git log --graph --decorate --all |
+| glgm | git log --graph --max-count=10 |
+| glo | git log --oneline --decorate |
+| glol | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' |
+| glols | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --stat |
+| glod | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' |
+| glods | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' --date=short |
+| glola | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --all |
+| glog | git log --oneline --decorate --graph |
+| gloga | git log --oneline --decorate --graph --all |
+| glp | `_git_log_prettily` |
+| gm | git merge |
+| gmom | git merge origin/master |
+| gmt | git mergetool --no-prompt |
+| gmtvim | git mergetool --no-prompt --tool=vimdiff |
+| gmum | git merge upstream/master |
+| gma | git merge --abort |
+| gp | git push |
+| gpd | git push --dry-run |
+| gpf | git push --force-with-lease |
+| gpf! | git push --force |
+| gpoat | git push origin --all && git push origin --tags |
+| gpu | git push upstream |
+| gpv | git push -v |
+| gr | git remote |
+| gra | git remote add |
+| grb | git rebase |
+| grba | git rebase --abort |
+| grbc | git rebase --continue |
+| grbd | git rebase develop |
+| grbi | git rebase -i |
+| grbm | git rebase master |
+| grbs | git rebase --skip |
+| grev | git revert |
+| grh | git reset |
+| grhh | git reset --hard |
+| groh | git reset origin/$(git_current_branch) --hard |
+| grm | git rm |
+| grmc | git rm --cached |
+| grmv | git remote rename |
+| grrm | git remote remove |
+| grs | git restore |
+| grset | git remote set-url |
+| grss | git restore --source |
+| grt | cd "$(git rev-parse --show-toplevel \|\| echo .)" |
+| gru | git reset -- |
+| grup | git remote update |
+| grv | git remote -v |
+| gsb | git status -sb |
+| gsd | git svn dcommit |
+| gsh | git show |
+| gsi | git submodule init |
+| gsps | git show --pretty=short --show-signature |
+| gsr | git svn rebase |
+| gss | git status -s |
+| gst | git status |
+| gsta | git stash push |
+| gsta | git stash save |
+| gstaa | git stash apply |
+| gstc | git stash clear |
+| gstd | git stash drop |
+| gstl | git stash list |
+| gstp | git stash pop |
+| gsts | git stash show --text |
+| gstall | git stash --all |
+| gsu | git submodule update |
+| gsw | git switch |
+| gswc | git switch -c |
+| gts | git tag -s |
+| gtv | git tag \| sort -V |
+| gtl | gtl(){ git tag --sort=-v:refname -n -l ${1}* }; noglob gtl |
+| gunignore | git update-index --no-assume-unchanged |
+| gunwip | git log -n 1 \| grep -q -c "\-\-wip\-\-" && git reset HEAD~1 |
+| gup | git pull --rebase |
+| gupv | git pull --rebase -v |
+| gupa | git pull --rebase --autostash |
+| gupav | git pull --rebase --autostash -v |
+| glum | git pull upstream master |
+| gwch | git whatchanged -p --abbrev-commit --pretty=medium |
+| gwip | git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign -m "--wip-- [skip ci]" |
+
+### Deprecated
+
+These are aliases that have been removed, renamed, or otherwise modified in a way that may, or may not, receive further support.
+
+| Alias | Command | Modification |
+| :----- | :----------------------------------------------------------------------------------| --------------------------------------------------------------------------------------------------- |
+| gap | git add --patch | new alias `gapa` |
+| gcl | git config --list | new alias `gcf` |
+| gdc | git diff --cached | new alias `gdca` |
+| gdt | git difftool | no replacement |
+| ggpull | git pull origin $(current_branch) | new alias `ggl` (`ggpull` still exists for now though) |
+| ggpur | git pull --rebase origin $(current_branch) | new alias `ggu` (`ggpur` still exists for now though) |
+| ggpush | git push origin $(current_branch) | new alias `ggp` (`ggpush` still exists for now though) |
+| gk | gitk --all --branches | now aliased to `gitk --all --branches` |
+| glg | git log --stat --max-count = 10 | now aliased to `git log --stat --color` |
+| glgg | git log --graph --max-count = 10 | now aliased to `git log --graph --color` |
+| gwc | git whatchanged -p --abbrev-commit --pretty = medium | new alias `gwch` |
+
+## Functions
+
+### Current
+
+| Command | Description |
+|:-----------------------|:----------------------------------------|
+| current_branch | Return the name of the current branch |
+| git_current_user_name | Returns the `user.name` config value |
+| git_current_user_email | Returns the `user.email` config value |
+
+### Work in Progress (WIP)
+
+These features allow to pause a branch development and switch to another one (_"Work in Progress"_, or wip). When you want to go back to work, just unwip it.
+
+| Command | Description |
+|:-----------------|:------------------------------------------------|
+| work_in_progress | Echoes a warning if the current branch is a wip |
+| gwip | Commit wip branch |
+| gunwip | Uncommit wip branch |
+
+### Deprecated
+
+| Command | Description | Reason |
+|:-----------------------|:----------------------------------------|:----------------------------------------------------------------|
+| current_repository | Return the names of the current remotes | Didn't work properly. Use `git remote -v` instead (`grv` alias) |
diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh
index 5bef95bd5..d8c4cffd1 100644
--- a/plugins/git/git.plugin.zsh
+++ b/plugins/git/git.plugin.zsh
@@ -1,7 +1,3 @@
-# Query/use custom command for `git`.
-zstyle -s ":vcs_info:git:*:-all-" "command" _omz_git_git_cmd
-: ${_omz_git_git_cmd:=git}
-
#
# Functions
#
@@ -13,19 +9,15 @@ zstyle -s ":vcs_info:git:*:-all-" "command" _omz_git_git_cmd
function current_branch() {
git_current_branch
}
-# 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
}
+compdef _git _git_log_prettily=git-log
+
# 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
@@ -50,7 +42,7 @@ alias gap='git apply'
alias gb='git branch'
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 gbD='git branch -D'
alias gbl='git blame -b -w'
alias gbnm='git branch --no-merged'
@@ -80,7 +72,6 @@ alias gcd='git checkout develop'
alias gcmsg='git commit -m'
alias gco='git checkout'
alias gcount='git shortlog -sn'
-compdef _git gcount
alias gcp='git cherry-pick'
alias gcpa='git cherry-pick --abort'
alias gcpc='git cherry-pick --continue'
@@ -89,35 +80,35 @@ alias gcs='git commit -S'
alias gd='git diff'
alias gdca='git diff --cached'
alias gdcw='git diff --cached --word-diff'
-alias gdct='git describe --tags `git rev-list --tags --max-count=1`'
+alias gdct='git describe --tags $(git rev-list --tags --max-count=1)'
alias gds='git diff --staged'
alias gdt='git diff-tree --no-commit-id --name-only -r'
alias gdw='git diff --word-diff'
-gdv() { git diff -w "$@" | view - }
+function gdv() { git diff -w "$@" | view - }
compdef _git gdv=git-diff
alias gf='git fetch'
alias gfa='git fetch --all --prune'
alias gfo='git fetch origin'
-function gfg() { git ls-files | grep $@ }
-compdef _grep gfg
+alias gfg='git ls-files | grep'
alias gg='git gui citool'
alias gga='git gui citool --amend'
-ggf() {
+function ggf() {
[[ "$#" != 1 ]] && local b="$(git_current_branch)"
git push --force origin "${b:=$1}"
}
-ggfl() {
+compdef _git ggf=git-checkout
+function ggfl() {
[[ "$#" != 1 ]] && local b="$(git_current_branch)"
git push --force-with-lease origin "${b:=$1}"
}
-compdef _git ggf=git-checkout
+compdef _git ggfl=git-checkout
-ggl() {
+function ggl() {
if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then
git pull origin "${*}"
else
@@ -127,7 +118,7 @@ ggl() {
}
compdef _git ggl=git-checkout
-ggp() {
+function ggp() {
if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then
git push origin "${*}"
else
@@ -137,7 +128,7 @@ ggp() {
}
compdef _git ggp=git-checkout
-ggpnp() {
+function ggpnp() {
if [[ "$#" == 0 ]]; then
ggl && ggp
else
@@ -146,20 +137,15 @@ ggpnp() {
}
compdef _git ggpnp=git-checkout
-ggu() {
+function ggu() {
[[ "$#" != 1 ]] && local b="$(git_current_branch)"
git pull --rebase origin "${b:=$1}"
}
compdef _git ggu=git-checkout
alias ggpur='ggu'
-compdef _git ggpur=git-checkout
-
alias ggpull='git pull origin "$(git_current_branch)"'
-compdef _git ggpull=git-checkout
-
alias ggpush='git push origin "$(git_current_branch)"'
-compdef _git ggpush=git-checkout
alias ggsup='git branch --set-upstream-to=origin/$(git_current_branch)'
alias gpsup='git push --set-upstream origin $(git_current_branch)'
@@ -169,12 +155,9 @@ alias ghh='git help'
alias gignore='git update-index --assume-unchanged'
alias gignored='git ls-files -v | grep "^[[:lower:]]"'
alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk'
-compdef _git git-svn-dcommit-push=git
alias gk='\gitk --all --branches'
-compdef _git gk='gitk'
alias gke='\gitk --all $(git log -g --pretty=%h)'
-compdef _git gke='gitk'
alias gl='git pull'
alias glg='git log --stat'
@@ -191,7 +174,6 @@ alias glola="git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgr
alias glog='git log --oneline --decorate --graph'
alias gloga='git log --oneline --decorate --graph --all'
alias glp="_git_log_prettily"
-compdef _git glp=git-log
alias gm='git merge'
alias gmom='git merge origin/master'
@@ -205,7 +187,6 @@ alias gpd='git push --dry-run'
alias gpf='git push --force-with-lease'
alias gpf!='git push --force'
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'
@@ -218,6 +199,7 @@ alias grbd='git rebase develop'
alias grbi='git rebase -i'
alias grbm='git rebase master'
alias grbs='git rebase --skip'
+alias grev='git revert'
alias grh='git reset'
alias grhh='git reset --hard'
alias groh='git reset origin/$(git_current_branch) --hard'
@@ -225,7 +207,9 @@ alias grm='git rm'
alias grmc='git rm --cached'
alias grmv='git remote rename'
alias grrm='git remote remove'
+alias grs='git restore'
alias grset='git remote set-url'
+alias grss='git restore --source'
alias grt='cd "$(git rev-parse --show-toplevel || echo .)"'
alias gru='git reset --'
alias grup='git remote update'
@@ -239,7 +223,13 @@ 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 save'
+
+# use the default stash push on git 2.13 and newer
+autoload -Uz is-at-least
+is-at-least 2.13 "$(git --version 2>/dev/null | awk '{print $3}')" \
+ && alias gsta='git stash push' \
+ || alias gsta='git stash save'
+
alias gstaa='git stash apply'
alias gstc='git stash clear'
alias gstd='git stash drop'
@@ -248,9 +238,12 @@ alias gstp='git stash pop'
alias gsts='git stash show --text'
alias gstall='git stash --all'
alias gsu='git submodule update'
+alias gsw='git switch'
+alias gswc='git switch -c'
alias gts='git tag -s'
alias gtv='git tag | sort -V'
+alias gtl='gtl(){ git tag --sort=-v:refname -n -l "${1}*" }; noglob gtl'
alias gunignore='git update-index --no-assume-unchanged'
alias gunwip='git log -n 1 | grep -q -c "\-\-wip\-\-" && git reset HEAD~1'
diff --git a/plugins/gitfast/README.md b/plugins/gitfast/README.md
index c3073709e..23db5393b 100644
--- a/plugins/gitfast/README.md
+++ b/plugins/gitfast/README.md
@@ -10,129 +10,6 @@ plugins=(... gitfast)
## Aliases
-| Alias | Command |
-| -------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
-| g | `git` |
-| ga | `git add` |
-| gaa | `git add --all` |
-| gapa | `git add --patch` |
-| gau | `git add --update` |
-| gb | `git branch` |
-| gba | `git branch -a` |
-| gbd | `git branch -d` |
-| gbda | `git branch --no-color --merged | command grep -vE "^(\*|\s*(master|develop|dev)\s*$)" | command xargs -n 1 git branch -d` |
-| gbl | `git blame -b -w` |
-| gbnm | `git branch --no-merged` |
-| gbr | `git branch --remote` |
-| gbs | `git bisect` |
-| gbsb | `git bisect bad` |
-| gbsg | `git bisect good` |
-| gbsr | `git bisect reset` |
-| gbss | `git bisect start` |
-| gc | `git commit -v` |
-| gc! | `git commit -v --amend` |
-| gca | `git commit -v -a` |
-| gca! | `git commit -v -a --amend` |
-| gcam | `git commit -a -m` |
-| gcan! | `git commit -v -a --no-edit --amend` |
-| gcans! | `git commit -v -a -s --no-edit --amend` |
-| gcb | `git checkout -b` |
-| gcd | `git checkout develop` |
-| gcf | `git config --list` |
-| gcl | `git clone --recursive` |
-| gclean | `git clean -fd` |
-| gcm | `git checkout master` |
-| gcmsg | `git commit -m` |
-| gcn! | `git commit -v --no-edit --amend` |
-| gco | `git checkout` |
-| gcount | `git shortlog -sn` |
-| gcp | `git cherry-pick` |
-| gcpa | `git cherry-pick --abort` |
-| gcpc | `git cherry-pick --continue` |
-| gcs | `git commit -S` |
-| gcsm | `git commit -s -m` |
-| gd | `git diff` |
-| gdca | `git diff --cached` |
-| gdct | `` git describe --tags `git rev-list --tags --max-count=1` `` |
-| gdt | `git diff-tree --no-commit-id --name-only -r` |
-| gdw | `git diff --word-diff` |
-| gf | `git fetch` |
-| gfa | `git fetch --all --prune` |
-| gfo | `git fetch origin` |
-| gg | `git gui citool` |
-| gga | `git gui citool --amend` |
-| ggpull | `git pull origin $(git_current_branch)` |
-| ggpur | `ggu` |
-| ggpush | `git push origin $(git_current_branch)` |
-| ggsup | `git branch --set-upstream-to=origin/$(git_current_branch)` |
-| ghh | `git help` |
-| gignore | `git update-index --assume-unchanged` |
-| gignored | `git ls-files -v | grep "^[[:lower:]]"` |
-| git-svn-dcommit-push | `git svn dcommit && git push github master:svntrunk` |
-| gk | `\gitk --all --branches` |
-| gke | `\gitk --all $(git log -g --pretty=%h)` |
-| gl | `git pull` |
-| glg | `git log --stat` |
-| glgg | `git log --graph` |
-| glgga | `git log --graph --decorate --all` |
-| glgm | `git log --graph --max-count=10` |
-| glgp | `git log --stat -p` |
-| glo | `git log --oneline --decorate` |
-| glog | `git log --oneline --decorate --graph` |
-| gloga | `git log --oneline --decorate --graph --all` |
-| glol | `git log --graph --pretty='\''%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'\'' --abbrev-commit` |
-| glola | `git log --graph --pretty='\''%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'\'' --abbrev-commit --all` |
-| glp | `_git_log_prettily` |
-| glum | `git pull upstream master` |
-| gm | `git merge` |
-| gmom | `git merge origin/master` |
-| gmt | `git mergetool --no-prompt` |
-| gmtvim | `git mergetool --no-prompt --tool=vimdiff` |
-| gmum | `git merge upstream/master` |
-| gp | `git push` |
-| gpd | `git push --dry-run` |
-| gpoat | `git push origin --all && git push origin --tags` |
-| gpristine | `git reset --hard && git clean -dfx` |
-| gpsup | `git push --set-upstream origin $(git_current_branch)` |
-| gpu | `git push upstream` |
-| gpv | `git push -v` |
-| gr | `git remote` |
-| gra | `git remote add` |
-| grb | `git rebase` |
-| grba | `git rebase --abort` |
-| grbc | `git rebase --continue` |
-| grbi | `git rebase -i` |
-| grbm | `git rebase master` |
-| grbs | `git rebase --skip` |
-| grh | `git reset HEAD` |
-| grhh | `git reset HEAD --hard` |
-| grmv | `git remote rename` |
-| grrm | `git remote remove` |
-| grset | `git remote set-url` |
-| grt | `cd $(git rev-parse --show-toplevel || echo ".")` |
-| gru | `git reset --` |
-| grup | `git remote update` |
-| grv | `git remote -v` |
-| gsb | `git status -sb` |
-| gsd | `git svn dcommit` |
-| gsi | `git submodule init` |
-| gsps | `git show --pretty=short --show-signature` |
-| gsr | `git svn rebase` |
-| gss | `git status -s` |
-| gst | `git status` |
-| gsta | `git stash save` |
-| gstaa | `git stash apply` |
-| gstc | `git stash clear` |
-| gstd | `git stash drop` |
-| gstl | `git stash list` |
-| gstp | `git stash pop` |
-| gsts | `git stash show --text` |
-| gsu | `git submodule update` |
-| gts | `git tag -s` |
-| gtv | `git tag | sort -V` |
-| gunignore | `git update-index --no-assume-unchanged` |
-| gunwip | `git log -n 1 | grep -q -c "\-\-wip\-\-" && git reset HEAD~1` |
-| gup | `git pull --rebase` |
-| gupv | `git pull --rebase -v` |
-| gwch | `git whatchanged -p --abbrev-commit --pretty=medium` |
-| gwip | `git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify -m "--wip-- [skip ci]"` |
+An earlier version of the plugin also loaded the git plugin. If you want to keep those
+aliases enable the [git plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/git)
+as well.
diff --git a/plugins/gitfast/_git b/plugins/gitfast/_git
index 6d1b4ecc7..886bf95d1 100644
--- a/plugins/gitfast/_git
+++ b/plugins/gitfast/_git
@@ -9,7 +9,7 @@
#
# If your script is somewhere else, you can configure it on your ~/.zshrc:
#
-# zstyle ':completion:*:*:git:*' script ~/.git-completion.sh
+# zstyle ':completion:*:*:git:*' script ~/.git-completion.zsh
#
# The recommended way to install this script is to copy to '~/.zsh/_git', and
# then add the following to your ~/.zshrc file:
@@ -30,7 +30,7 @@ if [ -z "$script" ]; then
local -a locations
local e
locations=(
- "$(dirname ${funcsourcetrace[1]%:*})/git-completion.bash"
+ $(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
@@ -39,7 +39,7 @@ if [ -z "$script" ]; then
test -f $e && script="$e" && break
done
fi
-ZSH_VERSION='' . "$script"
+GIT_SOURCING_ZSH_COMPLETION=y . "$script"
__gitcomp ()
{
@@ -67,6 +67,15 @@ __gitcomp ()
esac
}
+__gitcomp_direct ()
+{
+ emulate -L zsh
+
+ local IFS=$'\n'
+ compset -P '*[=:]'
+ compadd -Q -- ${=1} && _ret=0
+}
+
__gitcomp_nl ()
{
emulate -L zsh
@@ -84,13 +93,22 @@ __gitcomp_nl_append ()
compadd -Q -S "${4- }" -p "${2-}" -- ${=1} && _ret=0
}
+__gitcomp_file_direct ()
+{
+ emulate -L zsh
+
+ local IFS=$'\n'
+ compset -P '*[=:]'
+ compadd -f -- ${=1} && _ret=0
+}
+
__gitcomp_file ()
{
emulate -L zsh
local IFS=$'\n'
compset -P '*[=:]'
- compadd -Q -p "${2-}" -f -- ${=1} && _ret=0
+ compadd -p "${2-}" -f -- ${=1} && _ret=0
}
__git_zsh_bash_func ()
@@ -214,10 +232,8 @@ _git ()
if (( $+functions[__${service}_zsh_main] )); then
__${service}_zsh_main
- elif (( $+functions[__${service}_main] )); then
+ else
emulate ksh -c __${service}_main
- elif (( $+functions[_${service}] )); then
- emulate ksh -c _${service}
fi
let _ret && _default && _ret=0
diff --git a/plugins/gitfast/git-completion.bash b/plugins/gitfast/git-completion.bash
index 8ce6b5c5f..e087c4bf0 100644
--- a/plugins/gitfast/git-completion.bash
+++ b/plugins/gitfast/git-completion.bash
@@ -28,27 +28,58 @@
# completion style. For example '!f() { : git commit ; ... }; f' will
# tell the completion to use commit completion. This also works with aliases
# of form "!sh -c '...'". For example, "!sh -c ': git commit ; ... '".
+#
+# Compatible with bash 3.2.57.
+#
+# You can set the following environment variables to influence the behavior of
+# the completion routines:
+#
+# GIT_COMPLETION_CHECKOUT_NO_GUESS
+#
+# When set to "1", do not include "DWIM" suggestions in git-checkout
+# and git-switch completion (e.g., completing "foo" when "origin/foo"
+# exists).
case "$COMP_WORDBREAKS" in
*:*) : great ;;
*) COMP_WORDBREAKS="$COMP_WORDBREAKS:"
esac
+# Discovers the path to the git repository taking any '--git-dir=<path>' and
+# '-C <path>' options into account and stores it in the $__git_repo_path
+# variable.
+__git_find_repo_path ()
+{
+ if [ -n "$__git_repo_path" ]; then
+ # we already know where it is
+ return
+ fi
+
+ if [ -n "${__git_C_args-}" ]; then
+ __git_repo_path="$(git "${__git_C_args[@]}" \
+ ${__git_dir:+--git-dir="$__git_dir"} \
+ rev-parse --absolute-git-dir 2>/dev/null)"
+ elif [ -n "${__git_dir-}" ]; then
+ test -d "$__git_dir" &&
+ __git_repo_path="$__git_dir"
+ elif [ -n "${GIT_DIR-}" ]; then
+ test -d "${GIT_DIR-}" &&
+ __git_repo_path="$GIT_DIR"
+ elif [ -d .git ]; then
+ __git_repo_path=.git
+ else
+ __git_repo_path="$(git rev-parse --git-dir 2>/dev/null)"
+ fi
+}
+
+# Deprecated: use __git_find_repo_path() and $__git_repo_path instead
# __gitdir accepts 0 or 1 arguments (i.e., location)
# returns location of .git repo
__gitdir ()
{
if [ -z "${1-}" ]; then
- if [ -n "${__git_dir-}" ]; then
- echo "$__git_dir"
- elif [ -n "${GIT_DIR-}" ]; then
- test -d "${GIT_DIR-}" || return 1
- echo "$GIT_DIR"
- elif [ -d .git ]; then
- echo .git
- else
- git rev-parse --git-dir 2>/dev/null
- fi
+ __git_find_repo_path || return 1
+ echo "$__git_repo_path"
elif [ -d "$1/.git" ]; then
echo "$1/.git"
else
@@ -56,6 +87,78 @@ __gitdir ()
fi
}
+# Runs git with all the options given as argument, respecting any
+# '--git-dir=<path>' and '-C <path>' options present on the command line
+__git ()
+{
+ git ${__git_C_args:+"${__git_C_args[@]}"} \
+ ${__git_dir:+--git-dir="$__git_dir"} "$@" 2>/dev/null
+}
+
+# Removes backslash escaping, single quotes and double quotes from a word,
+# stores the result in the variable $dequoted_word.
+# 1: The word to dequote.
+__git_dequote ()
+{
+ local rest="$1" len ch
+
+ dequoted_word=""
+
+ while test -n "$rest"; do
+ len=${#dequoted_word}
+ dequoted_word="$dequoted_word${rest%%[\\\'\"]*}"
+ rest="${rest:$((${#dequoted_word}-$len))}"
+
+ case "${rest:0:1}" in
+ \\)
+ ch="${rest:1:1}"
+ case "$ch" in
+ $'\n')
+ ;;
+ *)
+ dequoted_word="$dequoted_word$ch"
+ ;;
+ esac
+ rest="${rest:2}"
+ ;;
+ \')
+ rest="${rest:1}"
+ len=${#dequoted_word}
+ dequoted_word="$dequoted_word${rest%%\'*}"
+ rest="${rest:$((${#dequoted_word}-$len+1))}"
+ ;;
+ \")
+ rest="${rest:1}"
+ while test -n "$rest" ; do
+ len=${#dequoted_word}
+ dequoted_word="$dequoted_word${rest%%[\\\"]*}"
+ rest="${rest:$((${#dequoted_word}-$len))}"
+ case "${rest:0:1}" in
+ \\)
+ ch="${rest:1:1}"
+ case "$ch" in
+ \"|\\|\$|\`)
+ dequoted_word="$dequoted_word$ch"
+ ;;
+ $'\n')
+ ;;
+ *)
+ dequoted_word="$dequoted_word\\$ch"
+ ;;
+ esac
+ rest="${rest:2}"
+ ;;
+ \")
+ rest="${rest:1}"
+ break
+ ;;
+ esac
+ done
+ ;;
+ esac
+ done
+}
+
# The following function is based on code from:
#
# bash_completion - programmable completion functions for bash 3.2+
@@ -75,8 +178,7 @@ __gitdir ()
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
# The latest version of this software can be obtained here:
#
@@ -185,6 +287,20 @@ _get_comp_words_by_ref ()
}
fi
+# Fills the COMPREPLY array with prefiltered words without any additional
+# processing.
+# Callers must take care of providing only words that match the current word
+# to be completed and adding any prefix and/or suffix (trailing space!), if
+# necessary.
+# 1: List of newline-separated matching completion words, complete with
+# prefix and suffix.
+__gitcomp_direct ()
+{
+ local IFS=$'\n'
+
+ COMPREPLY=($1)
+}
+
__gitcompappend ()
{
local x i=${#COMPREPLY[@]}
@@ -215,9 +331,32 @@ __gitcomp ()
case "$cur_" in
--*=)
;;
+ --no-*)
+ local c i=0 IFS=$' \t\n'
+ for c in $1; do
+ if [[ $c == "--" ]]; then
+ continue
+ fi
+ c="$c${4-}"
+ if [[ $c == "$cur_"* ]]; then
+ case $c in
+ --*=*|*.) ;;
+ *) c="$c " ;;
+ esac
+ COMPREPLY[i++]="${2-}$c"
+ fi
+ done
+ ;;
*)
local c i=0 IFS=$' \t\n'
for c in $1; do
+ if [[ $c == "--" ]]; then
+ c="--no-...${4-}"
+ if [[ $c == "$cur_"* ]]; then
+ COMPREPLY[i++]="${2-}$c "
+ fi
+ break
+ fi
c="$c${4-}"
if [[ $c == "$cur_"* ]]; then
case $c in
@@ -231,6 +370,48 @@ __gitcomp ()
esac
}
+# Clear the variables caching builtins' options when (re-)sourcing
+# the completion script.
+if [[ -n ${ZSH_VERSION-} ]]; then
+ unset $(set |sed -ne 's/^\(__gitcomp_builtin_[a-zA-Z0-9_][a-zA-Z0-9_]*\)=.*/\1/p') 2>/dev/null
+else
+ unset $(compgen -v __gitcomp_builtin_)
+fi
+
+# This function is equivalent to
+#
+# __gitcomp "$(git xxx --git-completion-helper) ..."
+#
+# except that the output is cached. Accept 1-3 arguments:
+# 1: the git command to execute, this is also the cache key
+# 2: extra options to be added on top (e.g. negative forms)
+# 3: options to be excluded
+__gitcomp_builtin ()
+{
+ # spaces must be replaced with underscore for multi-word
+ # commands, e.g. "git remote add" becomes remote_add.
+ local cmd="$1"
+ local incl="$2"
+ local excl="$3"
+
+ local var=__gitcomp_builtin_"${cmd/-/_}"
+ local options
+ eval "options=\$$var"
+
+ if [ -z "$options" ]; then
+ # leading and trailing spaces are significant to make
+ # option removal work correctly.
+ options=" $incl $(__git ${cmd/_/ } --git-completion-helper) " || return
+
+ for i in $excl; do
+ options="${options/ $i / }"
+ done
+ eval "$var=\"$options\""
+ fi
+
+ __gitcomp "$options"
+}
+
# Variation of __gitcomp_nl () that appends to the existing list of
# completion candidates, COMPREPLY.
__gitcomp_nl_append ()
@@ -254,6 +435,24 @@ __gitcomp_nl ()
__gitcomp_nl_append "$@"
}
+# Fills the COMPREPLY array with prefiltered paths without any additional
+# processing.
+# Callers must take care of providing only paths that match the current path
+# to be completed and adding any prefix path components, if necessary.
+# 1: List of newline-separated matching paths, complete with all prefix
+# path components.
+__gitcomp_file_direct ()
+{
+ local IFS=$'\n'
+
+ COMPREPLY=($1)
+
+ # use a hack to enable file mode in bash < 4
+ compopt -o filenames +o nospace 2>/dev/null ||
+ compgen -f /non-existing-dir/ >/dev/null ||
+ true
+}
+
# Generates completion reply with compgen from newline-separated possible
# completion filenames.
# It accepts 1 to 3 arguments:
@@ -273,7 +472,8 @@ __gitcomp_file ()
# use a hack to enable file mode in bash < 4
compopt -o filenames +o nospace 2>/dev/null ||
- compgen -f /non-existing-dir/ > /dev/null
+ compgen -f /non-existing-dir/ >/dev/null ||
+ true
}
# Execute 'git ls-files', unless the --committable option is specified, in
@@ -283,11 +483,13 @@ __gitcomp_file ()
__git_ls_files_helper ()
{
if [ "$2" == "--committable" ]; then
- git -C "$1" diff-index --name-only --relative HEAD
+ __git -C "$1" -c core.quotePath=false diff-index \
+ --name-only --relative HEAD -- "${3//\\/\\\\}*"
else
# NOTE: $2 is not quoted in order to support multiple options
- git -C "$1" ls-files --exclude-standard $2
- fi 2>/dev/null
+ __git -C "$1" -c core.quotePath=false ls-files \
+ --exclude-standard $2 -- "${3//\\/\\\\}*"
+ fi
}
@@ -297,101 +499,283 @@ __git_ls_files_helper ()
# If provided, only files within the specified directory are listed.
# Sub directories are never recursed. Path must have a trailing
# slash.
+# 3: List only paths matching this path component (optional).
__git_index_files ()
{
- local dir="$(__gitdir)" root="${2-.}" file
+ local root="$2" match="$3"
- if [ -d "$dir" ]; then
- __git_ls_files_helper "$root" "$1" |
- while read -r file; do
- case "$file" in
- ?*/*) echo "${file%%/*}" ;;
- *) echo "$file" ;;
- esac
- done | sort | uniq
- fi
+ __git_ls_files_helper "$root" "$1" "$match" |
+ awk -F / -v pfx="${2//\\/\\\\}" '{
+ paths[$1] = 1
+ }
+ END {
+ for (p in paths) {
+ if (substr(p, 1, 1) != "\"") {
+ # No special characters, easy!
+ print pfx p
+ continue
+ }
+
+ # The path is quoted.
+ p = dequote(p)
+ if (p == "")
+ continue
+
+ # Even when a directory name itself does not contain
+ # any special characters, it will still be quoted if
+ # any of its (stripped) trailing path components do.
+ # Because of this we may have seen the same direcory
+ # both quoted and unquoted.
+ if (p in paths)
+ # We have seen the same directory unquoted,
+ # skip it.
+ continue
+ else
+ print pfx p
+ }
+ }
+ function dequote(p, bs_idx, out, esc, esc_idx, dec) {
+ # Skip opening double quote.
+ p = substr(p, 2)
+
+ # Interpret backslash escape sequences.
+ while ((bs_idx = index(p, "\\")) != 0) {
+ out = out substr(p, 1, bs_idx - 1)
+ esc = substr(p, bs_idx + 1, 1)
+ p = substr(p, bs_idx + 2)
+
+ if ((esc_idx = index("abtvfr\"\\", esc)) != 0) {
+ # C-style one-character escape sequence.
+ out = out substr("\a\b\t\v\f\r\"\\",
+ esc_idx, 1)
+ } else if (esc == "n") {
+ # Uh-oh, a newline character.
+ # We cant reliably put a pathname
+ # containing a newline into COMPREPLY,
+ # and the newline would create a mess.
+ # Skip this path.
+ return ""
+ } else {
+ # Must be a \nnn octal value, then.
+ dec = esc * 64 + \
+ substr(p, 1, 1) * 8 + \
+ substr(p, 2, 1)
+ out = out sprintf("%c", dec)
+ p = substr(p, 3)
+ }
+ }
+ # Drop closing double quote, if there is one.
+ # (There isnt any if this is a directory, as it was
+ # already stripped with the trailing path components.)
+ if (substr(p, length(p), 1) == "\"")
+ out = out substr(p, 1, length(p) - 1)
+ else
+ out = out p
+
+ return out
+ }'
}
+# __git_complete_index_file requires 1 argument:
+# 1: the options to pass to ls-file
+#
+# The exception is --committable, which finds the files appropriate commit.
+__git_complete_index_file ()
+{
+ local dequoted_word pfx="" cur_
+
+ __git_dequote "$cur"
+
+ case "$dequoted_word" in
+ ?*/*)
+ pfx="${dequoted_word%/*}/"
+ cur_="${dequoted_word##*/}"
+ ;;
+ *)
+ cur_="$dequoted_word"
+ esac
+
+ __gitcomp_file_direct "$(__git_index_files "$1" "$pfx" "$cur_")"
+}
+
+# Lists branches from the local repository.
+# 1: A prefix to be added to each listed branch (optional).
+# 2: List only branches matching this word (optional; list all branches if
+# unset or empty).
+# 3: A suffix to be appended to each listed branch (optional).
__git_heads ()
{
- local dir="$(__gitdir)"
- if [ -d "$dir" ]; then
- git --git-dir="$dir" for-each-ref --format='%(refname:short)' \
- refs/heads
- return
- fi
+ local pfx="${1-}" cur_="${2-}" sfx="${3-}"
+
+ __git for-each-ref --format="${pfx//\%/%%}%(refname:strip=2)$sfx" \
+ "refs/heads/$cur_*" "refs/heads/$cur_*/**"
}
+# Lists tags from the local repository.
+# Accepts the same positional parameters as __git_heads() above.
__git_tags ()
{
- local dir="$(__gitdir)"
- if [ -d "$dir" ]; then
- git --git-dir="$dir" for-each-ref --format='%(refname:short)' \
- refs/tags
- return
- fi
+ local pfx="${1-}" cur_="${2-}" sfx="${3-}"
+
+ __git for-each-ref --format="${pfx//\%/%%}%(refname:strip=2)$sfx" \
+ "refs/tags/$cur_*" "refs/tags/$cur_*/**"
}
-# __git_refs accepts 0, 1 (to pass to __gitdir), or 2 arguments
-# presence of 2nd argument means use the guess heuristic employed
-# by checkout for tracking branches
+# Lists refs from the local (by default) or from a remote repository.
+# It accepts 0, 1 or 2 arguments:
+# 1: The remote to list refs from (optional; ignored, if set but empty).
+# Can be the name of a configured remote, a path, or a URL.
+# 2: In addition to local refs, list unique branches from refs/remotes/ for
+# 'git checkout's tracking DWIMery (optional; ignored, if set but empty).
+# 3: A prefix to be added to each listed ref (optional).
+# 4: List only refs matching this word (optional; list all refs if unset or
+# empty).
+# 5: A suffix to be appended to each listed ref (optional; ignored, if set
+# but empty).
+#
+# Use __git_complete_refs() instead.
__git_refs ()
{
- local i hash dir="$(__gitdir "${1-}")" track="${2-}"
+ local i hash dir track="${2-}"
+ local list_refs_from=path remote="${1-}"
local format refs
- if [ -d "$dir" ]; then
- case "$cur" in
+ local pfx="${3-}" cur_="${4-$cur}" sfx="${5-}"
+ local match="${4-}"
+ local fer_pfx="${pfx//\%/%%}" # "escape" for-each-ref format specifiers
+
+ __git_find_repo_path
+ dir="$__git_repo_path"
+
+ if [ -z "$remote" ]; then
+ if [ -z "$dir" ]; then
+ return
+ fi
+ else
+ if __git_is_configured_remote "$remote"; then
+ # configured remote takes precedence over a
+ # local directory with the same name
+ list_refs_from=remote
+ elif [ -d "$remote/.git" ]; then
+ dir="$remote/.git"
+ elif [ -d "$remote" ]; then
+ dir="$remote"
+ else
+ list_refs_from=url
+ fi
+ fi
+
+ if [ "$list_refs_from" = path ]; then
+ if [[ "$cur_" == ^* ]]; then
+ pfx="$pfx^"
+ fer_pfx="$fer_pfx^"
+ cur_=${cur_#^}
+ match=${match#^}
+ fi
+ case "$cur_" in
refs|refs/*)
format="refname"
- refs="${cur%/*}"
+ refs=("$match*" "$match*/**")
track=""
;;
*)
- for i in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD; do
- if [ -e "$dir/$i" ]; then echo $i; fi
+ for i in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD REBASE_HEAD; do
+ case "$i" in
+ $match*)
+ if [ -e "$dir/$i" ]; then
+ echo "$pfx$i$sfx"
+ fi
+ ;;
+ esac
done
- format="refname:short"
- refs="refs/tags refs/heads refs/remotes"
+ format="refname:strip=2"
+ refs=("refs/tags/$match*" "refs/tags/$match*/**"
+ "refs/heads/$match*" "refs/heads/$match*/**"
+ "refs/remotes/$match*" "refs/remotes/$match*/**")
;;
esac
- git --git-dir="$dir" for-each-ref --format="%($format)" \
- $refs
+ __git_dir="$dir" __git for-each-ref --format="$fer_pfx%($format)$sfx" \
+ "${refs[@]}"
if [ -n "$track" ]; then
# employ the heuristic used by git checkout
# Try to find a remote branch that matches the completion word
# but only output if the branch name is unique
- local ref entry
- git --git-dir="$dir" for-each-ref --shell --format="ref=%(refname:short)" \
- "refs/remotes/" | \
- while read -r entry; do
- eval "$entry"
- ref="${ref#*/}"
- if [[ "$ref" == "$cur"* ]]; then
- echo "$ref"
- fi
- done | sort | uniq -u
+ __git for-each-ref --format="$fer_pfx%(refname:strip=3)$sfx" \
+ --sort="refname:strip=3" \
+ "refs/remotes/*/$match*" "refs/remotes/*/$match*/**" | \
+ uniq -u
fi
return
fi
- case "$cur" in
+ case "$cur_" in
refs|refs/*)
- git ls-remote "$dir" "$cur*" 2>/dev/null | \
+ __git ls-remote "$remote" "$match*" | \
while read -r hash i; do
case "$i" in
*^{}) ;;
- *) echo "$i" ;;
+ *) echo "$pfx$i$sfx" ;;
esac
done
;;
*)
- echo "HEAD"
- git for-each-ref --format="%(refname:short)" -- \
- "refs/remotes/$dir/" 2>/dev/null | sed -e "s#^$dir/##"
+ if [ "$list_refs_from" = remote ]; then
+ case "HEAD" in
+ $match*) echo "${pfx}HEAD$sfx" ;;
+ esac
+ __git for-each-ref --format="$fer_pfx%(refname:strip=3)$sfx" \
+ "refs/remotes/$remote/$match*" \
+ "refs/remotes/$remote/$match*/**"
+ else
+ local query_symref
+ case "HEAD" in
+ $match*) query_symref="HEAD" ;;
+ esac
+ __git ls-remote "$remote" $query_symref \
+ "refs/tags/$match*" "refs/heads/$match*" \
+ "refs/remotes/$match*" |
+ while read -r hash i; do
+ case "$i" in
+ *^{}) ;;
+ refs/*) echo "$pfx${i#refs/*/}$sfx" ;;
+ *) echo "$pfx$i$sfx" ;; # symbolic refs
+ esac
+ done
+ fi
;;
esac
}
+# Completes refs, short and long, local and remote, symbolic and pseudo.
+#
+# Usage: __git_complete_refs [<option>]...
+# --remote=<remote>: The remote to list refs from, can be the name of a
+# configured remote, a path, or a URL.
+# --track: List unique remote branches for 'git checkout's tracking DWIMery.
+# --pfx=<prefix>: A prefix to be added to each ref.
+# --cur=<word>: The current ref to be completed. Defaults to the current
+# word to be completed.
+# --sfx=<suffix>: A suffix to be appended to each ref instead of the default
+# space.
+__git_complete_refs ()
+{
+ local remote track pfx cur_="$cur" sfx=" "
+
+ while test $# != 0; do
+ case "$1" in
+ --remote=*) remote="${1##--remote=}" ;;
+ --track) track="yes" ;;
+ --pfx=*) pfx="${1##--pfx=}" ;;
+ --cur=*) cur_="${1##--cur=}" ;;
+ --sfx=*) sfx="${1##--sfx=}" ;;
+ *) return 1 ;;
+ esac
+ shift
+ done
+
+ __gitcomp_direct "$(__git_refs "$remote" "$track" "$pfx" "$cur_" "$sfx")"
+}
+
# __git_refs2 requires 1 argument (to pass to __git_refs)
+# Deprecated: use __git_complete_fetch_refspecs() instead.
__git_refs2 ()
{
local i
@@ -400,11 +784,29 @@ __git_refs2 ()
done
}
+# Completes refspecs for fetching from a remote repository.
+# 1: The remote repository.
+# 2: A prefix to be added to each listed refspec (optional).
+# 3: The ref to be completed as a refspec instead of the current word to be
+# completed (optional)
+# 4: A suffix to be appended to each listed refspec instead of the default
+# space (optional).
+__git_complete_fetch_refspecs ()
+{
+ local i remote="$1" pfx="${2-}" cur_="${3-$cur}" sfx="${4- }"
+
+ __gitcomp_direct "$(
+ for i in $(__git_refs "$remote" "" "" "$cur_") ; do
+ echo "$pfx$i:$i$sfx"
+ done
+ )"
+}
+
# __git_refs_remotes requires 1 argument (to pass to ls-remote)
__git_refs_remotes ()
{
local i hash
- git ls-remote "$1" 'refs/heads/*' 2>/dev/null | \
+ __git ls-remote "$1" 'refs/heads/*' | \
while read -r hash i; do
echo "$i:refs/remotes/$1/${i#refs/heads/}"
done
@@ -412,14 +814,26 @@ __git_refs_remotes ()
__git_remotes ()
{
- local d="$(__gitdir)"
- test -d "$d/remotes" && ls -1 "$d/remotes"
- git --git-dir="$d" remote
+ __git_find_repo_path
+ test -d "$__git_repo_path/remotes" && ls -1 "$__git_repo_path/remotes"
+ __git remote
+}
+
+# Returns true if $1 matches the name of a configured remote, false otherwise.
+__git_is_configured_remote ()
+{
+ local remote
+ for remote in $(__git_remotes); do
+ if [ "$remote" = "$1" ]; then
+ return 0
+ fi
+ done
+ return 1
}
__git_list_merge_strategies ()
{
- git merge -s help 2>&1 |
+ LANG=C LC_ALL=C git merge -s help 2>&1 |
sed -n -e '/[Aa]vailable strategies are: /,/^$/{
s/\.$//
s/.*://
@@ -441,9 +855,14 @@ __git_compute_merge_strategies ()
__git_merge_strategies=$(__git_list_merge_strategies)
}
+__git_merge_strategy_options="ours theirs subtree subtree= patience
+ histogram diff-algorithm= ignore-space-change ignore-all-space
+ ignore-space-at-eol renormalize no-renormalize no-renames
+ find-renames find-renames= rename-threshold="
+
__git_complete_revlist_file ()
{
- local pfx ls ref cur_="$cur"
+ local dequoted_word pfx ls ref cur_="$cur"
case "$cur_" in
*..?*:*)
return
@@ -451,14 +870,18 @@ __git_complete_revlist_file ()
?*:*)
ref="${cur_%%:*}"
cur_="${cur_#*:}"
- case "$cur_" in
+
+ __git_dequote "$cur_"
+
+ case "$dequoted_word" in
?*/*)
- pfx="${cur_%/*}"
- cur_="${cur_##*/}"
+ pfx="${dequoted_word%/*}"
+ cur_="${dequoted_word##*/}"
ls="$ref:$pfx"
pfx="$pfx/"
;;
*)
+ cur_="$dequoted_word"
ls="$ref"
;;
esac
@@ -468,56 +891,25 @@ __git_complete_revlist_file ()
*) pfx="$ref:$pfx" ;;
esac
- __gitcomp_nl "$(git --git-dir="$(__gitdir)" ls-tree "$ls" 2>/dev/null \
- | sed '/^100... blob /{
- s,^.* ,,
- s,$, ,
- }
- /^120000 blob /{
- s,^.* ,,
- s,$, ,
- }
- /^040000 tree /{
- s,^.* ,,
- s,$,/,
- }
- s/^.* //')" \
- "$pfx" "$cur_" ""
+ __gitcomp_file "$(__git ls-tree "$ls" \
+ | sed 's/^.* //
+ s/$//')" \
+ "$pfx" "$cur_"
;;
*...*)
pfx="${cur_%...*}..."
cur_="${cur_#*...}"
- __gitcomp_nl "$(__git_refs)" "$pfx" "$cur_"
+ __git_complete_refs --pfx="$pfx" --cur="$cur_"
;;
*..*)
pfx="${cur_%..*}.."
cur_="${cur_#*..}"
- __gitcomp_nl "$(__git_refs)" "$pfx" "$cur_"
+ __git_complete_refs --pfx="$pfx" --cur="$cur_"
;;
*)
- __gitcomp_nl "$(__git_refs)"
- ;;
- esac
-}
-
-
-# __git_complete_index_file requires 1 argument:
-# 1: the options to pass to ls-file
-#
-# The exception is --committable, which finds the files appropriate commit.
-__git_complete_index_file ()
-{
- local pfx="" cur_="$cur"
-
- case "$cur_" in
- ?*/*)
- pfx="${cur_%/*}"
- cur_="${cur_##*/}"
- pfx="${pfx}/"
+ __git_complete_refs
;;
esac
-
- __gitcomp_file "$(__git_index_files "$1" ${pfx:+"$pfx"})" "$pfx" "$cur_"
}
__git_complete_file ()
@@ -541,6 +933,7 @@ __git_complete_remote_or_refspec ()
i="${words[c]}"
case "$i" in
--mirror) [ "$cmd" = "push" ] && no_complete_refspec=1 ;;
+ -d|--delete) [ "$cmd" = "push" ] && lhs=0 ;;
--all)
case "$cmd" in
push) no_complete_refspec=1 ;;
@@ -550,6 +943,7 @@ __git_complete_remote_or_refspec ()
*) ;;
esac
;;
+ --multiple) no_complete_refspec=1; break ;;
-*) ;;
*) remote="$i"; break ;;
esac
@@ -580,23 +974,23 @@ __git_complete_remote_or_refspec ()
case "$cmd" in
fetch)
if [ $lhs = 1 ]; then
- __gitcomp_nl "$(__git_refs2 "$remote")" "$pfx" "$cur_"
+ __git_complete_fetch_refspecs "$remote" "$pfx" "$cur_"
else
- __gitcomp_nl "$(__git_refs)" "$pfx" "$cur_"
+ __git_complete_refs --pfx="$pfx" --cur="$cur_"
fi
;;
pull|remote)
if [ $lhs = 1 ]; then
- __gitcomp_nl "$(__git_refs "$remote")" "$pfx" "$cur_"
+ __git_complete_refs --remote="$remote" --pfx="$pfx" --cur="$cur_"
else
- __gitcomp_nl "$(__git_refs)" "$pfx" "$cur_"
+ __git_complete_refs --pfx="$pfx" --cur="$cur_"
fi
;;
push)
if [ $lhs = 1 ]; then
- __gitcomp_nl "$(__git_refs)" "$pfx" "$cur_"
+ __git_complete_refs --pfx="$pfx" --cur="$cur_"
else
- __gitcomp_nl "$(__git_refs "$remote")" "$pfx" "$cur_"
+ __git_complete_refs --remote="$remote" --pfx="$pfx" --cur="$cur_"
fi
;;
esac
@@ -609,136 +1003,30 @@ __git_complete_strategy ()
-s|--strategy)
__gitcomp "$__git_merge_strategies"
return 0
+ ;;
+ -X)
+ __gitcomp "$__git_merge_strategy_options"
+ return 0
+ ;;
esac
case "$cur" in
--strategy=*)
__gitcomp "$__git_merge_strategies" "" "${cur##--strategy=}"
return 0
;;
+ --strategy-option=*)
+ __gitcomp "$__git_merge_strategy_options" "" "${cur##--strategy-option=}"
+ return 0
+ ;;
esac
return 1
}
-__git_commands () {
- if test -n "${GIT_TESTING_COMMAND_COMPLETION:-}"
- then
- printf "%s" "${GIT_TESTING_COMMAND_COMPLETION}"
- else
- git help -a|egrep '^ [a-zA-Z0-9]'
- fi
-}
-
-__git_list_all_commands ()
-{
- local i IFS=" "$'\n'
- for i in $(__git_commands)
- do
- case $i in
- *--*) : helper pattern;;
- *) echo $i;;
- esac
- done
-}
-
__git_all_commands=
__git_compute_all_commands ()
{
test -n "$__git_all_commands" ||
- __git_all_commands=$(__git_list_all_commands)
-}
-
-__git_list_porcelain_commands ()
-{
- local i IFS=" "$'\n'
- __git_compute_all_commands
- for i in $__git_all_commands
- do
- case $i in
- *--*) : helper pattern;;
- applymbox) : ask gittus;;
- applypatch) : ask gittus;;
- archimport) : import;;
- cat-file) : plumbing;;
- check-attr) : plumbing;;
- check-ignore) : plumbing;;
- check-mailmap) : plumbing;;
- check-ref-format) : plumbing;;
- checkout-index) : plumbing;;
- column) : internal helper;;
- commit-tree) : plumbing;;
- count-objects) : infrequent;;
- credential) : credentials;;
- credential-*) : credentials helper;;
- cvsexportcommit) : export;;
- cvsimport) : import;;
- cvsserver) : daemon;;
- daemon) : daemon;;
- diff-files) : plumbing;;
- diff-index) : plumbing;;
- diff-tree) : plumbing;;
- fast-import) : import;;
- fast-export) : export;;
- fsck-objects) : plumbing;;
- fetch-pack) : plumbing;;
- fmt-merge-msg) : plumbing;;
- for-each-ref) : plumbing;;
- hash-object) : plumbing;;
- http-*) : transport;;
- index-pack) : plumbing;;
- init-db) : deprecated;;
- local-fetch) : plumbing;;
- ls-files) : plumbing;;
- ls-remote) : plumbing;;
- ls-tree) : plumbing;;
- mailinfo) : plumbing;;
- mailsplit) : plumbing;;
- merge-*) : plumbing;;
- mktree) : plumbing;;
- mktag) : plumbing;;
- pack-objects) : plumbing;;
- pack-redundant) : plumbing;;
- pack-refs) : plumbing;;
- parse-remote) : plumbing;;
- patch-id) : plumbing;;
- prune) : plumbing;;
- prune-packed) : plumbing;;
- quiltimport) : import;;
- read-tree) : plumbing;;
- receive-pack) : plumbing;;
- remote-*) : transport;;
- rerere) : plumbing;;
- rev-list) : plumbing;;
- rev-parse) : plumbing;;
- runstatus) : plumbing;;
- sh-setup) : internal;;
- shell) : daemon;;
- show-ref) : plumbing;;
- send-pack) : plumbing;;
- show-index) : plumbing;;
- ssh-*) : transport;;
- stripspace) : plumbing;;
- symbolic-ref) : plumbing;;
- unpack-file) : plumbing;;
- unpack-objects) : plumbing;;
- update-index) : plumbing;;
- update-ref) : plumbing;;
- update-server-info) : daemon;;
- upload-archive) : plumbing;;
- upload-pack) : plumbing;;
- write-tree) : plumbing;;
- var) : infrequent;;
- verify-pack) : infrequent;;
- verify-tag) : plumbing;;
- *) echo $i;;
- esac
- done
-}
-
-__git_porcelain_commands=
-__git_compute_porcelain_commands ()
-{
- test -n "$__git_porcelain_commands" ||
- __git_porcelain_commands=$(__git_list_porcelain_commands)
+ __git_all_commands=$(__git --list-cmds=main,others,alias,nohelpers)
}
# Lists all set config variables starting with the given section prefix,
@@ -746,7 +1034,7 @@ __git_compute_porcelain_commands ()
__git_get_config_variables ()
{
local section="$1" i IFS=$'\n'
- for i in $(git --git-dir="$(__gitdir)" config --name-only --get-regexp "^$section\..*" 2>/dev/null); do
+ for i in $(__git config --name-only --get-regexp "^$section\..*"); do
echo "${i#$section.}"
done
}
@@ -756,16 +1044,10 @@ __git_pretty_aliases ()
__git_get_config_variables "pretty"
}
-__git_aliases ()
-{
- __git_get_config_variables "alias"
-}
-
# __git_aliased_command requires 1 argument
__git_aliased_command ()
{
- local word cmdline=$(git --git-dir="$(__gitdir)" \
- config --get "alias.$1")
+ local word cmdline=$(__git config --get "alias.$1")
for word in $cmdline; do
case "$word" in
\!gitk|gitk)
@@ -803,6 +1085,50 @@ __git_find_on_cmdline ()
done
}
+# Echo the value of an option set on the command line or config
+#
+# $1: short option name
+# $2: long option name including =
+# $3: list of possible values
+# $4: config string (optional)
+#
+# example:
+# result="$(__git_get_option_value "-d" "--do-something=" \
+# "yes no" "core.doSomething")"
+#
+# result is then either empty (no option set) or "yes" or "no"
+#
+# __git_get_option_value requires 3 arguments
+__git_get_option_value ()
+{
+ local c short_opt long_opt val
+ local result= values config_key word
+
+ short_opt="$1"
+ long_opt="$2"
+ values="$3"
+ config_key="$4"
+
+ ((c = $cword - 1))
+ while [ $c -ge 0 ]; do
+ word="${words[c]}"
+ for val in $values; do
+ if [ "$short_opt$val" = "$word" ] ||
+ [ "$long_opt$val" = "$word" ]; then
+ result="$val"
+ break 2
+ fi
+ done
+ ((c--))
+ done
+
+ if [ -n "$config_key" ] && [ -z "$result" ]; then
+ result="$(__git config "$config_key")"
+ fi
+
+ echo "$result"
+}
+
__git_has_doubledash ()
{
local c=1
@@ -853,12 +1179,14 @@ __git_count_arguments ()
}
__git_whitespacelist="nowarn warn error error-all fix"
+__git_patchformat="mbox stgit stgit-series hg mboxrd"
+__git_am_inprogress_options="--skip --continue --resolved --abort --quit --show-current-patch"
_git_am ()
{
- local dir="$(__gitdir)"
- if [ -d "$dir"/rebase-apply ]; then
- __gitcomp "--skip --continue --resolved --abort"
+ __git_find_repo_path
+ if [ -d "$__git_repo_path"/rebase-apply ]; then
+ __gitcomp "$__git_am_inprogress_options"
return
fi
case "$cur" in
@@ -866,13 +1194,13 @@ _git_am ()
__gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}"
return
;;
+ --patch-format=*)
+ __gitcomp "$__git_patchformat" "" "${cur##--patch-format=}"
+ return
+ ;;
--*)
- __gitcomp "
- --3way --committer-date-is-author-date --ignore-date
- --ignore-whitespace --ignore-space-change
- --interactive --keep --no-utf8 --signoff --utf8
- --whitespace= --scissors
- "
+ __gitcomp_builtin am "" \
+ "$__git_am_inprogress_options"
return
esac
}
@@ -885,13 +1213,7 @@ _git_apply ()
return
;;
--*)
- __gitcomp "
- --stat --numstat --summary --check --index
- --cached --index-info --reverse --reject --unidiff-zero
- --apply --no-add --exclude=
- --ignore-whitespace --ignore-space-change
- --whitespace= --inaccurate-eof --verbose
- "
+ __gitcomp_builtin apply
return
esac
}
@@ -899,16 +1221,21 @@ _git_apply ()
_git_add ()
{
case "$cur" in
+ --chmod=*)
+ __gitcomp "+x -x" "" "${cur##--chmod=}"
+ return
+ ;;
--*)
- __gitcomp "
- --interactive --refresh --patch --update --dry-run
- --ignore-errors --intent-to-add
- "
+ __gitcomp_builtin add
return
esac
- # XXX should we check for --update and --all options ?
- __git_complete_index_file "--others --modified --directory --no-empty-directory"
+ local complete_opt="--others --modified --directory --no-empty-directory"
+ if test -n "$(__git_find_on_cmdline "-u --update")"
+ then
+ complete_opt="--modified"
+ fi
+ __git_complete_index_file "$complete_opt"
}
_git_archive ()
@@ -925,7 +1252,7 @@ _git_archive ()
--*)
__gitcomp "
--format= --list --verbose
- --prefix= --remote= --exec=
+ --prefix= --remote= --exec= --output
"
return
;;
@@ -940,7 +1267,8 @@ _git_bisect ()
local subcommands="start bad good skip reset visualize replay log run"
local subcommand="$(__git_find_on_cmdline "$subcommands")"
if [ -z "$subcommand" ]; then
- if [ -f "$(__gitdir)"/BISECT_START ]; then
+ __git_find_repo_path
+ if [ -f "$__git_repo_path"/BISECT_START ]; then
__gitcomp "$subcommands"
else
__gitcomp "replay start"
@@ -950,13 +1278,15 @@ _git_bisect ()
case "$subcommand" in
bad|good|reset|skip|start)
- __gitcomp_nl "$(__git_refs)"
+ __git_complete_refs
;;
*)
;;
esac
}
+__git_ref_fieldlist="refname objecttype objectsize objectname upstream push HEAD symref"
+
_git_branch ()
{
local i c=1 only_local_ref="n" has_r="n"
@@ -964,29 +1294,24 @@ _git_branch ()
while [ $c -lt $cword ]; do
i="${words[c]}"
case "$i" in
- -d|-m) only_local_ref="y" ;;
- -r) has_r="y" ;;
+ -d|--delete|-m|--move) only_local_ref="y" ;;
+ -r|--remotes) has_r="y" ;;
esac
((c++))
done
case "$cur" in
--set-upstream-to=*)
- __gitcomp_nl "$(__git_refs)" "" "${cur##--set-upstream-to=}"
+ __git_complete_refs --cur="${cur##--set-upstream-to=}"
;;
--*)
- __gitcomp "
- --color --no-color --verbose --abbrev= --no-abbrev
- --track --no-track --contains --merged --no-merged
- --set-upstream-to= --edit-description --list
- --unset-upstream
- "
+ __gitcomp_builtin branch
;;
*)
if [ $only_local_ref = "y" -a $has_r = "n" ]; then
- __gitcomp_nl "$(__git_heads)"
+ __gitcomp_direct "$(__git_heads "" "$cur" " ")"
else
- __gitcomp_nl "$(__git_refs)"
+ __git_complete_refs
fi
;;
esac
@@ -1021,41 +1346,40 @@ _git_checkout ()
__gitcomp "diff3 merge" "" "${cur##--conflict=}"
;;
--*)
- __gitcomp "
- --quiet --ours --theirs --track --no-track --merge
- --conflict= --orphan --patch
- "
+ __gitcomp_builtin checkout
;;
*)
# check if --track, --no-track, or --no-guess was specified
# if so, disable DWIM mode
- local flags="--track --no-track --no-guess" track=1
- if [ -n "$(__git_find_on_cmdline "$flags")" ]; then
- track=''
+ local flags="--track --no-track --no-guess" track_opt="--track"
+ if [ "$GIT_COMPLETION_CHECKOUT_NO_GUESS" = "1" ] ||
+ [ -n "$(__git_find_on_cmdline "$flags")" ]; then
+ track_opt=''
fi
- __gitcomp_nl "$(__git_refs '' $track)"
+ __git_complete_refs $track_opt
;;
esac
}
-_git_cherry ()
-{
- __gitcomp_nl "$(__git_refs)"
-}
+__git_cherry_pick_inprogress_options="--continue --quit --abort"
_git_cherry_pick ()
{
- local dir="$(__gitdir)"
- if [ -f "$dir"/CHERRY_PICK_HEAD ]; then
- __gitcomp "--continue --quit --abort"
+ __git_find_repo_path
+ if [ -f "$__git_repo_path"/CHERRY_PICK_HEAD ]; then
+ __gitcomp "$__git_cherry_pick_inprogress_options"
return
fi
+
+ __git_complete_strategy && return
+
case "$cur" in
--*)
- __gitcomp "--edit --no-commit --signoff --strategy= --mainline"
+ __gitcomp_builtin cherry-pick "" \
+ "$__git_cherry_pick_inprogress_options"
;;
*)
- __gitcomp_nl "$(__git_refs)"
+ __git_complete_refs
;;
esac
}
@@ -1064,7 +1388,7 @@ _git_clean ()
{
case "$cur" in
--*)
- __gitcomp "--dry-run --quiet"
+ __gitcomp_builtin clean
return
;;
esac
@@ -1077,32 +1401,19 @@ _git_clone ()
{
case "$cur" in
--*)
- __gitcomp "
- --local
- --no-hardlinks
- --shared
- --reference
- --quiet
- --no-checkout
- --bare
- --mirror
- --origin
- --upload-pack
- --template=
- --depth
- --single-branch
- --branch
- "
+ __gitcomp_builtin clone
return
;;
esac
}
+__git_untracked_file_modes="all no normal"
+
_git_commit ()
{
case "$prev" in
-c|-C)
- __gitcomp_nl "$(__git_refs)" "" "${cur}"
+ __git_complete_refs
return
;;
esac
@@ -1115,27 +1426,19 @@ _git_commit ()
;;
--reuse-message=*|--reedit-message=*|\
--fixup=*|--squash=*)
- __gitcomp_nl "$(__git_refs)" "" "${cur#*=}"
+ __git_complete_refs --cur="${cur#*=}"
return
;;
--untracked-files=*)
- __gitcomp "all no normal" "" "${cur##--untracked-files=}"
+ __gitcomp "$__git_untracked_file_modes" "" "${cur##--untracked-files=}"
return
;;
--*)
- __gitcomp "
- --all --author= --signoff --verify --no-verify
- --edit --no-edit
- --amend --include --only --interactive
- --dry-run --reuse-message= --reedit-message=
- --reset-author --file= --message= --template=
- --cleanup= --untracked-files --untracked-files=
- --verbose --quiet --fixup= --squash=
- "
+ __gitcomp_builtin commit
return
esac
- if git rev-parse --verify --quiet HEAD >/dev/null; then
+ if __git rev-parse --verify --quiet HEAD >/dev/null; then
__git_complete_index_file "--committable"
else
# This is the first commit
@@ -1147,22 +1450,21 @@ _git_describe ()
{
case "$cur" in
--*)
- __gitcomp "
- --all --tags --contains --abbrev= --candidates=
- --exact-match --debug --long --match --always
- "
+ __gitcomp_builtin describe
return
esac
- __gitcomp_nl "$(__git_refs)"
+ __git_complete_refs
}
__git_diff_algorithms="myers minimal patience histogram"
+__git_diff_submodule_formats="diff log short"
+
__git_diff_common_options="--stat --numstat --shortstat --summary
--patch-with-stat --name-only --name-status --color
--no-color --color-words --no-renames --check
--full-index --binary --abbrev --diff-filter=
- --find-copies-harder
+ --find-copies-harder --ignore-cr-at-eol
--text --ignore-space-at-eol --ignore-space-change
--ignore-all-space --ignore-blank-lines --exit-code
--quiet --ext-diff --no-ext-diff
@@ -1173,6 +1475,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary
--dirstat --dirstat= --dirstat-by-file
--dirstat-by-file= --cumulative
--diff-algorithm=
+ --submodule --submodule= --ignore-submodules
"
_git_diff ()
@@ -1184,6 +1487,10 @@ _git_diff ()
__gitcomp "$__git_diff_algorithms" "" "${cur##--diff-algorithm=}"
return
;;
+ --submodule=*)
+ __gitcomp "$__git_diff_submodule_formats" "" "${cur##--submodule=}"
+ return
+ ;;
--*)
__gitcomp "--cached --staged --pickaxe-all --pickaxe-regex
--base --ours --theirs --no-index
@@ -1196,7 +1503,8 @@ _git_diff ()
}
__git_mergetools_common="diffuse diffmerge ecmerge emerge kdiff3 meld opendiff
- tkdiff vimdiff gvimdiff xxdiff araxis p4merge bc codecompare
+ tkdiff vimdiff gvimdiff xxdiff araxis p4merge bc
+ codecompare smerge
"
_git_difftool ()
@@ -1209,11 +1517,11 @@ _git_difftool ()
return
;;
--*)
- __gitcomp "--cached --staged --pickaxe-all --pickaxe-regex
- --base --ours --theirs
- --no-renames --diff-filter= --find-copies-harder
- --relative --ignore-submodules
- --tool="
+ __gitcomp_builtin difftool "$__git_diff_common_options
+ --base --cached --ours --theirs
+ --pickaxe-all --pickaxe-regex
+ --relative --staged
+ "
return
;;
esac
@@ -1222,11 +1530,6 @@ _git_difftool ()
__git_fetch_recurse_submodules="yes on-demand no"
-__git_fetch_options="
- --quiet --verbose --append --upload-pack --force --keep --depth=
- --tags --no-tags --all --prune --dry-run --recurse-submodules=
-"
-
_git_fetch ()
{
case "$cur" in
@@ -1234,21 +1537,21 @@ _git_fetch ()
__gitcomp "$__git_fetch_recurse_submodules" "" "${cur##--recurse-submodules=}"
return
;;
+ --filter=*)
+ __gitcomp "blob:none blob:limit= sparse:oid=" "" "${cur##--filter=}"
+ return
+ ;;
--*)
- __gitcomp "$__git_fetch_options"
+ __gitcomp_builtin fetch
return
;;
esac
__git_complete_remote_or_refspec
}
-__git_format_patch_options="
- --stdout --attach --no-attach --thread --thread= --no-thread
- --numbered --start-number --numbered-files --keep-subject --signoff
- --signature --no-signature --in-reply-to= --cc= --full-index --binary
- --not --all --cover-letter --no-prefix --src-prefix= --dst-prefix=
- --inline --suffix= --ignore-if-in-upstream --subject-prefix=
- --output-directory --reroll-count --to= --quiet --notes
+__git_format_patch_extra_options="
+ --full-index --not --all --no-prefix --src-prefix=
+ --dst-prefix= --notes
"
_git_format_patch ()
@@ -1261,7 +1564,7 @@ _git_format_patch ()
return
;;
--*)
- __gitcomp "$__git_format_patch_options"
+ __gitcomp_builtin format-patch "$__git_format_patch_extra_options"
return
;;
esac
@@ -1272,20 +1575,7 @@ _git_fsck ()
{
case "$cur" in
--*)
- __gitcomp "
- --tags --root --unreachable --cache --no-reflogs --full
- --strict --verbose --lost-found
- "
- return
- ;;
- esac
-}
-
-_git_gc ()
-{
- case "$cur" in
- --*)
- __gitcomp "--prune --aggressive"
+ __gitcomp_builtin fsck
return
;;
esac
@@ -1296,8 +1586,43 @@ _git_gitk ()
_gitk
}
-__git_match_ctag() {
- awk "/^${1//\//\\/}/ { print \$1 }" "$2"
+# Lists matching symbol names from a tag (as in ctags) file.
+# 1: List symbol names matching this word.
+# 2: The tag file to list symbol names from.
+# 3: A prefix to be added to each listed symbol name (optional).
+# 4: A suffix to be appended to each listed symbol name (optional).
+__git_match_ctag () {
+ awk -v pfx="${3-}" -v sfx="${4-}" "
+ /^${1//\//\\/}/ { print pfx \$1 sfx }
+ " "$2"
+}
+
+# Complete symbol names from a tag file.
+# Usage: __git_complete_symbol [<option>]...
+# --tags=<file>: The tag file to list symbol names from instead of the
+# default "tags".
+# --pfx=<prefix>: A prefix to be added to each symbol name.
+# --cur=<word>: The current symbol name to be completed. Defaults to
+# the current word to be completed.
+# --sfx=<suffix>: A suffix to be appended to each symbol name instead
+# of the default space.
+__git_complete_symbol () {
+ local tags=tags pfx="" cur_="${cur-}" sfx=" "
+
+ while test $# != 0; do
+ case "$1" in
+ --tags=*) tags="${1##--tags=}" ;;
+ --pfx=*) pfx="${1##--pfx=}" ;;
+ --cur=*) cur_="${1##--cur=}" ;;
+ --sfx=*) sfx="${1##--sfx=}" ;;
+ *) return 1 ;;
+ esac
+ shift
+ done
+
+ if test -r "$tags"; then
+ __gitcomp_direct "$(__git_match_ctag "$cur_" "$tags" "$pfx" "$sfx")"
+ fi
}
_git_grep ()
@@ -1306,50 +1631,34 @@ _git_grep ()
case "$cur" in
--*)
- __gitcomp "
- --cached
- --text --ignore-case --word-regexp --invert-match
- --full-name --line-number
- --extended-regexp --basic-regexp --fixed-strings
- --perl-regexp
- --threads
- --files-with-matches --name-only
- --files-without-match
- --max-depth
- --count
- --and --or --not --all-match
- "
+ __gitcomp_builtin grep
return
;;
esac
case "$cword,$prev" in
2,*|*,-*)
- if test -r tags; then
- __gitcomp_nl "$(__git_match_ctag "$cur" tags)"
- return
- fi
+ __git_complete_symbol && return
;;
esac
- __gitcomp_nl "$(__git_refs)"
+ __git_complete_refs
}
_git_help ()
{
case "$cur" in
--*)
- __gitcomp "--all --info --man --web"
+ __gitcomp_builtin help
return
;;
esac
- __git_compute_all_commands
- __gitcomp "$__git_all_commands $(__git_aliases)
- attributes cli core-tutorial cvs-migration
- diffcore gitk glossary hooks ignore modules
- namespaces repository-layout tutorial tutorial-2
- workflows
- "
+ if test -n "$GIT_TESTING_ALL_COMMAND_LIST"
+ then
+ __gitcomp "$GIT_TESTING_ALL_COMMAND_LIST $(__git --list-cmds=alias,list-guide) gitk"
+ else
+ __gitcomp "$(__git --list-cmds=main,nohelpers,alias,list-guide) gitk"
+ fi
}
_git_init ()
@@ -1362,7 +1671,7 @@ _git_init ()
return
;;
--*)
- __gitcomp "--quiet --bare --template= --shared --shared="
+ __gitcomp_builtin init
return
;;
esac
@@ -1372,13 +1681,7 @@ _git_ls_files ()
{
case "$cur" in
--*)
- __gitcomp "--cached --deleted --modified --others --ignored
- --stage --directory --no-empty-directory --unmerged
- --killed --exclude= --exclude-from=
- --exclude-per-directory= --exclude-standard
- --error-unmatch --with-tree= --full-name
- --abbrev --ignored --exclude-per-directory
- "
+ __gitcomp_builtin ls-files
return
;;
esac
@@ -1390,11 +1693,24 @@ _git_ls_files ()
_git_ls_remote ()
{
+ case "$cur" in
+ --*)
+ __gitcomp_builtin ls-remote
+ return
+ ;;
+ esac
__gitcomp_nl "$(__git_remotes)"
}
_git_ls_tree ()
{
+ case "$cur" in
+ --*)
+ __gitcomp_builtin ls-tree
+ return
+ ;;
+ esac
+
__git_complete_file
}
@@ -1421,18 +1737,31 @@ __git_log_shortlog_options="
--all-match --invert-grep
"
-__git_log_pretty_formats="oneline short medium full fuller email raw format:"
-__git_log_date_formats="relative iso8601 rfc2822 short local default raw"
+__git_log_pretty_formats="oneline short medium full fuller email raw format: mboxrd"
+__git_log_date_formats="relative iso8601 iso8601-strict rfc2822 short local default raw unix format:"
_git_log ()
{
__git_has_doubledash && return
+ __git_find_repo_path
- local g="$(git rev-parse --git-dir 2>/dev/null)"
local merge=""
- if [ -f "$g/MERGE_HEAD" ]; then
+ if [ -f "$__git_repo_path/MERGE_HEAD" ]; then
merge="--merge"
fi
+ case "$prev,$cur" in
+ -L,:*:*)
+ return # fall back to Bash filename completion
+ ;;
+ -L,:*)
+ __git_complete_symbol --cur="${cur#:}" --sfx=":"
+ return
+ ;;
+ -G,*|-S,*)
+ __git_complete_symbol
+ return
+ ;;
+ esac
case "$cur" in
--pretty=*|--format=*)
__gitcomp "$__git_log_pretty_formats $(__git_pretty_aliases)
@@ -1447,6 +1776,14 @@ _git_log ()
__gitcomp "full short no" "" "${cur##--decorate=}"
return
;;
+ --diff-algorithm=*)
+ __gitcomp "$__git_diff_algorithms" "" "${cur##--diff-algorithm=}"
+ return
+ ;;
+ --submodule=*)
+ __gitcomp "$__git_diff_submodule_formats" "" "${cur##--submodule=}"
+ return
+ ;;
--*)
__gitcomp "
$__git_log_common_options
@@ -1458,6 +1795,7 @@ _git_log ()
--relative-date --date=
--pretty= --format= --oneline
--show-signature
+ --cherry-mark
--cherry-pick
--graph
--decorate --decorate=
@@ -1469,29 +1807,35 @@ _git_log ()
"
return
;;
+ -L:*:*)
+ return # fall back to Bash filename completion
+ ;;
+ -L:*)
+ __git_complete_symbol --cur="${cur#-L:}" --sfx=":"
+ return
+ ;;
+ -G*)
+ __git_complete_symbol --pfx="-G" --cur="${cur#-G}"
+ return
+ ;;
+ -S*)
+ __git_complete_symbol --pfx="-S" --cur="${cur#-S}"
+ return
+ ;;
esac
__git_complete_revlist
}
-# Common merge options shared by git-merge(1) and git-pull(1).
-__git_merge_options="
- --no-commit --no-stat --log --no-log --squash --strategy
- --commit --stat --no-squash --ff --no-ff --ff-only --edit --no-edit
- --verify-signatures --no-verify-signatures --gpg-sign
- --quiet --verbose --progress --no-progress
-"
-
_git_merge ()
{
__git_complete_strategy && return
case "$cur" in
--*)
- __gitcomp "$__git_merge_options
- --rerere-autoupdate --no-rerere-autoupdate --abort"
+ __gitcomp_builtin merge
return
esac
- __gitcomp_nl "$(__git_refs)"
+ __git_complete_refs
}
_git_mergetool ()
@@ -1502,7 +1846,7 @@ _git_mergetool ()
return
;;
--*)
- __gitcomp "--tool="
+ __gitcomp "--tool= --prompt --no-prompt --gui --no-gui"
return
;;
esac
@@ -1512,18 +1856,18 @@ _git_merge_base ()
{
case "$cur" in
--*)
- __gitcomp "--octopus --independent --is-ancestor --fork-point"
+ __gitcomp_builtin merge-base
return
;;
esac
- __gitcomp_nl "$(__git_refs)"
+ __git_complete_refs
}
_git_mv ()
{
case "$cur" in
--*)
- __gitcomp "--dry-run"
+ __gitcomp_builtin mv
return
;;
esac
@@ -1537,52 +1881,40 @@ _git_mv ()
fi
}
-_git_name_rev ()
-{
- __gitcomp "--tags --all --stdin"
-}
-
_git_notes ()
{
- local subcommands='add append copy edit list prune remove show'
+ local subcommands='add append copy edit get-ref list merge prune remove show'
local subcommand="$(__git_find_on_cmdline "$subcommands")"
case "$subcommand,$cur" in
,--*)
- __gitcomp '--ref'
+ __gitcomp_builtin notes
;;
,*)
case "$prev" in
--ref)
- __gitcomp_nl "$(__git_refs)"
+ __git_complete_refs
;;
*)
__gitcomp "$subcommands --ref"
;;
esac
;;
- add,--reuse-message=*|append,--reuse-message=*|\
- add,--reedit-message=*|append,--reedit-message=*)
- __gitcomp_nl "$(__git_refs)" "" "${cur#*=}"
- ;;
- add,--*|append,--*)
- __gitcomp '--file= --message= --reedit-message=
- --reuse-message='
+ *,--reuse-message=*|*,--reedit-message=*)
+ __git_complete_refs --cur="${cur#*=}"
;;
- copy,--*)
- __gitcomp '--stdin'
+ *,--*)
+ __gitcomp_builtin notes_$subcommand
;;
- prune,--*)
- __gitcomp '--dry-run --verbose'
- ;;
- prune,*)
+ prune,*|get-ref,*)
+ # this command does not take a ref, do not complete it
;;
*)
case "$prev" in
-m|-F)
;;
*)
- __gitcomp_nl "$(__git_refs)"
+ __git_complete_refs
;;
esac
;;
@@ -1599,18 +1931,15 @@ _git_pull ()
return
;;
--*)
- __gitcomp "
- --rebase --no-rebase
- $__git_merge_options
- $__git_fetch_options
- "
+ __gitcomp_builtin pull
+
return
;;
esac
__git_complete_remote_or_refspec
}
-__git_push_recurse_submodules="check on-demand"
+__git_push_recurse_submodules="check on-demand only"
__git_complete_force_with_lease ()
{
@@ -1620,10 +1949,10 @@ __git_complete_force_with_lease ()
--*=)
;;
*:*)
- __gitcomp_nl "$(__git_refs)" "" "${cur_#*:}"
+ __git_complete_refs --cur="${cur_#*:}"
;;
*)
- __gitcomp_nl "$(__git_refs)" "" "$cur_"
+ __git_complete_refs --cur="$cur_"
;;
esac
}
@@ -1654,26 +1983,36 @@ _git_push ()
return
;;
--*)
+ __gitcomp_builtin push
+ return
+ ;;
+ esac
+ __git_complete_remote_or_refspec
+}
+
+_git_range_diff ()
+{
+ case "$cur" in
+ --*)
__gitcomp "
- --all --mirror --tags --dry-run --force --verbose
- --quiet --prune --delete --follow-tags
- --receive-pack= --repo= --set-upstream
- --force-with-lease --force-with-lease= --recurse-submodules=
+ --creation-factor= --no-dual-color
+ $__git_diff_common_options
"
return
;;
esac
- __git_complete_remote_or_refspec
+ __git_complete_revlist
}
_git_rebase ()
{
- local dir="$(__gitdir)"
- if [ -f "$dir"/rebase-merge/interactive ]; then
- __gitcomp "--continue --skip --abort --edit-todo"
+ __git_find_repo_path
+ if [ -f "$__git_repo_path"/rebase-merge/interactive ]; then
+ __gitcomp "--continue --skip --abort --quit --edit-todo --show-current-patch"
return
- elif [ -d "$dir"/rebase-apply ] || [ -d "$dir"/rebase-merge ]; then
- __gitcomp "--continue --skip --abort"
+ elif [ -d "$__git_repo_path"/rebase-apply ] || \
+ [ -d "$__git_repo_path"/rebase-merge ]; then
+ __gitcomp "--continue --skip --abort --quit --show-current-patch"
return
fi
__git_complete_strategy && return
@@ -1685,7 +2024,7 @@ _git_rebase ()
--*)
__gitcomp "
--onto --merge --strategy --interactive
- --preserve-merges --stat --no-stat
+ --rebase-merges --preserve-merges --stat --no-stat
--committer-date-is-author-date --ignore-date
--ignore-whitespace --whitespace=
--autosquash --no-autosquash
@@ -1693,12 +2032,13 @@ _git_rebase ()
--autostash --no-autostash
--verify --no-verify
--keep-empty --root --force-rebase --no-ff
+ --rerere-autoupdate
--exec
"
return
esac
- __gitcomp_nl "$(__git_refs)"
+ __git_complete_refs
}
_git_reflog ()
@@ -1709,7 +2049,7 @@ _git_reflog ()
if [ -z "$subcommand" ]; then
__gitcomp "$subcommands"
else
- __gitcomp_nl "$(__git_refs)"
+ __git_complete_refs
fi
}
@@ -1720,9 +2060,7 @@ _git_send_email ()
{
case "$prev" in
--to|--cc|--bcc|--from)
- __gitcomp "
- $(git --git-dir="$(__gitdir)" send-email --dump-aliases 2>/dev/null)
- "
+ __gitcomp "$(__git send-email --dump-aliases)"
return
;;
esac
@@ -1752,22 +2090,20 @@ _git_send_email ()
return
;;
--to=*|--cc=*|--bcc=*|--from=*)
- __gitcomp "
- $(git --git-dir="$(__gitdir)" send-email --dump-aliases 2>/dev/null)
- " "" "${cur#--*=}"
+ __gitcomp "$(__git send-email --dump-aliases)" "" "${cur#--*=}"
return
;;
--*)
- __gitcomp "--annotate --bcc --cc --cc-cmd --chain-reply-to
+ __gitcomp_builtin send-email "--annotate --bcc --cc --cc-cmd --chain-reply-to
--compose --confirm= --dry-run --envelope-sender
--from --identity
--in-reply-to --no-chain-reply-to --no-signed-off-by-cc
- --no-suppress-from --no-thread --quiet
+ --no-suppress-from --no-thread --quiet --reply-to
--signed-off-by-cc --smtp-pass --smtp-server
--smtp-server-port --smtp-encryption= --smtp-user
--subject --suppress-cc= --suppress-from --thread --to
--validate --no-validate
- $__git_format_patch_options"
+ $__git_format_patch_extra_options"
return
;;
esac
@@ -1779,6 +2115,90 @@ _git_stage ()
_git_add
}
+_git_status ()
+{
+ local complete_opt
+ local untracked_state
+
+ case "$cur" in
+ --ignore-submodules=*)
+ __gitcomp "none untracked dirty all" "" "${cur##--ignore-submodules=}"
+ return
+ ;;
+ --untracked-files=*)
+ __gitcomp "$__git_untracked_file_modes" "" "${cur##--untracked-files=}"
+ return
+ ;;
+ --column=*)
+ __gitcomp "
+ always never auto column row plain dense nodense
+ " "" "${cur##--column=}"
+ return
+ ;;
+ --*)
+ __gitcomp_builtin status
+ return
+ ;;
+ esac
+
+ untracked_state="$(__git_get_option_value "-u" "--untracked-files=" \
+ "$__git_untracked_file_modes" "status.showUntrackedFiles")"
+
+ case "$untracked_state" in
+ no)
+ # --ignored option does not matter
+ complete_opt=
+ ;;
+ all|normal|*)
+ complete_opt="--cached --directory --no-empty-directory --others"
+
+ if [ -n "$(__git_find_on_cmdline "--ignored")" ]; then
+ complete_opt="$complete_opt --ignored --exclude=*"
+ fi
+ ;;
+ esac
+
+ __git_complete_index_file "$complete_opt"
+}
+
+_git_switch ()
+{
+ case "$cur" in
+ --conflict=*)
+ __gitcomp "diff3 merge" "" "${cur##--conflict=}"
+ ;;
+ --*)
+ __gitcomp_builtin switch
+ ;;
+ *)
+ # check if --track, --no-track, or --no-guess was specified
+ # if so, disable DWIM mode
+ local track_opt="--track" only_local_ref=n
+ if [ "$GIT_COMPLETION_CHECKOUT_NO_GUESS" = "1" ] ||
+ [ -n "$(__git_find_on_cmdline "--track --no-track --no-guess")" ]; then
+ track_opt=''
+ fi
+ # explicit --guess enables DWIM mode regardless of
+ # $GIT_COMPLETION_CHECKOUT_NO_GUESS
+ if [ -n "$(__git_find_on_cmdline "--guess")" ]; then
+ track_opt='--track'
+ fi
+ if [ -z "$(__git_find_on_cmdline "-d --detach")" ]; then
+ only_local_ref=y
+ else
+ # --guess --detach is invalid combination, no
+ # dwim will be done when --detach is specified
+ track_opt=
+ fi
+ if [ $only_local_ref = y -a -z "$track_opt" ]; then
+ __gitcomp_direct "$(__git_heads "" "$cur" " ")"
+ else
+ __git_complete_refs $track_opt
+ fi
+ ;;
+ esac
+}
+
__git_config_get_set_variables ()
{
local prevword word config_file= c=$cword
@@ -1798,22 +2218,37 @@ __git_config_get_set_variables ()
c=$((--c))
done
- git --git-dir="$(__gitdir)" config $config_file --name-only --list 2>/dev/null
+ __git config $config_file --name-only --list
+}
+
+__git_config_vars=
+__git_compute_config_vars ()
+{
+ test -n "$__git_config_vars" ||
+ __git_config_vars="$(git help --config-for-completion | sort | uniq)"
}
_git_config ()
{
- case "$prev" in
+ local varname
+
+ if [ "${BASH_VERSINFO[0]:-0}" -ge 4 ]; then
+ varname="${prev,,}"
+ else
+ varname="$(echo "$prev" |tr A-Z a-z)"
+ fi
+
+ case "$varname" in
branch.*.remote|branch.*.pushremote)
__gitcomp_nl "$(__git_remotes)"
return
;;
branch.*.merge)
- __gitcomp_nl "$(__git_refs)"
+ __git_complete_refs
return
;;
branch.*.rebase)
- __gitcomp "false true preserve interactive"
+ __gitcomp "false true merges preserve interactive"
return
;;
remote.pushdefault)
@@ -1833,9 +2268,8 @@ _git_config ()
remote.*.push)
local remote="${prev#remote.}"
remote="${remote%.push}"
- __gitcomp_nl "$(git --git-dir="$(__gitdir)" \
- for-each-ref --format='%(refname):%(refname)' \
- refs/heads)"
+ __gitcomp_nl "$(__git for-each-ref \
+ --format='%(refname):%(refname)' refs/heads)"
return
;;
pull.twohead|pull.octopus)
@@ -1860,7 +2294,7 @@ _git_config ()
return
;;
diff.submodule)
- __gitcomp "log short"
+ __gitcomp "$__git_diff_submodule_formats"
return
;;
help.format)
@@ -1871,7 +2305,7 @@ _git_config ()
__gitcomp "$__git_log_date_formats"
return
;;
- sendemail.aliasesfiletype)
+ sendemail.aliasfiletype)
__gitcomp "mutt mailrc pine elm gnus"
return
;;
@@ -1897,32 +2331,25 @@ _git_config ()
esac
case "$cur" in
--*)
- __gitcomp "
- --system --global --local --file=
- --list --replace-all
- --get --get-all --get-regexp
- --add --unset --unset-all
- --remove-section --rename-section
- --name-only
- "
+ __gitcomp_builtin config
return
;;
branch.*.*)
local pfx="${cur%.*}." cur_="${cur##*.}"
- __gitcomp "remote pushremote merge mergeoptions rebase" "$pfx" "$cur_"
+ __gitcomp "remote pushRemote merge mergeOptions rebase" "$pfx" "$cur_"
return
;;
branch.*)
local pfx="${cur%.*}." cur_="${cur#*.}"
- __gitcomp_nl "$(__git_heads)" "$pfx" "$cur_" "."
- __gitcomp_nl_append $'autosetupmerge\nautosetuprebase\n' "$pfx" "$cur_"
+ __gitcomp_direct "$(__git_heads "$pfx" "$cur_" ".")"
+ __gitcomp_nl_append $'autoSetupMerge\nautoSetupRebase\n' "$pfx" "$cur_"
return
;;
guitool.*.*)
local pfx="${cur%.*}." cur_="${cur##*.}"
__gitcomp "
- argprompt cmd confirm needsfile noconsole norescan
- prompt revprompt revunmerged title
+ argPrompt cmd confirm needsFile noConsole noRescan
+ prompt revPrompt revUnmerged title
" "$pfx" "$cur_"
return
;;
@@ -1951,14 +2378,14 @@ _git_config ()
local pfx="${cur%.*}." cur_="${cur##*.}"
__gitcomp "
url proxy fetch push mirror skipDefaultUpdate
- receivepack uploadpack tagopt pushurl
+ receivepack uploadpack tagOpt pushurl
" "$pfx" "$cur_"
return
;;
remote.*)
local pfx="${cur%.*}." cur_="${cur#*.}"
__gitcomp_nl "$(__git_remotes)" "$pfx" "$cur_" "."
- __gitcomp_nl_append "pushdefault" "$pfx" "$cur_"
+ __gitcomp_nl_append "pushDefault" "$pfx" "$cur_"
return
;;
url.*.*)
@@ -1966,324 +2393,95 @@ _git_config ()
__gitcomp "insteadOf pushInsteadOf" "$pfx" "$cur_"
return
;;
+ *.*)
+ __git_compute_config_vars
+ __gitcomp "$__git_config_vars"
+ ;;
+ *)
+ __git_compute_config_vars
+ __gitcomp "$(echo "$__git_config_vars" | sed 's/\.[^ ]*/./g')"
esac
- __gitcomp "
- add.ignoreErrors
- advice.commitBeforeMerge
- advice.detachedHead
- advice.implicitIdentity
- advice.pushNonFastForward
- advice.resolveConflict
- advice.statusHints
- alias.
- am.keepcr
- apply.ignorewhitespace
- apply.whitespace
- branch.autosetupmerge
- branch.autosetuprebase
- browser.
- clean.requireForce
- color.branch
- color.branch.current
- color.branch.local
- color.branch.plain
- color.branch.remote
- color.decorate.HEAD
- color.decorate.branch
- color.decorate.remoteBranch
- color.decorate.stash
- color.decorate.tag
- color.diff
- color.diff.commit
- color.diff.frag
- color.diff.func
- color.diff.meta
- color.diff.new
- color.diff.old
- color.diff.plain
- color.diff.whitespace
- color.grep
- color.grep.context
- color.grep.filename
- color.grep.function
- color.grep.linenumber
- color.grep.match
- color.grep.selected
- color.grep.separator
- color.interactive
- color.interactive.error
- color.interactive.header
- color.interactive.help
- color.interactive.prompt
- color.pager
- color.showbranch
- color.status
- color.status.added
- color.status.changed
- color.status.header
- color.status.nobranch
- color.status.unmerged
- color.status.untracked
- color.status.updated
- color.ui
- commit.status
- commit.template
- core.abbrev
- core.askpass
- core.attributesfile
- core.autocrlf
- core.bare
- core.bigFileThreshold
- core.compression
- core.createObject
- core.deltaBaseCacheLimit
- core.editor
- core.eol
- core.excludesfile
- core.fileMode
- core.fsyncobjectfiles
- core.gitProxy
- core.ignoreStat
- core.ignorecase
- core.logAllRefUpdates
- core.loosecompression
- core.notesRef
- core.packedGitLimit
- core.packedGitWindowSize
- core.pager
- core.preferSymlinkRefs
- core.preloadindex
- core.quotepath
- core.repositoryFormatVersion
- core.safecrlf
- core.sharedRepository
- core.sparseCheckout
- core.symlinks
- core.trustctime
- core.untrackedCache
- core.warnAmbiguousRefs
- core.whitespace
- core.worktree
- diff.autorefreshindex
- diff.external
- diff.ignoreSubmodules
- diff.mnemonicprefix
- diff.noprefix
- diff.renameLimit
- diff.renames
- diff.statGraphWidth
- diff.submodule
- diff.suppressBlankEmpty
- diff.tool
- diff.wordRegex
- diff.algorithm
- difftool.
- difftool.prompt
- fetch.recurseSubmodules
- fetch.unpackLimit
- format.attach
- format.cc
- format.coverLetter
- format.headers
- format.numbered
- format.pretty
- format.signature
- format.signoff
- format.subjectprefix
- format.suffix
- format.thread
- format.to
- gc.
- gc.aggressiveWindow
- gc.auto
- gc.autopacklimit
- gc.packrefs
- gc.pruneexpire
- gc.reflogexpire
- gc.reflogexpireunreachable
- gc.rerereresolved
- gc.rerereunresolved
- gitcvs.allbinary
- gitcvs.commitmsgannotation
- gitcvs.dbTableNamePrefix
- gitcvs.dbdriver
- gitcvs.dbname
- gitcvs.dbpass
- gitcvs.dbuser
- gitcvs.enabled
- gitcvs.logfile
- gitcvs.usecrlfattr
- guitool.
- gui.blamehistoryctx
- gui.commitmsgwidth
- gui.copyblamethreshold
- gui.diffcontext
- gui.encoding
- gui.fastcopyblame
- gui.matchtrackingbranch
- gui.newbranchtemplate
- gui.pruneduringfetch
- gui.spellingdictionary
- gui.trustmtime
- help.autocorrect
- help.browser
- help.format
- http.lowSpeedLimit
- http.lowSpeedTime
- http.maxRequests
- http.minSessions
- http.noEPSV
- http.postBuffer
- http.proxy
- http.sslCipherList
- http.sslVersion
- http.sslCAInfo
- http.sslCAPath
- http.sslCert
- http.sslCertPasswordProtected
- http.sslKey
- http.sslVerify
- http.useragent
- i18n.commitEncoding
- i18n.logOutputEncoding
- imap.authMethod
- imap.folder
- imap.host
- imap.pass
- imap.port
- imap.preformattedHTML
- imap.sslverify
- imap.tunnel
- imap.user
- init.templatedir
- instaweb.browser
- instaweb.httpd
- instaweb.local
- instaweb.modulepath
- instaweb.port
- interactive.singlekey
- log.date
- log.decorate
- log.showroot
- mailmap.file
- man.
- man.viewer
- merge.
- merge.conflictstyle
- merge.log
- merge.renameLimit
- merge.renormalize
- merge.stat
- merge.tool
- merge.verbosity
- mergetool.
- mergetool.keepBackup
- mergetool.keepTemporaries
- mergetool.prompt
- notes.displayRef
- notes.rewrite.
- notes.rewrite.amend
- notes.rewrite.rebase
- notes.rewriteMode
- notes.rewriteRef
- pack.compression
- pack.deltaCacheLimit
- pack.deltaCacheSize
- pack.depth
- pack.indexVersion
- pack.packSizeLimit
- pack.threads
- pack.window
- pack.windowMemory
- pager.
- pretty.
- pull.octopus
- pull.twohead
- push.default
- push.followTags
- rebase.autosquash
- rebase.stat
- receive.autogc
- receive.denyCurrentBranch
- receive.denyDeleteCurrent
- receive.denyDeletes
- receive.denyNonFastForwards
- receive.fsckObjects
- receive.unpackLimit
- receive.updateserverinfo
- remote.pushdefault
- remotes.
- repack.usedeltabaseoffset
- rerere.autoupdate
- rerere.enabled
- sendemail.
- sendemail.aliasesfile
- sendemail.aliasfiletype
- sendemail.bcc
- sendemail.cc
- sendemail.cccmd
- sendemail.chainreplyto
- sendemail.confirm
- sendemail.envelopesender
- sendemail.from
- sendemail.identity
- sendemail.multiedit
- sendemail.signedoffbycc
- sendemail.smtpdomain
- sendemail.smtpencryption
- sendemail.smtppass
- sendemail.smtpserver
- sendemail.smtpserveroption
- sendemail.smtpserverport
- sendemail.smtpuser
- sendemail.suppresscc
- sendemail.suppressfrom
- sendemail.thread
- sendemail.to
- sendemail.validate
- showbranch.default
- status.relativePaths
- status.showUntrackedFiles
- status.submodulesummary
- submodule.
- tar.umask
- transfer.unpackLimit
- url.
- user.email
- user.name
- user.signingkey
- web.browser
- branch. remote.
- "
}
_git_remote ()
{
- local subcommands="add rename remove set-head set-branches set-url show prune update"
+ local subcommands="
+ add rename remove set-head set-branches
+ get-url set-url show prune update
+ "
local subcommand="$(__git_find_on_cmdline "$subcommands")"
if [ -z "$subcommand" ]; then
- __gitcomp "$subcommands"
+ case "$cur" in
+ --*)
+ __gitcomp_builtin remote
+ ;;
+ *)
+ __gitcomp "$subcommands"
+ ;;
+ esac
return
fi
- case "$subcommand" in
- rename|remove|set-url|show|prune)
- __gitcomp_nl "$(__git_remotes)"
+ case "$subcommand,$cur" in
+ add,--*)
+ __gitcomp_builtin remote_add
+ ;;
+ add,*)
+ ;;
+ set-head,--*)
+ __gitcomp_builtin remote_set-head
;;
- set-head|set-branches)
+ set-branches,--*)
+ __gitcomp_builtin remote_set-branches
+ ;;
+ set-head,*|set-branches,*)
__git_complete_remote_or_refspec
;;
- update)
- __gitcomp "$(__git_get_config_variables "remotes")"
+ update,--*)
+ __gitcomp_builtin remote_update
+ ;;
+ update,*)
+ __gitcomp "$(__git_remotes) $(__git_get_config_variables "remotes")"
+ ;;
+ set-url,--*)
+ __gitcomp_builtin remote_set-url
+ ;;
+ get-url,--*)
+ __gitcomp_builtin remote_get-url
+ ;;
+ prune,--*)
+ __gitcomp_builtin remote_prune
;;
*)
+ __gitcomp_nl "$(__git_remotes)"
;;
esac
}
_git_replace ()
{
- __gitcomp_nl "$(__git_refs)"
+ case "$cur" in
+ --format=*)
+ __gitcomp "short medium long" "" "${cur##--format=}"
+ return
+ ;;
+ --*)
+ __gitcomp_builtin replace
+ return
+ ;;
+ esac
+ __git_complete_refs
+}
+
+_git_rerere ()
+{
+ local subcommands="clear forget diff remaining status gc"
+ local subcommand="$(__git_find_on_cmdline "$subcommands")"
+ if test -z "$subcommand"
+ then
+ __gitcomp "$subcommands"
+ return
+ fi
}
_git_reset ()
@@ -2292,34 +2490,53 @@ _git_reset ()
case "$cur" in
--*)
- __gitcomp "--merge --mixed --hard --soft --patch"
+ __gitcomp_builtin reset
return
;;
esac
- __gitcomp_nl "$(__git_refs)"
+ __git_complete_refs
}
+_git_restore ()
+{
+ case "$cur" in
+ --conflict=*)
+ __gitcomp "diff3 merge" "" "${cur##--conflict=}"
+ ;;
+ --source=*)
+ __git_complete_refs --cur="${cur##--source=}"
+ ;;
+ --*)
+ __gitcomp_builtin restore
+ ;;
+ esac
+}
+
+__git_revert_inprogress_options="--continue --quit --abort"
+
_git_revert ()
{
- local dir="$(__gitdir)"
- if [ -f "$dir"/REVERT_HEAD ]; then
- __gitcomp "--continue --quit --abort"
+ __git_find_repo_path
+ if [ -f "$__git_repo_path"/REVERT_HEAD ]; then
+ __gitcomp "$__git_revert_inprogress_options"
return
fi
+ __git_complete_strategy && return
case "$cur" in
--*)
- __gitcomp "--edit --mainline --no-edit --no-commit --signoff"
+ __gitcomp_builtin revert "" \
+ "$__git_revert_inprogress_options"
return
;;
esac
- __gitcomp_nl "$(__git_refs)"
+ __git_complete_refs
}
_git_rm ()
{
case "$cur" in
--*)
- __gitcomp "--cached --dry-run --ignore-unmatch --quiet"
+ __gitcomp_builtin rm
return
;;
esac
@@ -2336,7 +2553,7 @@ _git_shortlog ()
__gitcomp "
$__git_log_common_options
$__git_log_shortlog_options
- --numbered --summary
+ --numbered --summary --email
"
return
;;
@@ -2358,6 +2575,10 @@ _git_show ()
__gitcomp "$__git_diff_algorithms" "" "${cur##--diff-algorithm=}"
return
;;
+ --submodule=*)
+ __gitcomp "$__git_diff_submodule_formats" "" "${cur##--submodule=}"
+ return
+ ;;
--*)
__gitcomp "--pretty= --format= --abbrev-commit --oneline
--show-signature
@@ -2373,12 +2594,7 @@ _git_show_branch ()
{
case "$cur" in
--*)
- __gitcomp "
- --all --remotes --topo-order --date-order --current --more=
- --list --independent --merge-base --no-name
- --color --no-color
- --sha1-name --sparse --topics --reflog
- "
+ __gitcomp_builtin show-branch
return
;;
esac
@@ -2388,13 +2604,21 @@ _git_show_branch ()
_git_stash ()
{
local save_opts='--all --keep-index --no-keep-index --quiet --patch --include-untracked'
- local subcommands='save list show apply clear drop pop create branch'
- local subcommand="$(__git_find_on_cmdline "$subcommands")"
+ local subcommands='push list show apply clear drop pop create branch'
+ local subcommand="$(__git_find_on_cmdline "$subcommands save")"
+ if [ -n "$(__git_find_on_cmdline "-p")" ]; then
+ subcommand="push"
+ fi
if [ -z "$subcommand" ]; then
case "$cur" in
--*)
__gitcomp "$save_opts"
;;
+ sa*)
+ if [ -z "$(__git_find_on_cmdline "$save_opts")" ]; then
+ __gitcomp "save"
+ fi
+ ;;
*)
if [ -z "$(__git_find_on_cmdline "$save_opts")" ]; then
__gitcomp "$subcommands"
@@ -2403,6 +2627,9 @@ _git_stash ()
esac
else
case "$subcommand,$cur" in
+ push,--*)
+ __gitcomp "$save_opts --message"
+ ;;
save,--*)
__gitcomp "$save_opts"
;;
@@ -2412,18 +2639,21 @@ _git_stash ()
drop,--*)
__gitcomp "--quiet"
;;
+ list,--*)
+ __gitcomp "--name-status --oneline --patch-with-stat"
+ ;;
show,--*|branch,--*)
;;
branch,*)
if [ $cword -eq 3 ]; then
- __gitcomp_nl "$(__git_refs)";
+ __git_complete_refs
else
- __gitcomp_nl "$(git --git-dir="$(__gitdir)" stash list \
+ __gitcomp_nl "$(__git stash list \
| sed -n -e 's/:.*//p')"
fi
;;
show,*|apply,*|drop,*|pop,*)
- __gitcomp_nl "$(git --git-dir="$(__gitdir)" stash list \
+ __gitcomp_nl "$(__git stash list \
| sed -n -e 's/:.*//p')"
;;
*)
@@ -2436,11 +2666,12 @@ _git_submodule ()
{
__git_has_doubledash && return
- local subcommands="add status init deinit update summary foreach sync"
- if [ -z "$(__git_find_on_cmdline "$subcommands")" ]; then
+ local subcommands="add status init deinit update set-branch summary foreach sync absorbgitdirs"
+ local subcommand="$(__git_find_on_cmdline "$subcommands")"
+ if [ -z "$subcommand" ]; then
case "$cur" in
--*)
- __gitcomp "--quiet --cached"
+ __gitcomp "--quiet"
;;
*)
__gitcomp "$subcommands"
@@ -2448,6 +2679,36 @@ _git_submodule ()
esac
return
fi
+
+ case "$subcommand,$cur" in
+ add,--*)
+ __gitcomp "--branch --force --name --reference --depth"
+ ;;
+ status,--*)
+ __gitcomp "--cached --recursive"
+ ;;
+ deinit,--*)
+ __gitcomp "--force --all"
+ ;;
+ update,--*)
+ __gitcomp "
+ --init --remote --no-fetch
+ --recommend-shallow --no-recommend-shallow
+ --force --rebase --merge --reference --depth --recursive --jobs
+ "
+ ;;
+ set-branch,--*)
+ __gitcomp "--default --branch"
+ ;;
+ summary,--*)
+ __gitcomp "--cached --files --summary-limit"
+ ;;
+ foreach,--*|sync,--*)
+ __gitcomp "--recursive"
+ ;;
+ *)
+ ;;
+ esac
}
_git_svn ()
@@ -2468,14 +2729,14 @@ _git_svn ()
--no-metadata --use-svm-props --use-svnsync-props
--log-window-size= --no-checkout --quiet
--repack-flags --use-log-author --localtime
+ --add-author-from
--ignore-paths= --include-paths= $remote_opts
"
local init_opts="
--template= --shared= --trunk= --tags=
--branches= --stdlayout --minimize-url
--no-metadata --use-svm-props --use-svnsync-props
- --rewrite-root= --prefix= --use-log-author
- --add-author-from $remote_opts
+ --rewrite-root= --prefix= $remote_opts
"
local cmt_opts="
--edit --rmdir --find-copies-harder --copy-similarity=
@@ -2554,8 +2815,8 @@ _git_tag ()
while [ $c -lt $cword ]; do
i="${words[c]}"
case "$i" in
- -d|-v)
- __gitcomp_nl "$(__git_tags)"
+ -d|--delete|-v|--verify)
+ __gitcomp_direct "$(__git_tags "" "$cur" " ")"
return
;;
-f)
@@ -2570,21 +2831,17 @@ _git_tag ()
;;
-*|tag)
if [ $f = 1 ]; then
- __gitcomp_nl "$(__git_tags)"
+ __gitcomp_direct "$(__git_tags "" "$cur" " ")"
fi
;;
*)
- __gitcomp_nl "$(__git_refs)"
+ __git_complete_refs
;;
esac
case "$cur" in
--*)
- __gitcomp "
- --list --delete --verify --annotate --message --file
- --sign --cleanup --local-user --force --column --sort
- --contains --points-at
- "
+ __gitcomp_builtin tag
;;
esac
}
@@ -2594,9 +2851,85 @@ _git_whatchanged ()
_git_log
}
+_git_worktree ()
+{
+ local subcommands="add list lock move prune remove unlock"
+ local subcommand="$(__git_find_on_cmdline "$subcommands")"
+ if [ -z "$subcommand" ]; then
+ __gitcomp "$subcommands"
+ else
+ case "$subcommand,$cur" in
+ add,--*)
+ __gitcomp_builtin worktree_add
+ ;;
+ list,--*)
+ __gitcomp_builtin worktree_list
+ ;;
+ lock,--*)
+ __gitcomp_builtin worktree_lock
+ ;;
+ prune,--*)
+ __gitcomp_builtin worktree_prune
+ ;;
+ remove,--*)
+ __gitcomp "--force"
+ ;;
+ *)
+ ;;
+ esac
+ fi
+}
+
+__git_complete_common () {
+ local command="$1"
+
+ case "$cur" in
+ --*)
+ __gitcomp_builtin "$command"
+ ;;
+ esac
+}
+
+__git_cmds_with_parseopt_helper=
+__git_support_parseopt_helper () {
+ test -n "$__git_cmds_with_parseopt_helper" ||
+ __git_cmds_with_parseopt_helper="$(__git --list-cmds=parseopt)"
+
+ case " $__git_cmds_with_parseopt_helper " in
+ *" $1 "*)
+ return 0
+ ;;
+ *)
+ return 1
+ ;;
+ esac
+}
+
+__git_complete_command () {
+ local command="$1"
+ local completion_func="_git_${command//-/_}"
+ if ! declare -f $completion_func >/dev/null 2>/dev/null &&
+ declare -f _completion_loader >/dev/null 2>/dev/null
+ then
+ _completion_loader "git-$command"
+ fi
+ if declare -f $completion_func >/dev/null 2>/dev/null
+ then
+ $completion_func
+ return 0
+ elif __git_support_parseopt_helper "$command"
+ then
+ __git_complete_common "$command"
+ return 0
+ else
+ return 1
+ fi
+}
+
__git_main ()
{
- local i c=1 command __git_dir
+ local i c=1 command __git_dir __git_repo_path
+ local __git_C_args C_args_count=0
while [ $c -lt $cword ]; do
i="${words[c]}"
@@ -2606,6 +2939,10 @@ __git_main ()
--bare) __git_dir="." ;;
--help) command="help"; break ;;
-c|--work-tree|--namespace) ((c++)) ;;
+ -C) __git_C_args[C_args_count++]=-C
+ ((c++))
+ __git_C_args[C_args_count++]="${words[c]}"
+ ;;
-*) ;;
*) command="$i"; break ;;
esac
@@ -2613,6 +2950,17 @@ __git_main ()
done
if [ -z "$command" ]; then
+ case "$prev" in
+ --git-dir|-C|--work-tree)
+ # these need a path argument, let's fall back to
+ # Bash filename completion
+ return
+ ;;
+ -c|--namespace)
+ # we don't support completing these options' arguments
+ return
+ ;;
+ esac
case "$cur" in
--*) __gitcomp "
--paginate
@@ -2631,20 +2979,24 @@ __git_main ()
--help
"
;;
- *) __git_compute_porcelain_commands
- __gitcomp "$__git_porcelain_commands $(__git_aliases)" ;;
+ *)
+ if test -n "$GIT_TESTING_PORCELAIN_COMMAND_LIST"
+ then
+ __gitcomp "$GIT_TESTING_PORCELAIN_COMMAND_LIST"
+ else
+ __gitcomp "$(__git --list-cmds=list-mainporcelain,others,nohelpers,alias,list-complete,config)"
+ fi
+ ;;
esac
return
fi
- local completion_func="_git_${command//-/_}"
- declare -f $completion_func >/dev/null && $completion_func && return
+ __git_complete_command "$command" && return
local expansion=$(__git_aliased_command "$command")
if [ -n "$expansion" ]; then
words[1]=$expansion
- completion_func="_git_${expansion//-/_}"
- declare -f $completion_func >/dev/null && $completion_func
+ __git_complete_command "$expansion"
fi
}
@@ -2652,9 +3004,11 @@ __gitk_main ()
{
__git_has_doubledash && return
- local g="$(__gitdir)"
+ local __git_repo_path
+ __git_find_repo_path
+
local merge=""
- if [ -f "$g/MERGE_HEAD" ]; then
+ if [ -f "$__git_repo_path/MERGE_HEAD" ]; then
merge="--merge"
fi
case "$cur" in
@@ -2670,7 +3024,10 @@ __gitk_main ()
__git_complete_revlist
}
-if [[ -n ${ZSH_VERSION-} ]]; then
+if [[ -n ${ZSH_VERSION-} ]] &&
+ # Don't define these functions when sourced from 'git-completion.zsh',
+ # it has its own implementations.
+ [[ -z ${GIT_SOURCING_ZSH_COMPLETION-} ]]; then
echo "WARNING: this script is deprecated, please see git-completion.zsh" 1>&2
autoload -U +X compinit && compinit
@@ -2701,6 +3058,15 @@ if [[ -n ${ZSH_VERSION-} ]]; then
esac
}
+ __gitcomp_direct ()
+ {
+ emulate -L zsh
+
+ local IFS=$'\n'
+ compset -P '*[=:]'
+ compadd -Q -- ${=1} && _ret=0
+ }
+
__gitcomp_nl ()
{
emulate -L zsh
@@ -2710,13 +3076,22 @@ if [[ -n ${ZSH_VERSION-} ]]; then
compadd -Q -S "${4- }" -p "${2-}" -- ${=1} && _ret=0
}
+ __gitcomp_file_direct ()
+ {
+ emulate -L zsh
+
+ local IFS=$'\n'
+ compset -P '*[=:]'
+ compadd -f -- ${=1} && _ret=0
+ }
+
__gitcomp_file ()
{
emulate -L zsh
local IFS=$'\n'
compset -P '*[=:]'
- compadd -Q -p "${2-}" -f -- ${=1} && _ret=0
+ compadd -p "${2-}" -f -- ${=1} && _ret=0
}
_git ()
@@ -2771,6 +3146,6 @@ __git_complete gitk __gitk_main
# when the user has tab-completed the executable name and consequently
# included the '.exe' suffix.
#
-if [[ "$OSTYPE" = cygwin* ]]; then
+if [ Cygwin = "$(uname -o 2>/dev/null)" ]; then
__git_complete git.exe __git_main
fi
diff --git a/plugins/gitfast/git-prompt.sh b/plugins/gitfast/git-prompt.sh
index 0da14eee9..f7009b063 100644
--- a/plugins/gitfast/git-prompt.sh
+++ b/plugins/gitfast/git-prompt.sh
@@ -82,6 +82,7 @@
# contains relative to newer annotated tag (v1.6.3.2~35)
# branch relative to newer tag or branch (master~4)
# describe relative to older annotated tag (v1.6.3.1-13-gdd42c2f)
+# tag relative to any older tag (v1.6.3.1-13-gdd42c2f)
# default exactly matching tag
#
# If you would like a colored hint about the current dirty state, set
@@ -218,7 +219,7 @@ __git_ps1_show_upstream ()
if [[ -n "$count" && -n "$name" ]]; then
__git_ps1_upstream_name=$(git rev-parse \
--abbrev-ref "$upstream" 2>/dev/null)
- if [ $pcmode = yes ] && [ $ps1_expanded = yes ]; then
+ if [ "$pcmode" = yes ] && [ "$ps1_expanded" = yes ]; then
p="$p \${__git_ps1_upstream_name}"
else
p="$p ${__git_ps1_upstream_name}"
@@ -236,7 +237,7 @@ __git_ps1_show_upstream ()
# to build a gitstring.
__git_ps1_colorize_gitstring ()
{
- if [[ -n ${ZSH_VERSION-} ]]; then
+ if [[ -n "${ZSH_VERSION-}" ]]; then
local c_red='%F{red}'
local c_green='%F{green}'
local c_lblue='%F{blue}'
@@ -254,7 +255,7 @@ __git_ps1_colorize_gitstring ()
local flags_color="$c_lblue"
local branch_color=""
- if [ $detached = no ]; then
+ if [ "$detached" = no ]; then
branch_color="$ok_color"
else
branch_color="$bad_color"
@@ -277,11 +278,12 @@ __git_ps1_colorize_gitstring ()
r="$c_clear$r"
}
+# Helper function to read the first line of a file into a variable.
+# __git_eread requires 2 arguments, the file path and the name of the
+# variable, in that order.
__git_eread ()
{
- local f="$1"
- shift
- test -r "$f" && read "$@" <"$f"
+ test -r "$1" && IFS=$'\r\n' read "$2" <"$1"
}
# __git_ps1 accepts 0 or 1 arguments (i.e., format string)
@@ -355,8 +357,8 @@ __git_ps1 ()
# incorrect.)
#
local ps1_expanded=yes
- [ -z "$ZSH_VERSION" ] || [[ -o PROMPT_SUBST ]] || ps1_expanded=no
- [ -z "$BASH_VERSION" ] || shopt -q promptvars || ps1_expanded=no
+ [ -z "${ZSH_VERSION-}" ] || [[ -o PROMPT_SUBST ]] || ps1_expanded=no
+ [ -z "${BASH_VERSION-}" ] || shopt -q promptvars || ps1_expanded=no
local repo_info rev_parse_exit_code
repo_info="$(git rev-parse --git-dir --is-inside-git-dir \
@@ -368,7 +370,7 @@ __git_ps1 ()
return $exit
fi
- local short_sha
+ local short_sha=""
if [ "$rev_parse_exit_code" = "0" ]; then
short_sha="${repo_info##*$'\n'}"
repo_info="${repo_info%$'\n'*}"
@@ -443,6 +445,8 @@ __git_ps1 ()
git describe --contains HEAD ;;
(branch)
git describe --contains --all HEAD ;;
+ (tag)
+ git describe --tags HEAD ;;
(describe)
git describe HEAD ;;
(* | default)
@@ -504,13 +508,13 @@ __git_ps1 ()
# NO color option unless in PROMPT_COMMAND mode or it's Zsh
if [ -n "${GIT_PS1_SHOWCOLORHINTS-}" ]; then
- if [ $pcmode = yes ] || [ -n "${ZSH_VERSION-}" ]; then
+ if [ "$pcmode" = yes ] || [ -n "${ZSH_VERSION-}" ]; then
__git_ps1_colorize_gitstring
fi
fi
b=${b##refs/heads/}
- if [ $pcmode = yes ] && [ $ps1_expanded = yes ]; then
+ if [ "$pcmode" = yes ] && [ "$ps1_expanded" = yes ]; then
__git_ps1_branch_name=$b
b="\${__git_ps1_branch_name}"
fi
@@ -518,7 +522,7 @@ __git_ps1 ()
local f="$w$i$s$u"
local gitstring="$c$b${f:+$z$f}$r$p"
- if [ $pcmode = yes ]; then
+ if [ "$pcmode" = yes ]; then
if [ "${__git_printf_supports_v-}" != yes ]; then
gitstring=$(printf -- "$printf_format" "$gitstring")
else
diff --git a/plugins/gitfast/gitfast.plugin.zsh b/plugins/gitfast/gitfast.plugin.zsh
index dba1b1315..7b6b67e92 100644
--- a/plugins/gitfast/gitfast.plugin.zsh
+++ b/plugins/gitfast/gitfast.plugin.zsh
@@ -1,6 +1,4 @@
-dir=$(dirname $0)
-source $dir/../git/git.plugin.zsh
-source $dir/git-prompt.sh
+source "${0:A:h}/git-prompt.sh"
function git_prompt_info() {
dirty="$(parse_git_dirty)"
diff --git a/plugins/gitfast/update b/plugins/gitfast/update
new file mode 100755
index 000000000..05054245f
--- /dev/null
+++ b/plugins/gitfast/update
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+url="https://git.kernel.org/pub/scm/git/git.git/plain/contrib/completion"
+version="2.16.0"
+
+curl -s -o _git "${url}/git-completion.zsh?h=v${version}" &&
+curl -s -o git-completion.bash "${url}/git-completion.bash?h=v${version}" &&
+curl -s -o git-prompt.sh "${url}/git-prompt.sh?h=v${version}" &&
+git apply updates.patch
diff --git a/plugins/gitfast/updates.patch b/plugins/gitfast/updates.patch
new file mode 100644
index 000000000..28a31f859
--- /dev/null
+++ b/plugins/gitfast/updates.patch
@@ -0,0 +1,56 @@
+diff --git b/plugins/gitfast/_git a/plugins/gitfast/_git
+index e2554130..a2e3bef5 100644
+--- b/plugins/gitfast/_git
++++ a/plugins/gitfast/_git
+@@ -30,7 +30,7 @@ if [ -z "$script" ]; then
+ local -a locations
+ local e
+ locations=(
+- $(dirname ${funcsourcetrace[1]%:*})/git-completion.bash
++ "$(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
+@@ -214,8 +214,10 @@ _git ()
+
+ if (( $+functions[__${service}_zsh_main] )); then
+ __${service}_zsh_main
+- else
++ elif (( $+functions[__${service}_main] )); then
+ emulate ksh -c __${service}_main
++ elif (( $+functions[_${service}] )); then
++ emulate ksh -c _${service}
+ fi
+
+ let _ret && _default && _ret=0
+diff --git b/plugins/gitfast/git-completion.bash a/plugins/gitfast/git-completion.bash
+index 9c8f7380..14012cab 100644
+--- b/plugins/gitfast/git-completion.bash
++++ a/plugins/gitfast/git-completion.bash
+@@ -2915,6 +2915,6 @@ __git_complete gitk __gitk_main
+ # when the user has tab-completed the executable name and consequently
+ # included the '.exe' suffix.
+ #
+-if [ Cygwin = "$(uname -o 2>/dev/null)" ]; then
++if [[ "$OSTYPE" = cygwin* ]]; then
+ __git_complete git.exe __git_main
+ fi
+diff --git b/plugins/gitfast/git-prompt.sh a/plugins/gitfast/git-prompt.sh
+index 97eacd78..c1de34eb 100644
+--- b/plugins/gitfast/git-prompt.sh
++++ a/plugins/gitfast/git-prompt.sh
+@@ -502,9 +502,11 @@ __git_ps1 ()
+
+ local z="${GIT_PS1_STATESEPARATOR-" "}"
+
+- # NO color option unless in PROMPT_COMMAND mode
+- if [ $pcmode = yes ] && [ -n "${GIT_PS1_SHOWCOLORHINTS-}" ]; then
+- __git_ps1_colorize_gitstring
++ # NO color option unless in PROMPT_COMMAND mode or it's Zsh
++ if [ -n "${GIT_PS1_SHOWCOLORHINTS-}" ]; then
++ if [ $pcmode = yes ] || [ -n "${ZSH_VERSION-}" ]; then
++ __git_ps1_colorize_gitstring
++ fi
+ fi
+
+ b=${b##refs/heads/}
diff --git a/plugins/github/_hub b/plugins/github/_hub
index 1833a9c09..209a3df9e 100644
--- a/plugins/github/_hub
+++ b/plugins/github/_hub
@@ -58,6 +58,7 @@ __hub_setup_zsh_fns () {
- set1 \
'-m[message]' \
'-F[file]' \
+ '--no-edit[use first commit message for pull request title/description]' \
'-a[user]' \
'-M[milestone]' \
'-l[labels]' \
@@ -84,11 +85,15 @@ __hub_setup_zsh_fns () {
hub_commands=(
alias:'show shell instructions for wrapping git'
pull-request:'open a pull request on GitHub'
+ pr:'list or checkout a GitHub pull request'
+ issue:'list or create a GitHub issue'
+ release:'list or create a GitHub release'
fork:'fork origin repo on GitHub'
create:'create new repo on GitHub for the current project'
+ delete:'delete a GitHub repo'
browse:'browse the project on GitHub'
compare:'open GitHub compare view'
- ci-status:'lookup commit in GitHub Status API'
+ ci-status:'show status of GitHub checks for a commit'
sync:'update local branches from upstream'
)
_describe -t hub-commands 'hub command' hub_commands && ret=0
@@ -111,8 +116,12 @@ __hub_setup_bash_fns () {
cat <<-EOF
alias
pull-request
+pr
+issue
+release
fork
create
+delete
browse
compare
ci-status
diff --git a/plugins/go/README.md b/plugins/go/README.md
index 6ce6f4ee2..bf43b9feb 100644
--- a/plugins/go/README.md
+++ b/plugins/go/README.md
@@ -1 +1 @@
-The go plugin is deprecated. Use the [golang plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/golang) instead.
+The go plugin is deprecated. Use the [golang plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/golang) instead.
diff --git a/plugins/golang/README.md b/plugins/golang/README.md
index 72845b2a1..0a1b43c30 100644
--- a/plugins/golang/README.md
+++ b/plugins/golang/README.md
@@ -21,6 +21,7 @@ plugins=(... golang)
| gog | `go get` | Downloads packages and then installs them to $GOPATH |
| goi | `go install` | Compiles and installs packages to $GOPATH |
| gol | `go list` | Lists Go packages |
+| gom | `go mod` | Access to operations on modules |
| gop | `cd $GOPATH` | Takes you to $GOPATH |
| gopb | `cd $GOPATH/bin` | Takes you to $GOPATH/bin |
| gops | `cd $GOPATH/src` | Takes you to $GOPATH/src |
diff --git a/plugins/gradle/gradle.plugin.zsh b/plugins/gradle/gradle.plugin.zsh
index 8d578e27b..6be583179 100644
--- a/plugins/gradle/gradle.plugin.zsh
+++ b/plugins/gradle/gradle.plugin.zsh
@@ -181,3 +181,4 @@ _gradlew_tasks () {
############################################################################
compdef _gradle_tasks gradle
compdef _gradlew_tasks gradlew
+compdef _gradlew_tasks gw
diff --git a/plugins/gulp/gulp.plugin.zsh b/plugins/gulp/gulp.plugin.zsh
index 2b3105135..6234302c5 100644
--- a/plugins/gulp/gulp.plugin.zsh
+++ b/plugins/gulp/gulp.plugin.zsh
@@ -11,7 +11,7 @@
#
# André König
-# Github: https://github.com/akoenig
+# GitHub: https://github.com/akoenig
# Twitter: https://twitter.com/caiifr
#
@@ -19,11 +19,11 @@
# Grabs all available tasks from the `gulpfile.js`
# in the current directory.
#
-function $$gulp_completion {
+function _gulp_completion {
compls=$(gulp --tasks-simple 2>/dev/null)
completions=(${=compls})
compadd -- $completions
}
-compdef $$gulp_completion gulp
+compdef _gulp_completion gulp
diff --git a/plugins/history-substring-search/README.md b/plugins/history-substring-search/README.md
index 7fb0fa0b6..0ffb21351 100644
--- a/plugins/history-substring-search/README.md
+++ b/plugins/history-substring-search/README.md
@@ -9,7 +9,7 @@ You can also use K and J in VI mode or ^P and ^N in EMACS mode for the same.
[1]: https://fishshell.com
[2]: https://www.zsh.org/mla/users/2009/msg00818.html
[3]: https://sourceforge.net/projects/fizsh/
-[4]: https://github.com/robbyrussell/oh-my-zsh/pull/215
+[4]: https://github.com/ohmyzsh/ohmyzsh/pull/215
[5]: https://github.com/zsh-users/zsh-history-substring-search
[6]: https://github.com/zsh-users/zsh-syntax-highlighting
diff --git a/plugins/homestead/homestead.plugin.zsh b/plugins/homestead/homestead.plugin.zsh
index cdbc564e4..ea2803d77 100644
--- a/plugins/homestead/homestead.plugin.zsh
+++ b/plugins/homestead/homestead.plugin.zsh
@@ -1,6 +1,6 @@
# Homestead basic command completion
_homestead_get_command_list () {
- homestead --no-ansi | sed "1,/Available commands/d" | awk '/^ +[a-z]+/ { print $1 }'
+ homestead --no-ansi | sed -E "1,/(Available|Common) commands/d" | awk '/^ +[a-z]+/ { print $1 }'
}
_homestead () {
diff --git a/plugins/httpie/README.md b/plugins/httpie/README.md
index 56aa6a8ca..f22d3a64e 100644
--- a/plugins/httpie/README.md
+++ b/plugins/httpie/README.md
@@ -1,6 +1,15 @@
-## HTTPie
-**Maintainer:** [lululau](https://github.com/lululau)
+# HTTPie plugin
+
+This plugin adds completion for [HTTPie](https://httpie.org), a command line HTTP
+client, a friendlier cURL replacement.
+
+To use it, add `httpie` to the plugins array in your zshrc file:
-This plugin adds completion for HTTPie, which is a command line HTTP client, a user-friendly cURL replacement.
+```zsh
+plugins=(... httpie)
+```
-[HTTPie Homepage](https://httpie.org)
+It uses completion from [zsh-completions](https://github.com/zsh-users/zsh-completions).
+
+
+**Maintainer:** [lululau](https://github.com/lululau)
diff --git a/plugins/httpie/_httpie b/plugins/httpie/_httpie
new file mode 100644
index 000000000..4d702ef60
--- /dev/null
+++ b/plugins/httpie/_httpie
@@ -0,0 +1,181 @@
+#compdef http
+# ------------------------------------------------------------------------------
+# Copyright (c) 2015 Github zsh-users - http://github.com/zsh-users
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# * Neither the name of the zsh-users nor the
+# names of its contributors may be used to endorse or promote products
+# derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+# ------------------------------------------------------------------------------
+# Description
+# -----------
+#
+# Completion script for httpie 0.7.2 (http://httpie.org)
+#
+# ------------------------------------------------------------------------------
+# Authors
+# -------
+#
+# * Akira Maeda <https://github.com/glidenote>
+# * Valodim <https://github.com/Valodim>
+# * Claus Klingberg <https://github.com/cjk>
+#
+# ------------------------------------------------------------------------------
+# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
+# vim: ft=zsh sw=2 ts=2 et
+# ------------------------------------------------------------------------------
+
+_httpie_params () {
+
+ local ret=1 expl
+
+ # or a url
+ if (( CURRENT <= NORMARG+1 )) && [[ $words[NORMARG] != *:* ]] ; then
+ _httpie_urls && ret=0
+
+ # regular param, if we already have a url
+ elif (( CURRENT > NORMARG )); then
+
+ # if the suffix is precisely : this is shorthand for a header
+ if [[ -prefix ':' ]]; then
+ PREFIX=
+ SUFFIX=:
+ fi
+
+ # if we are in front of a : (possibly due to the PREFIX move before)
+ if [[ -suffix ':' ]]; then
+
+ # this is rather buggy with normal tab behavior :\
+ compstate[insert]=menu
+ _wanted http_header expl 'HTTP Header' \
+ compadd -s ':' -S '' -- Content-Type Cookie && return 0
+ fi
+
+ # ignore all prefix stuff
+ compset -P '(#b)([^:@=]#)'
+ local name=$match[1]
+
+ if compset -P '='; then
+ _message "$name data field value"
+ elif compset -P '@'; then
+ _files
+ elif compset -P ':=@'; then
+ _files
+ elif compset -P ':='; then
+ _message "$name raw json data"
+ elif compset -P '=='; then
+ _message "$name url parameter value"
+ elif compset -P ':'; then
+ _message "$name header content"
+ else
+ typeset -a ops
+ ops=(
+ '=:data field'
+ '\::header'
+ '==:request parameter'
+ '@:data file field'
+ '\:=:raw json field'
+ '\:=@:raw json field file path'
+ )
+ _describe -t httpparams "parameter types" ops -Q -S ''
+ fi
+
+ ret=0
+
+ fi
+
+ # first arg may be a request method
+ (( CURRENT == NORMARG )) &&
+ _wanted http_method expl 'Request Method' \
+ compadd GET POST PUT DELETE HEAD OPTIONS TRACE CONNECT PATCH LINK UNLINK && ret=0
+
+ return $ret
+
+}
+
+_httpie_urls() {
+
+ local ret=1
+
+ if ! [[ -prefix [-+.a-z0-9]#:// ]]; then
+ local expl
+ compset -S '[^:/]*' && compstate[to_end]=''
+ _wanted url-schemas expl 'URL schema' compadd -S '' http:// https:// && ret=0
+ else
+ _urls && ret=0
+ fi
+
+ return $ret
+
+}
+
+_httpie_printflags () {
+
+ local ret=1
+
+ # not sure why this is necessary, but it will complete "-pH" style without it
+ [[ $IPREFIX == "-p" ]] && IPREFIX+=" "
+
+ compset -P '(#b)([a-zA-Z]#)'
+
+ local -a flags
+ [[ $match[1] != *H* ]] && flags+=( "H:request headers" )
+ [[ $match[1] != *B* ]] && flags+=( "B:request body" )
+ [[ $match[1] != *h* ]] && flags+=( "h:response headers" )
+ [[ $match[1] != *b* ]] && flags+=( "b:response body" )
+
+ _describe -t printflags "print flags" flags -S '' && ret=0
+
+ return $ret
+
+}
+
+integer NORMARG
+
+_arguments -n -C -s \
+ '(-j --json -f)'{-j,--json}'[Data items from the command line are serialized as a JSON object.]' \
+ '(-f --form -j)'{-f,--form}'[Data items from the command line are serialized as form fields.]' \
+ '--pretty=[Controls output processing.]:output format:(all colors format none)' \
+ '(-s --style)'{-s,--style}'=[Output coloring style]:STYLE:(autumn borland bw colorful default emacs friendly fruity manni monokai murphy native pastie perldoc ttr solarized tango trac vim vs)' \
+ '(-p --print)'{-p,--print}'=[String specifying what the output should contain]:print flags:_httpie_printflags' \
+ '(-v --verbose)'{-v,--verbose}'[Print the whole request as well as the response.]' \
+ '(-p -h --headers)'{-h,--headers}'[Print only the response headers.]' \
+ '(-p -b --body)'{-b,--body}'[Print only the response body.]' \
+ '(-S --stream)'{-S,--stream}'[Always stream the output by line, i.e., behave like `tail -f`.]' \
+ '(-o --output)'{-o,--output}'=[Save output to FILE.]:output file:_files' \
+ '(-d --download)'{-d,--download}'=[Do not print the response body to stdout.]' \
+ '(-c --continue)'{-c,--continue}'[Resume an interrupted download.]' \
+ '(--session-read-only)--session=[Create, or reuse and update a session.]:session name (or path)' \
+ '(--session)--session-read-only=[Create or read a session without updating it form the request/response exchange.]:session name (or path)' \
+ '(-a --auth)'{-a,--auth}'=[If only the username is provided (-a username)]:USER\:PASS' \
+ '--auth-type=[The authentication mechanism to be used. Defaults to "basic".]:AUTH-TYPE:(basic digest)' \
+ '--proxy=[String mapping protocol to the URL of the proxy.]:PROXY' \
+ '--follow[Allow full redirects.]' \
+ "--verify=[Enable or disable verification of ssl certificates.]:verify certificate:(yes no)" \
+ '--allow-redirects[Set this flag if full redirects are allowed (e.g. re-POST-ing of data at new ``Location``)]' \
+ '--timeout=[Float describes the timeout of the request (Use socket.setdefaulttimeout() as fallback).]:timeout (seconds)' \
+ '--check-status[This flag instructs HTTPie to also check the HTTP status code and exit with an error if the status indicates one.]' \
+ '--ignore-stdin[Do not attempt to read stdin.]' \
+ '(- *)--help[show help message.]' \
+ "(- *)--version[show program's version number and exit.]" \
+ '--traceback[Prints exception traceback should one occur.]' \
+ '--debug[Prints exception traceback should one occur and other information useful for debugging HTTPie itself.]' \
+ '*:args:_httpie_params' && return 0
diff --git a/plugins/httpie/httpie.plugin.zsh b/plugins/httpie/httpie.plugin.zsh
deleted file mode 100644
index 68ead6c67..000000000
--- a/plugins/httpie/httpie.plugin.zsh
+++ /dev/null
@@ -1,33 +0,0 @@
-function _httpie_completion() {
- _arguments -C \
- '(- 1 *)--version[display version information]' \
- '(-j|--json)'{-j,--json}'[(default) Data items from the command line are serialized as a JSON object]' \
- '(-f|--form)'{-f,--form}'[Data items from the command line are serialized as form fields]' \
- '(--pretty)--pretty[<all,colors,format,none> Controls output processing]:options' \
- '(-s|--style)'{-s,--style}'[Output coloring style]' \
- '(-p|--print)'{-p,--print}'[String specifying what the output should contain: H(request headers), B(request body), h(response headers), b(response body)]' \
- '(-v|--verbose)'{-v,--verbose}'[Print the whole request as well as the response. Shortcut for --print=HBbh.]' \
- '(-h|--headers)'{-h,--headers}'[Print only the response headers. Shortcut for --print=h]' \
- '(-b|--body)'{-b,--body}'[Print only the response body. Shortcut for --print=b]' \
- '(-S|--stream)'{-S,--stream}'[Always stream the output by line, i.e., behave like `tail -f'"'"']' \
- '(-o|--output)'{-o,--output}'[Save output to FILE]:file:_files' \
- '(-d|--download)'{-d,--download}'[Do not print the response body to stdout. Rather, download it and store it in a file. The filename is guessed unless specified with --output filename. This action is similar to the default behaviour of wget.]' \
- '(-c|--continue)'{-c,--continue}'[Resume an interrupted download. Note that the --output option needs to be specified as well.]' \
- '(--session)--session[Create, or reuse and update a session. Within a session, custom headers, auth credential, as well as any cookies sent by the server persist between requests]:file:_files' \
- '(--session-read-only)--session-read-only[Create or read a session without updating it form the request/response exchange]:file:_files' \
- '(-a|--auth)'{-a,--auth}'[<USER:PASS> If only the username is provided (-a username), HTTPie will prompt for the password]' \
- '(--auth-type)--auth-type[<basic, digest> The authentication mechanism to be used. Defaults to "basic".]' \
- '(--proxy)--proxy[<PROTOCOL:PROXY_URL> String mapping protocol to the URL of the proxy]' \
- '(--follow)--follow[Set this flag if full redirects are allowed (e.g. re-POST-ing of data at new Location).]' \
- '(--verify)--verify[<VERIFY> Set to "no" to skip checking the host'"'"'s SSL certificate. You can also pass the path to a CA_BUNDLE file for private certs. You can also set the REQUESTS_CA_BUNDLE environment variable. Defaults to "yes".]' \
- '(--timeout)--timeout[<SECONDS> The connection timeout of the request in seconds. The default value is 30 seconds]' \
- '(--check-status)--check-status[By default, HTTPie exits with 0 when no network or other fatal errors occur. This flag instructs HTTPie to also check the HTTP status code and exit with an error if the status indicates one.]' \
- '(--ignore-stdin)--ignore-stdin[Do not attempt to read stdin]' \
- '(--help)--help[Show this help message and exit]' \
- '(--traceback)--traceback[Prints exception traceback should one occur]' \
- '(--debug)--debug[Prints exception traceback should one occur, and also other information that is useful for debugging HTTPie itself and for reporting bugs]' \
- '1: :->cmds' \
- '*: :->args' && ret=0
-}
-
-compdef _httpie_completion http \ No newline at end of file
diff --git a/plugins/iwhois/README.md b/plugins/iwhois/README.md
deleted file mode 100644
index 1626b8524..000000000
--- a/plugins/iwhois/README.md
+++ /dev/null
@@ -1,24 +0,0 @@
-# iwhois
-
-Provides a whois command with a more accurate and up-to-date list of whois servers
-using CNAMES, via [whois.geek.nz](https://github.com/iwantmyname/whois.geek.nz).
-
-To use it, add iwhois to the plugins array of your zshrc file:
-```
-plugins=(... iwhois)
-```
-
-### Usage
-
-The plugin defines the function `iwhois` that takes a domain name as an argument:
-
-```
-$ iwhois github.com
- Domain Name: GITHUB.COM
- Registry Domain ID: 1264983250_DOMAIN_COM-VRSN
- Registrar WHOIS Server: whois.markmonitor.com
- Registrar URL: http://www.markmonitor.com
- Updated Date: 2017-06-26T16:02:39Z
- Creation Date: 2007-10-09T18:20:50Z
- ...
-```
diff --git a/plugins/iwhois/iwhois.plugin.zsh b/plugins/iwhois/iwhois.plugin.zsh
deleted file mode 100644
index 22a75eec1..000000000
--- a/plugins/iwhois/iwhois.plugin.zsh
+++ /dev/null
@@ -1,5 +0,0 @@
-function iwhois() {
- resolver="whois.geek.nz"
- tld=`echo ${@: -1} | awk -F "." '{print $NF}'`
- whois -h ${tld}.${resolver} "$@" ;
-}
diff --git a/plugins/jenv/jenv.plugin.zsh b/plugins/jenv/jenv.plugin.zsh
index 2eda8037b..b85906a0b 100644
--- a/plugins/jenv/jenv.plugin.zsh
+++ b/plugins/jenv/jenv.plugin.zsh
@@ -15,7 +15,7 @@ if [[ $FOUND_JENV -eq 0 ]]; then
fi
if [[ $FOUND_JENV -eq 1 ]]; then
- export PATH="${jenvdir}/bin:$PATH"
+ (( $+commands[jenv] )) || export PATH="${jenvdir}/bin:$PATH"
eval "$(jenv init - zsh)"
function jenv_prompt_info() { jenv version-name 2>/dev/null }
diff --git a/plugins/jira/README.md b/plugins/jira/README.md
index a934ae68c..091dccb97 100644
--- a/plugins/jira/README.md
+++ b/plugins/jira/README.md
@@ -21,6 +21,7 @@ jira new # opens a new issue
jira dashboard # opens your JIRA dashboard
jira reported [username] # queries for issues reported by a user
jira assigned [username] # queries for issues assigned to a user
+jira myissues # queries for you own issues
jira branch # opens an existing issue matching the current branch name
jira ABC-123 # opens an existing issue
jira ABC-123 m # opens an existing issue for adding a comment
diff --git a/plugins/jira/jira.plugin.zsh b/plugins/jira/jira.plugin.zsh
index 052481a60..e706948e9 100644
--- a/plugins/jira/jira.plugin.zsh
+++ b/plugins/jira/jira.plugin.zsh
@@ -43,7 +43,10 @@ function jira() {
echo "Opening new issue"
open_command "${jira_url}/secure/CreateIssue!default.jspa"
elif [[ "$action" == "assigned" || "$action" == "reported" ]]; then
- _jira_query $@
+ _jira_query ${@:-$action}
+ elif [[ "$action" == "myissues" ]]; then
+ echo "Opening my issues"
+ open_command "${jira_url}/issues/?filter=-1"
elif [[ "$action" == "dashboard" ]]; then
echo "Opening dashboard"
if [[ "$JIRA_RAPID_BOARD" == "true" ]]; then
diff --git a/plugins/jruby/README.md b/plugins/jruby/README.md
new file mode 100644
index 000000000..821a46d5e
--- /dev/null
+++ b/plugins/jruby/README.md
@@ -0,0 +1,21 @@
+# JRuby plugin
+
+This plugin adds aliases for [JRuby](https://www.jruby.org/).
+
+To use it, add `jruby` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... jruby)
+```
+
+## Requirements
+
+This plugin assumes you already have jruby installed and available in your [path](https://www.jruby.org/getting-started).
+
+## Aliases
+
+| Alias | Command |
+| ------------ | ---------------------------------------------------------------- |
+| `jrspec` | `jruby --debug -S rspec --debug` |
+| `jprofile` | `jruby --profile.api -S rspec` |
+| `jexec` | `jruby -S` |
diff --git a/plugins/jsontools/jsontools.plugin.zsh b/plugins/jsontools/jsontools.plugin.zsh
index 20d5eb1c9..912c83509 100644
--- a/plugins/jsontools/jsontools.plugin.zsh
+++ b/plugins/jsontools/jsontools.plugin.zsh
@@ -11,9 +11,10 @@ if [[ $(whence node) != "" && ( "x$JSONTOOLS_METHOD" = "x" || "x$JSONTOOLS_METH
alias urlencode_json='xargs -0 node -e "console.log(encodeURIComponent(process.argv[1]))"'
alias urldecode_json='xargs -0 node -e "console.log(decodeURIComponent(process.argv[1]))"'
elif [[ $(whence python) != "" && ( "x$JSONTOOLS_METHOD" = "x" || "x$JSONTOOLS_METHOD" = "xpython" ) ]]; then
- alias pp_json='python -mjson.tool'
+ alias pp_json='python -c "import sys; del sys.path[0]; import runpy; runpy._run_module_as_main(\"json.tool\")"'
alias is_json='python -c "
-import json, sys;
+import sys; del sys.path[0];
+import json;
try:
json.loads(sys.stdin.read())
except ValueError, e:
@@ -22,11 +23,13 @@ else:
print True
sys.exit(0)"'
alias urlencode_json='python -c "
-import urllib, json, sys;
+import sys; del sys.path[0];
+import urllib, json;
print urllib.quote_plus(sys.stdin.read())
sys.exit(0)"'
alias urldecode_json='python -c "
-import urllib, json, sys;
+import sys; del sys.path[0];
+import urllib, json;
print urllib.unquote_plus(sys.stdin.read())
sys.exit(0)"'
elif [[ $(whence ruby) != "" && ( "x$JSONTOOLS_METHOD" = "x" || "x$JSONTOOLS_METHOD" = "xruby" ) ]]; then
@@ -36,4 +39,4 @@ elif [[ $(whence ruby) != "" && ( "x$JSONTOOLS_METHOD" = "x" || "x$JSONTOOLS_MET
alias urldecode_json='ruby -e "require \"uri\"; puts URI.unescape(STDIN.read)"'
fi
-unset JSONTOOLS_METHOD \ No newline at end of file
+unset JSONTOOLS_METHOD
diff --git a/plugins/keychain/keychain.plugin.zsh b/plugins/keychain/keychain.plugin.zsh
index af34793e7..def97d8d1 100644
--- a/plugins/keychain/keychain.plugin.zsh
+++ b/plugins/keychain/keychain.plugin.zsh
@@ -15,7 +15,7 @@ function _start_agent() {
zstyle -a :omz:plugins:keychain options options
# start keychain...
- keychain ${^options:-} --agents ${agents:-gpg} ${^identities}
+ keychain ${^options:-} --agents ${agents:-gpg} ${^identities} --host $SHORT_HOST
# Get the filenames to store/lookup the environment from
_keychain_env_sh="$HOME/.keychain/$SHORT_HOST-sh"
diff --git a/plugins/kube-ps1/README.md b/plugins/kube-ps1/README.md
index fcb73cd2d..82c0a77e6 100644
--- a/plugins/kube-ps1/README.md
+++ b/plugins/kube-ps1/README.md
@@ -45,20 +45,38 @@ want to load.
vim $HOME/.zshrc
```
-Add kube-ps1 to the list of enabled plugins:
+Add kube-ps1 to the list of enabled plugins and enable it on the prompt:
```shell
plugins=(
git
kube-ps1
)
+
+# After the "source Oh My Zsh" line
+PROMPT=$PROMPT'$(kube_ps1) '
+```
+
+Note: The `PROMPT` example above was tested with the theme `robbyrussell`.
+
+## Enabling / Disabling on the current shell
+
+Sometimes the kubernetes information can be anoying, you can easily
+switch it on and off with the following commands:
+
+```shell
+kubeon
+```
+
+```shell
+kubeoff
```
## Colors
Blue was used as the prefix to match the Kubernetes color as closely as
possible. Red was chosen as the cluster name to stand out, and cyan
-for the namespace. These can of course be changed.
+for the namespace. Check the customization section for changing them.
## Customization
@@ -75,7 +93,12 @@ The default settings can be overridden in ~/.zshrc
| `KUBE_PS1_SEPERATOR` | `\|` | Separator between symbol and cluster name |
| `KUBE_PS1_DIVIDER` | `:` | Separator between cluster and namespace |
| `KUBE_PS1_SUFFIX` | `)` | Prompt closing character |
+| `KUBE_PS1_COLOR_SYMBOL` | `"%F{blue}"` | Custom color for the symbol |
+| `KUBE_PS1_COLOR_CONTEXT` | `"%F{red}"` | Custom color for the context |
+| `KUBE_PS1_COLOR_NS` | `"%F{cyan}"` | Custom color for the namespace |
+| `KUBE_PS1_ENABLED` | `true` | Set to false to start disabled on any new shell, `kubeon`/`kubeoff` will flip this value on the current shell |
## Contributors
-Jared Yanovich
+- Jared Yanovich
+- Pedro Moranga
diff --git a/plugins/kube-ps1/kube-ps1.plugin.zsh b/plugins/kube-ps1/kube-ps1.plugin.zsh
index df7277a26..3cb21284a 100644
--- a/plugins/kube-ps1/kube-ps1.plugin.zsh
+++ b/plugins/kube-ps1/kube-ps1.plugin.zsh
@@ -39,6 +39,11 @@ KUBE_PS1_DIVIDER="${KUBE_PS1_DIVIDER-:}"
KUBE_PS1_PREFIX="${KUBE_PS1_PREFIX-(}"
KUBE_PS1_SUFFIX="${KUBE_PS1_SUFFIX-)}"
KUBE_PS1_LAST_TIME=0
+KUBE_PS1_ENABLED=true
+
+KUBE_PS1_COLOR_SYMBOL="%{$fg[blue]%}"
+KUBE_PS1_COLOR_CONTEXT="%{$fg[red]%}"
+KUBE_PS1_COLOR_NS="%{$fg[cyan]%}"
_kube_ps1_binary_check() {
command -v "$1" >/dev/null
@@ -127,21 +132,28 @@ _kube_ps1_get_context_ns() {
fi
}
+# function to disable the prompt on the current shell
+kubeon(){
+ KUBE_PS1_ENABLED=true
+}
+
+# function to disable the prompt on the current shell
+kubeoff(){
+ KUBE_PS1_ENABLED=false
+}
+
# Build our prompt
kube_ps1 () {
- local reset_color="%f"
- local blue="%F{blue}"
- local red="%F{red}"
- local cyan="%F{cyan}"
+ local reset_color="%{$reset_color%}"
+ [[ ${KUBE_PS1_ENABLED} != 'true' ]] && return
KUBE_PS1="${reset_color}$KUBE_PS1_PREFIX"
- KUBE_PS1+="${blue}$(_kube_ps1_symbol)"
+ KUBE_PS1+="${KUBE_PS1_COLOR_SYMBOL}$(_kube_ps1_symbol)"
KUBE_PS1+="${reset_color}$KUBE_PS1_SEPERATOR"
- KUBE_PS1+="${red}$KUBE_PS1_CONTEXT${reset_color}"
+ KUBE_PS1+="${KUBE_PS1_COLOR_CONTEXT}$KUBE_PS1_CONTEXT${reset_color}"
KUBE_PS1+="$KUBE_PS1_DIVIDER"
- KUBE_PS1+="${cyan}$KUBE_PS1_NAMESPACE${reset_color}"
+ KUBE_PS1+="${KUBE_PS1_COLOR_NS}$KUBE_PS1_NAMESPACE${reset_color}"
KUBE_PS1+="$KUBE_PS1_SUFFIX"
echo "${KUBE_PS1}"
-
}
diff --git a/plugins/kubectl/README.md b/plugins/kubectl/README.md
index 3343f0195..c0db59362 100644
--- a/plugins/kubectl/README.md
+++ b/plugins/kubectl/README.md
@@ -22,6 +22,7 @@ plugins=(... kubectl)
| kcsc | `kubectl config set-context` | Set a context entry in kubeconfig |
| kcdc | `kubectl config delete-context` | Delete the specified context from the kubeconfig |
| kccc | `kubectl config current-context` | Display the current-context |
+| kcgc | `kubectl config get-contexts` | List of contexts available
| | | **General aliases** |
| kdel | `kubectl delete` | Delete resources by filenames, stdin, resources and names, or by resources and label selector |
| kdelf | `kubectl delete -f` | Delete a pod using the type and name specified in -f argument |
@@ -89,3 +90,18 @@ plugins=(... kubectl)
| keno | `kubectl edit node` | Edit nodes resource from the default editor |
| kdno | `kubectl describe node` | Describe node resource in detail |
| kdelno | `kubectl delete node` | Delete the node |
+| | | **Persistent Volume Claim management** |
+| kgpvc | `kubectl get pvc` | List all PVCs |
+| kgpvcw | `kgpvc --watch` | After listing/getting the requested object, watch for changes |
+| kepvc | `kubectl edit pvc` | Edit pvcs from the default editor |
+| kdpvc | `kubectl describe pvc` | Descirbe all pvcs |
+| kdelpvc | `kubectl delete pvc` | Delete all pvcs matching passed arguments |
+| | | |
+| kgss | `kubectl get statefulset` | List the statefulsets in ps format |
+| kgssw | `kgss --watch` | After getting the list of statefulsets, watch for changes |
+| kgsswide| `kgss -o wide` | After getting the statefulsets, output in plain-text format with any additional information |
+| kess | `kubectl edit statefulset` | Edit statefulset resource from the default editor |
+| kdss | `kubectl describe statefulset` | Describe statefulset resource in detail |
+| kdelss | `kubectl delete statefulset` | Delete the statefulset |
+| ksss | `kubectl scale statefulset` | Scale a statefulset |
+| krsss | `kubectl rollout status statefulset`| Check the rollout status of a deployment |
diff --git a/plugins/kubectl/kubectl.plugin.zsh b/plugins/kubectl/kubectl.plugin.zsh
index ab7a1a0a4..6c1696d5e 100644
--- a/plugins/kubectl/kubectl.plugin.zsh
+++ b/plugins/kubectl/kubectl.plugin.zsh
@@ -28,6 +28,9 @@ alias kcsc='kubectl config set-context'
alias kcdc='kubectl config delete-context'
alias kccc='kubectl config current-context'
+# List all contexts
+alias kcgc='kubectl config get-contexts'
+
# General aliases
alias kdel='kubectl delete'
alias kdelf='kubectl delete -f'
@@ -93,6 +96,16 @@ alias kgrs='kubectl get rs'
alias krh='kubectl rollout history'
alias kru='kubectl rollout undo'
+# Statefulset management.
+alias kgss='kubectl get statefulset'
+alias kgssw='kgss --watch'
+alias kgsswide='kgss -o wide'
+alias kess='kubectl edit statefulset'
+alias kdss='kubectl describe statefulset'
+alias kdelss='kubectl delete statefulset'
+alias ksss='kubectl scale statefulset'
+alias krsss='kubectl rollout status statefulset'
+
# Port forwarding
alias kpf="kubectl port-forward"
@@ -112,3 +125,11 @@ alias kgno='kubectl get nodes'
alias keno='kubectl edit node'
alias kdno='kubectl describe node'
alias kdelno='kubectl delete node'
+
+# PVC management.
+alias kgpvc='kubectl get pvc'
+alias kgpvcw='kgpvc --watch'
+alias kepvc='kubectl edit pvc'
+alias kdpvc='kubectl describe pvc'
+alias kdelpvc='kubectl delete pvc'
+
diff --git a/plugins/last-working-dir/last-working-dir.plugin.zsh b/plugins/last-working-dir/last-working-dir.plugin.zsh
index 53bb19e46..fd21705ae 100644
--- a/plugins/last-working-dir/last-working-dir.plugin.zsh
+++ b/plugins/last-working-dir/last-working-dir.plugin.zsh
@@ -2,7 +2,8 @@
typeset -g ZSH_LAST_WORKING_DIRECTORY
# Updates the last directory once directory is changed
-chpwd_functions+=(chpwd_last_working_dir)
+autoload -U add-zsh-hook
+add-zsh-hook chpwd chpwd_last_working_dir
chpwd_last_working_dir() {
if [ "$ZSH_SUBSHELL" = 0 ]; then
local cache_file="$ZSH_CACHE_DIR/last-working-dir"
diff --git a/plugins/lein/README.md b/plugins/lein/README.md
new file mode 100644
index 000000000..0c4119663
--- /dev/null
+++ b/plugins/lein/README.md
@@ -0,0 +1,9 @@
+# Leiningen plugin
+
+This plugin adds completions for the [Leiningen](https://leiningen.org/) Clojure build tool.
+
+To use it, add `lein` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... lein)
+```
diff --git a/plugins/lol/README.md b/plugins/lol/README.md
index b0e54f575..8fba7b713 100644
--- a/plugins/lol/README.md
+++ b/plugins/lol/README.md
@@ -13,10 +13,10 @@ Plugin for adding catspeak aliases, because why not
)
```
-2. Reload the source file or restart your Terminal session:
+2. Restart your terminal session or restart the shell:
```console
- $ source ~/.zshrc
+ $ exec zsh
$
```
diff --git a/plugins/lol/lol.plugin.zsh b/plugins/lol/lol.plugin.zsh
index 585f96e4f..3c30259a1 100644
--- a/plugins/lol/lol.plugin.zsh
+++ b/plugins/lol/lol.plugin.zsh
@@ -45,7 +45,7 @@ alias bringz='git pull'
alias chicken='git add'
alias oanward='git commit -m'
alias ooanward='git commit -am'
-alias yolo='git commit -m "$(curl -s https://whatthecommit.com/index.txt)"'
+alias yolo='git commit -m "$(curl -s http://whatthecommit.com/index.txt)"'
alias letcat='git checkout'
alias violenz='git rebase'
diff --git a/plugins/magic-enter/Readme.md b/plugins/magic-enter/Readme.md
index b401ab415..78514c67d 100644
--- a/plugins/magic-enter/Readme.md
+++ b/plugins/magic-enter/Readme.md
@@ -1,14 +1,17 @@
-## Magic Enter
+## Magic Enter plugin
-**Maintainer:** [@dufferzafar](https://github.com/dufferzafar)
-
-Makes your enter key magical, by binding commonly used commands to it.
+This plugin makes your enter key magical, by binding commonly used commands to it.
-You can set the commands to be run in your .zshrc, before the line containing plugins!
+To use it, add `magic-enter` to the plugins array in your zshrc file. You can set the
+commands to be run in your .zshrc, before the line containing plugins. If no command
+is specified in a git directory, `git status` is executed; in other directories, `ls`.
-```bash
+```zsh
+# defaults
MAGIC_ENTER_GIT_COMMAND='git status -u .'
MAGIC_ENTER_OTHER_COMMAND='ls -lh .'
-plugins=(magic-enter)
+plugins=(... magic-enter)
```
+
+**Maintainer:** [@dufferzafar](https://github.com/dufferzafar)
diff --git a/plugins/meteor/README.md b/plugins/meteor/README.md
index 4bee87f8f..187a45a62 100644
--- a/plugins/meteor/README.md
+++ b/plugins/meteor/README.md
@@ -1,6 +1,6 @@
## Introduction
-The [meteor plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/meteor) provides many
+The [meteor plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/meteor) provides many
[useful aliases](#aliases) as well as completion for the `meteor` command.
Enable it by adding `meteor` to the plugins array in your zshrc file:
diff --git a/plugins/mvn/README.md b/plugins/mvn/README.md
index 88f5be8ba..3bbba5b4f 100644
--- a/plugins/mvn/README.md
+++ b/plugins/mvn/README.md
@@ -55,4 +55,4 @@ has colored output, so this function will be soon removed from the plugin.
### Known bugs
It has a bug where it will swallow mvn prompts for user input, _e.g._ when using
-`archetype:generate`. See [#5052](https://github.com/robbyrussell/oh-my-zsh/issues/5052).
+`archetype:generate`. See [#5052](https://github.com/ohmyzsh/ohmyzsh/issues/5052).
diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh
index 01aef814d..0866e5553 100644
--- a/plugins/mvn/mvn.plugin.zsh
+++ b/plugins/mvn/mvn.plugin.zsh
@@ -267,6 +267,8 @@ function listMavenCompletions {
stage:copy
# toolchain
toolchain:toolchain
+ #liberty
+ liberty:clean-server liberty:compile-jsp liberty:configure-arquillian liberty:create-server liberty:debug liberty:debug-server liberty:deploy liberty:dev liberty:display-url liberty:dump-server liberty:install-apps liberty:install-feature liberty:install-server liberty:java-dump-server liberty:package-server liberty:run liberty:run-server liberty:server-status liberty:start liberty:start-server liberty:status liberty:stop liberty:stop-server liberty:test-start-server liberty:test-stop-server liberty:undeploy liberty:uninstall-feature
# 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" "-DgroupId=" "-DartifactId=" "-Dversion=" "-Dpackaging=jar" "-Dfile="
diff --git a/plugins/mysql-macports/README.md b/plugins/mysql-macports/README.md
new file mode 100644
index 000000000..a4224d9c0
--- /dev/null
+++ b/plugins/mysql-macports/README.md
@@ -0,0 +1,20 @@
+# MySQL-Macports plugin
+
+This plugin adds aliases for some of the commonly used [MySQL](https://www.mysql.com/) commands when installed using [MacPorts](https://www.macports.org/) on macOS.
+
+To use it, add `mysql-macports` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... mysql-macports)
+```
+
+For instructions on how to install MySQL using MacPorts, read the [MacPorts wiki](https://trac.macports.org/wiki/howto/MySQL/).
+
+## Aliases
+
+| Alias | Command | Description |
+| ------------ | --------------------------------------------------------- | ------------------------------------------ |
+| mysqlstart | `sudo /opt/local/share/mysql5/mysql/mysql.server start` | Start the MySQL server. |
+| mysqlstop | `sudo /opt/local/share/mysql5/mysql/mysql.server stop` | Stop the MySQL server. |
+| mysqlrestart | `sudo /opt/local/share/mysql5/mysql/mysql.server restart` | Restart the MySQL server. |
+| mysqlstatus | `mysqladmin5 -u root -p ping` | Check whether the MySQL server is running. |
diff --git a/plugins/n98-magerun/README.md b/plugins/n98-magerun/README.md
new file mode 100644
index 000000000..b0abe4747
--- /dev/null
+++ b/plugins/n98-magerun/README.md
@@ -0,0 +1,21 @@
+# n98-magerun plugin
+
+The swiss army knife for Magento developers, sysadmins and devops. The tool provides a huge set of well tested command line commands which save hours of work time.
+
+The [n98-magerun plugin](https://github.com/netz98/n98-magerun) provides many
+[useful aliases](#aliases) as well as completion for the `n98-magerun` command.
+
+Enable it by adding `n98-magerun` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... n98-magerun)
+```
+
+## Aliases
+
+| Alias | Command | Description |
+| --------- | -------------------------------------------------- | --------------------------------------------------------------------------------- |
+| n98 | `n98-magerun.phar` | The N98-Magerun phar-file (Version 1) |
+| n98-2 | `n98-magerun2.phar` | The N98-Magerun phar-file (Version 2) |
+| mage-get | `wget https://files.magerun.net/n98-magerun.phar` | Download the latest stable N98-Magerun phar-file from the file-server (Version 1) |
+| mage2-get | `wget https://files.magerun.net/n98-magerun2.phar` | Download the latest stable N98-Magerun phar-file from the file-server (Version 2) |
diff --git a/plugins/n98-magerun/n98-magerun.plugin.zsh b/plugins/n98-magerun/n98-magerun.plugin.zsh
index bfcf27b98..d79aee7eb 100644
--- a/plugins/n98-magerun/n98-magerun.plugin.zsh
+++ b/plugins/n98-magerun/n98-magerun.plugin.zsh
@@ -2,7 +2,8 @@
# FILE: n98-magerun.plugin.zsh
# DESCRIPTION: oh-my-zsh n98-magerun plugin file. Adapted from composer plugin
# AUTHOR: Andrew Dwyer (andrewrdwyer at gmail dot com)
-# VERSION: 1.0.0
+# AUTHOR: Jisse Reitsma (jisse at yireo dot com)
+# VERSION: 1.1.0
# ------------------------------------------------------------------------------
# n98-magerun basic command completion
@@ -24,11 +25,18 @@ _n98_magerun () {
compdef _n98_magerun n98-magerun.phar
compdef _n98_magerun n98-magerun
+compdef _n98_magerun n98-magerun2.phar
+compdef _n98_magerun n98-magerun2
# Aliases
alias n98='n98-magerun.phar'
alias mage='n98-magerun.phar'
-alias magefl='n98-magerun.phar cache:flush'
+alias magerun='n98-magerun.phar'
+
+alias n98-2='n98-magerun2.phar'
+alias mage2='n98-magerun2.phar'
+alias magerun2='n98-magerun2.phar'
# Install n98-magerun into the current directory
-alias mage-get='wget https://raw.github.com/netz98/n98-magerun/master/n98-magerun.phar'
+alias mage-get='wget https://files.magerun.net/n98-magerun.phar'
+alias mage2-get='wget https://files.magerun.net/n98-magerun2.phar'
diff --git a/plugins/ng/README.md b/plugins/ng/README.md
index 86ad64041..94a450c18 100644
--- a/plugins/ng/README.md
+++ b/plugins/ng/README.md
@@ -1,6 +1,6 @@
## NG Plugin
-This [ng plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/ng)
+This [ng plugin](https://github.com/ohmyzsh/ohmyzsh/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)
diff --git a/plugins/ng/ng.plugin.zsh b/plugins/ng/ng.plugin.zsh
index b802bf617..44102e2a6 100644
--- a/plugins/ng/ng.plugin.zsh
+++ b/plugins/ng/ng.plugin.zsh
@@ -1,4 +1,3 @@
-
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 update v version -h --help'
_ng_completion () {
@@ -73,9 +72,7 @@ _ng_completion () {
;;
esac
- setopt shwordsplit
- reply=($opts)
- unset shwordsplit
+ reply=(${=opts})
}
compctl -K _ng_completion ng
diff --git a/plugins/nvm/nvm.plugin.zsh b/plugins/nvm/nvm.plugin.zsh
index 9dde3a266..4bab8e9d7 100644
--- a/plugins/nvm/nvm.plugin.zsh
+++ b/plugins/nvm/nvm.plugin.zsh
@@ -1,5 +1,8 @@
# Set NVM_DIR if it isn't already defined
[[ -z "$NVM_DIR" ]] && export NVM_DIR="$HOME/.nvm"
-# Load nvm if it exists
-[[ -f "$NVM_DIR/nvm.sh" ]] && source "$NVM_DIR/nvm.sh"
+# Try to load nvm only if command not already available
+if ! type "nvm" &> /dev/null; then
+ # Load nvm if it exists
+ [[ -f "$NVM_DIR/nvm.sh" ]] && source "$NVM_DIR/nvm.sh"
+fi
diff --git a/plugins/oc/README.md b/plugins/oc/README.md
new file mode 100644
index 000000000..deae9b2d0
--- /dev/null
+++ b/plugins/oc/README.md
@@ -0,0 +1,13 @@
+# OC - OpenShift CLI
+
+This plugin provides autocompletion for [OC](https://docs.openshift.com/container-platform/3.7/cli_reference/index.html) commands, building, managing and updating operations.
+
+To use it, add `oc` to the plugins array of your zshrc file:
+
+```bash
+plugins=(... oc)
+```
+
+## Contributors
+
++ [kevinkirkup](https://github.com/kevinkirkup) - Plugin Author
diff --git a/plugins/osx/README.md b/plugins/osx/README.md
index 3559dee02..f3881ec6b 100644
--- a/plugins/osx/README.md
+++ b/plugins/osx/README.md
@@ -18,7 +18,7 @@ This application makes use of the following third party scripts:
[shpotify](https://github.com/hnarayanan/shpotify)
-Copyright (c) 2012–2017 [Harish Narayanan](https://harishnarayanan.org/).
+Copyright (c) 2012–2019 [Harish Narayanan](https://harishnarayanan.org/).
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
@@ -42,20 +42,21 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
## Commands
-| Command | Description |
-| :-------------- | :-------------------------------------------------- |
-| `tab` | Open the current directory in a new tab |
-| `split_tab` | Split the current terminal tab horizontally |
-| `vsplit_tab` | Split the current terminal tab vertically |
-| `ofd` | Open the current directory in a Finder window |
-| `pfd` | Return the path of the frontmost Finder window |
-| `pfs` | Return the current Finder selection |
-| `cdf` | `cd` to the current Finder directory |
-| `pushdf` | `pushd` to the current Finder directory |
-| `quick-look` | Quick-Look a specified file |
-| `man-preview` | Open a specified man page in Preview app |
-| `showfiles` | Show hidden files |
-| `hidefiles` | Hide the hidden files |
-| `itunes` | Control iTunes. Use `itunes -h` for usage details |
-| `spotify` | Control Spotify and search by artist, album, track… |
-| `rmdsstore` | Remove .DS\_Store files recursively in a directory |
+| Command | Description |
+| :-------------- | :---------------------------------------------------- |
+| `tab` | Open the current directory in a new tab |
+| `split_tab` | Split the current terminal tab horizontally |
+| `vsplit_tab` | Split the current terminal tab vertically |
+| `ofd` | Open the current directory in a Finder window |
+| `pfd` | Return the path of the frontmost Finder window |
+| `pfs` | Return the current Finder selection |
+| `cdf` | `cd` to the current Finder directory |
+| `pushdf` | `pushd` to the current Finder directory |
+| `quick-look` | Quick-Look a specified file |
+| `man-preview` | Open a specified man page in Preview app |
+| `showfiles` | Show hidden files |
+| `hidefiles` | Hide the hidden files |
+| `itunes` | DEPRECATED. Use `music` from macOS Catalina on |
+| `music` | Control Apple Music. Use `music -h` for usage details |
+| `spotify` | Control Spotify and search by artist, album, track… |
+| `rmdsstore` | Remove .DS\_Store files recursively in a directory |
diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh
index a1c73a184..03e9c1c8c 100644
--- a/plugins/osx/osx.plugin.zsh
+++ b/plugins/osx/osx.plugin.zsh
@@ -51,6 +51,17 @@ EOF
end tell
end tell
EOF
+ elif [[ "$the_app" == 'Hyper' ]]; then
+ osascript >/dev/null <<EOF
+ tell application "System Events"
+ tell process "Hyper" to keystroke "t" using command down
+ end tell
+ delay 1
+ tell application "System Events"
+ keystroke "${command}"
+ key code 36 #(presses enter)
+ end tell
+EOF
else
echo "tab: unsupported terminal app: $the_app"
@@ -91,6 +102,19 @@ EOF
end tell
end tell
EOF
+
+ elif [[ "$the_app" == 'Hyper' ]]; then
+ osascript >/dev/null <<EOF
+ tell application "System Events"
+ tell process "Hyper"
+ tell menu item "Split Vertically" of menu "Shell" of menu bar 1
+ click
+ end tell
+ end tell
+ delay 1
+ keystroke "${command} \n"
+ end tell
+EOF
else
echo "$0: unsupported terminal app: $the_app" >&2
@@ -132,6 +156,19 @@ EOF
end tell
EOF
+ elif [[ "$the_app" == 'Hyper' ]]; then
+ osascript >/dev/null <<EOF
+ tell application "System Events"
+ tell process "Hyper"
+ tell menu item "Split Horizontally" of menu "Shell" of menu bar 1
+ click
+ end tell
+ end tell
+ delay 1
+ keystroke "${command} \n"
+ end tell
+EOF
+
else
echo "$0: unsupported terminal app: $the_app" >&2
false
@@ -182,7 +219,19 @@ function vncviewer() {
}
# iTunes control function
-function itunes() {
+function itunes music() {
+ local APP_NAME=Music
+
+ autoload is-at-least
+ if is-at-least 10.15 $(sw_vers -productVersion); then
+ if [[ $0 = itunes ]]; then
+ echo >&2 The itunes function name is deprecated. Use \`music\' instead.
+ return 1
+ fi
+ else
+ APP_NAME=iTunes
+ fi
+
local opt=$1
local playlist=$2
shift
@@ -199,29 +248,41 @@ function itunes() {
opt="$opt track"
;;
vol)
- opt="set sound volume to $1" #$1 Due to the shift
+ local new_volume volume=$(osascript -e "tell application \"$APP_NAME\" to get sound volume")
+ if [[ $# -eq 0 ]]; then
+ echo "Current volume is ${volume}."
+ return 0
+ fi
+ case $1 in
+ up) new_volume=$((volume + 10 < 100 ? volume + 10 : 100)) ;;
+ down) new_volume=$((volume - 10 > 0 ? volume - 10 : 0)) ;;
+ <0-100>) new_volume=$1 ;;
+ *) echo "'$1' is not valid. Expected <0-100>, up or down."
+ return 1 ;;
+ esac
+ opt="set sound volume to ${new_volume}"
;;
playlist)
- # Inspired by: https://gist.github.com/nakajijapan/ac8b45371064ae98ea7f
-if [[ ! -z "$playlist" ]]; then
- osascript -e 'tell application "iTunes"' -e "set new_playlist to \"$playlist\" as string" -e "play playlist new_playlist" -e "end tell" 2>/dev/null;
+ # Inspired by: https://gist.github.com/nakajijapan/ac8b45371064ae98ea7f
+ if [[ ! -z "$playlist" ]]; then
+ osascript -e "tell application \"$APP_NAME\"" -e "set new_playlist to \"$playlist\" as string" -e "play playlist new_playlist" -e "end tell" 2>/dev/null;
if [[ $? -eq 0 ]]; then
opt="play"
else
opt="stop"
fi
- else
- opt="set allPlaylists to (get name of every playlist)"
- fi
- ;;
+ else
+ opt="set allPlaylists to (get name of every playlist)"
+ fi
+ ;;
playing|status)
- local state=`osascript -e 'tell application "iTunes" to player state as string'`
+ local state=`osascript -e "tell application \"$APP_NAME\" to player state as string"`
if [[ "$state" = "playing" ]]; then
- currenttrack=`osascript -e 'tell application "iTunes" to name of current track as string'`
- currentartist=`osascript -e 'tell application "iTunes" to artist of current track as string'`
+ currenttrack=`osascript -e "tell application \"$APP_NAME\" to name of current track as string"`
+ currentartist=`osascript -e "tell application \"$APP_NAME\" to artist of current track as string"`
echo -E "Listening to $fg[yellow]$currenttrack$reset_color by $fg[yellow]$currentartist$reset_color";
else
- echo "iTunes is" $state;
+ echo "$APP_NAME is" $state;
fi
return 0
;;
@@ -235,7 +296,7 @@ if [[ ! -z "$playlist" ]]; then
if [[ -n "$state" && ! "$state" =~ "^(on|off|toggle)$" ]]
then
- print "Usage: itunes shuffle [on|off|toggle]. Invalid option."
+ print "Usage: $0 shuffle [on|off|toggle]. Invalid option."
return 1
fi
@@ -256,14 +317,14 @@ EOF
esac
;;
""|-h|--help)
- echo "Usage: itunes <option>"
+ echo "Usage: $0 <option>"
echo "option:"
echo "\tlaunch|play|pause|stop|rewind|resume|quit"
echo "\tmute|unmute\tcontrol volume set"
echo "\tnext|previous\tplay next or previous track"
echo "\tshuf|shuffle [on|off|toggle]\tSet shuffled playback. Default: toggle. Note: toggle doesn't support the MiniPlayer."
- echo "\tvol\tSet the volume, takes an argument from 0 to 100"
- echo "\tplaying|status\tShow what song is currently playing in iTunes."
+ echo "\tvol [0-100|up|down]\tGet or set the volume. 0 to 100 sets the volume. 'up' / 'down' increases / decreases by 10 points. No argument displays current volume."
+ echo "\tplaying|status\tShow what song is currently playing in Music."
echo "\tplaylist [playlist name]\t Play specific playlist"
echo "\thelp\tshow this message and exit"
return 0
@@ -273,7 +334,7 @@ EOF
return 1
;;
esac
- osascript -e "tell application \"iTunes\" to $opt"
+ osascript -e "tell application \"$APP_NAME\" to $opt"
}
# Spotify control function
diff --git a/plugins/osx/spotify b/plugins/osx/spotify
index b4215dbe7..78d6c7d0f 100644
--- a/plugins/osx/spotify
+++ b/plugins/osx/spotify
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
function spotify() {
-# Copyright (c) 2012--2018 Harish Narayanan <mail@harishnarayanan.org>
+# Copyright (c) 2012--2019 Harish Narayanan <mail@harishnarayanan.org>
#
# Contains numerous helpful contributions from Jorge Colindres, Thomas
# Pritchard, iLan Epstein, Gabriele Bonetti, Sean Heller, Eric Martin
@@ -70,7 +70,7 @@ showHelp () {
echo;
echo " next # Skips to the next song in a playlist.";
echo " prev # Returns to the previous song in a playlist.";
- echo " replay # Replays the current track from the begining.";
+ echo " replay # Replays the current track from the beginning.";
echo " pos <time> # Jumps to a time (in secs) in the current song.";
echo " pause # Pauses (or resumes) Spotify playback.";
echo " stop # Stops playback.";
@@ -82,6 +82,9 @@ showHelp () {
echo " vol [show] # Shows the current Spotify volume.";
echo;
echo " status # Shows the current player status.";
+ echo " status artist # Shows the currently playing artist.";
+ echo " status album # Shows the currently playing album.";
+ echo " status track # Shows the currently playing track.";
echo;
echo " share # Displays the current song's Spotify URL and URI."
echo " share url # Displays the current song's Spotify URL and copies it to the clipboard."
@@ -99,12 +102,21 @@ cecho(){
echo $bold$green"$1"$reset;
}
+showArtist() {
+ echo `osascript -e 'tell application "Spotify" to artist of current track as string'`;
+}
+
+showAlbum() {
+ echo `osascript -e 'tell application "Spotify" to album of current track as string'`;
+}
+
+showTrack() {
+ echo `osascript -e 'tell application "Spotify" to name of current track as string'`;
+}
+
showStatus () {
state=`osascript -e 'tell application "Spotify" to player state as string'`;
cecho "Spotify is currently $state.";
- artist=`osascript -e 'tell application "Spotify" to artist of current track as string'`;
- album=`osascript -e 'tell application "Spotify" to album of current track as string'`;
- track=`osascript -e 'tell application "Spotify" to name of current track as string'`;
duration=`osascript -e 'tell application "Spotify"
set durSec to (duration of current track / 1000) as text
set tM to (round (durSec / 60) rounding down) as text
@@ -128,7 +140,7 @@ showStatus () {
end tell
return nowAt'`;
- echo -e $reset"Artist: $artist\nAlbum: $album\nTrack: $track \nPosition: $position / $duration";
+ echo -e $reset"Artist: $(showArtist)\nAlbum: $(showAlbum)\nTrack: $(showTrack) \nPosition: $position / $duration";
}
if [ $# = 0 ]; then
@@ -223,18 +235,18 @@ while [ $# -gt 0 ]; do
results=$( \
curl -s -G $SPOTIFY_SEARCH_API --data-urlencode "q=$Q" -d "type=playlist&limit=10&offset=0" -H "Accept: application/json" -H "Authorization: Bearer ${SPOTIFY_ACCESS_TOKEN}" \
- | grep -E -o "spotify:user:[a-zA-Z0-9_]+:playlist:[a-zA-Z0-9]+" -m 10 \
+ | grep -E -o "spotify:playlist:[a-zA-Z0-9]+" -m 10 \
)
count=$( \
- echo "$results" | grep -c "spotify:user" \
+ echo "$results" | grep -c "spotify:playlist" \
)
if [ "$count" -gt 0 ]; then
random=$(( $RANDOM % $count));
SPOTIFY_PLAY_URI=$( \
- echo "$results" | awk -v random="$random" '/spotify:user:[a-zA-Z0-9]+:playlist:[a-zA-Z0-9]+/{i++}i==random{print; exit}' \
+ echo "$results" | awk -v random="$random" '/spotify:playlist:[a-zA-Z0-9]+/{i++}i==random{print; exit}' \
)
fi;;
@@ -295,7 +307,7 @@ while [ $# -gt 0 ]; do
"quit" ) cecho "Quitting Spotify.";
osascript -e 'tell application "Spotify" to quit';
- exit 1 ;;
+ exit 0 ;;
"next" ) cecho "Going to next track." ;
osascript -e 'tell application "Spotify" to next track';
@@ -346,7 +358,7 @@ while [ $# -gt 0 ]; do
echo " vol down # Decreases the volume by 10%.";
echo " vol [amount] # Sets the volume to an amount between 0 and 100.";
echo " vol # Shows the current Spotify volume.";
- break
+ exit 1;
fi
osascript -e "tell application \"Spotify\" to set sound volume to $newvol";
@@ -365,7 +377,25 @@ while [ $# -gt 0 ]; do
break ;;
"status" )
- showStatus;
+ if [ $# != 1 ]; then
+ # There are additional arguments, a status subcommand
+ case $2 in
+ "artist" )
+ showArtist;
+ break ;;
+
+ "album" )
+ showAlbum;
+ break ;;
+
+ "track" )
+ showTrack;
+ break ;;
+ esac
+ else
+ # status is the only param
+ showStatus;
+ fi
break ;;
"info" )
@@ -428,16 +458,20 @@ while [ $# -gt 0 ]; do
cecho "Spotify URI: $uri";
echo -n $uri | pbcopy
fi
- break;;
+ break ;;
"pos" )
cecho "Adjusting Spotify play position."
osascript -e "tell application \"Spotify\" to set player position to $2";
- break;;
+ break ;;
- "help" | * )
+ "help" )
showHelp;
break ;;
+ * )
+ showHelp;
+ break;
+
esac
done
}
diff --git a/plugins/pass/README.md b/plugins/pass/README.md
new file mode 100644
index 000000000..2b0704981
--- /dev/null
+++ b/plugins/pass/README.md
@@ -0,0 +1,22 @@
+# pass
+
+This plugin provides completion for the [pass](https://www.passwordstore.org/) password manager.
+
+To use it, add `pass` to the plugins array in your zshrc file.
+
+```
+plugins=(... pass)
+```
+
+## Configuration
+
+### Multiple repositories
+
+If you use multiple repositories, you can configure completion like this:
+```zsh
+compdef _pass workpass
+zstyle ':completion::complete:workpass::' prefix "$HOME/work/pass"
+workpass() {
+ PASSWORD_STORE_DIR=$HOME/work/pass pass $@
+}
+```
diff --git a/plugins/per-directory-history/README.md b/plugins/per-directory-history/README.md
index ea445d329..69854aa38 100644
--- a/plugins/per-directory-history/README.md
+++ b/plugins/per-directory-history/README.md
@@ -1,55 +1,48 @@
-[Per-Directory-History][6]
-=========================
+per-directory-history plugin
+----------------------------
-Per directory history for zsh, as well as global history, and the
-ability to toggle between them with ^G.
+This plugin adds per-directory history for zsh, as well as a global history,
+and the ability to toggle between them with a keyboard shortcut. This is a
+bundle of the [official plugin by @jimhester][5].
-This is a implementation of per directory history for zsh, some
-implementations of which exist in bash[1][],[2][]. It also implements
-a per-directory-history-toggle-history function to change from using the
-directory history to using the global history. In both cases the history is
-always saved to both the global history and the directory history, so the
-toggle state will not effect the saved histories. Being able to switch
-between global and directory histories on the fly is a novel feature as far
-as I am aware.
+To use it, add `per-directory-history` to the plugins array in your zshrc file:
-This is a standalone repository for the script, however it is also included in
-[oh-my-zsh][4] as a plugin.
+```zsh
+plugins=(... per-directory-history)
+```
-----------------------------------------------------------------------------
-Usage
-----------------------------------------------------------------------------
+This is an implementation of per-directory history for zsh, some implementations
+of which exist in bash[1][],[2][]. It also implements a toggle-history function
+to change from using the directory history to using the global history. In both
+cases the history is always saved to both the global history and the directory
+history, so the toggle state will not effect the saved histories. Being able to
+switch between global and directory histories on the fly is a novel feature.
-1. Load this script into your interactive ZSH session:
+## Usage
- % source zsh-per-directory-history.zsh
+The default mode is per directory history, interact with your history as normal.
-2. The default mode if per directory history, interact with your history as normal.
+Press ^G (the <kbd>Control</kbd> and <kbd>G</kbd> keys simultaneously) to toggle
+between local and global histories. If you would prefer a different shortcut to
+toggle set the `PER_DIRECTORY_HISTORY_TOGGLE` environment variable.
-3. Press ^G (the Control and G keys simultaneously) to toggle between local
- and global histories. If you would prefer a different shortcut to toggle
- set the PER_DIRECTORY_HISTORY_TOGGLE environment variable.
+## Configuration
--------------------------------------------------------------------------------
-Configuration
--------------------------------------------------------------------------------
+* `HISTORY_BASE` is a global variable that defines the base directory in which the
+ directory histories are stored (default `$HOME/.directory_history`).
+* `per-directory-history-toggle-history` is the function to toggle between local
+ and global histories.
+* `PER_DIRECTORY_HISTORY_TOGGLE` is the key binding used to run the toggle-history
+ function above (default `^G`)
-* HISTORY_BASE a global variable that defines the base directory in which the
- directory histories are stored
-* per-directory-history-toggle-history is the function to toggle the history
-
--------------------------------------------------------------------------------
-History
--------------------------------------------------------------------------------
+## History
The idea/inspiration for a per directory history is from [Stewart MacArthur][1]
-and [Dieter][2], the implementation idea is from [Bart Schaefer][3]. The
-implementation is by [Jim Hester][5] in September 2012.
+and [Dieter][2], the implementation idea is from [Bart Schaefer][3]. The
+implementation is by [Jim Hester][4] in September 2012.
[1]: http://www.compbiome.com/2010/07/bash-per-directory-bash-history.html
[2]: http://dieter.plaetinck.be/per_directory_bash
[3]: https://www.zsh.org/mla/users/1997/msg00226.html
-[4]: https://github.com/robbyrussell/oh-my-zsh
-[5]: http://jimhester.com
-[6]: https://github.com/jimhester/per-directory-history
-
+[4]: https://jimhester.com
+[5]: https://github.com/jimhester/per-directory-history
diff --git a/plugins/percol/README.md b/plugins/percol/README.md
index b262e414e..ec5de4f86 100644
--- a/plugins/percol/README.md
+++ b/plugins/percol/README.md
@@ -1,6 +1,6 @@
## percol
-Provides some useful function to make [percol](https://github.com/mooz/percol) work with zsh history and [jump plugin](https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/jump/jump.plugin.zsh)
+Provides some useful function to make [percol](https://github.com/mooz/percol) work with zsh history and [jump plugin](https://github.com/ohmyzsh/ohmyzsh/blob/master/plugins/jump/jump.plugin.zsh)
### Requirements
@@ -8,7 +8,7 @@ Provides some useful function to make [percol](https://github.com/mooz/percol) w
pip install percol
```
-And [jump](https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/jump/jump.plugin.zsh) for `oh-my-zsh` is a optional requirement.
+And [jump](https://github.com/ohmyzsh/ohmyzsh/blob/master/plugins/jump/jump.plugin.zsh) for `oh-my-zsh` is a optional requirement.
### Usage
diff --git a/plugins/perl/README.md b/plugins/perl/README.md
new file mode 100644
index 000000000..dd9b7dc75
--- /dev/null
+++ b/plugins/perl/README.md
@@ -0,0 +1,37 @@
+# Perl
+
+This plugin adds [perl](https://www.perl.org/) useful aliases/functions.
+
+To use it, add `perl` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... perl)
+```
+
+## Aliases
+
+| Aliases | Command | Description |
+| :------------ | :----------------- | :------------------------------------- |
+| pbi | `perlbrew install` | Install specific perl version |
+| pbl | `perlbrew list` | List all perl version installed |
+| pbo | `perlbrew off` | Go back to the system perl |
+| pbs | `perlbrew switch` | Turn it back on |
+| pbu | `perlbrew use` | Use specific version of perl |
+| pd | `perldoc` | Show the perl documentation |
+| ple | `perl -wlne` | Use perl like awk/sed |
+| latest-perl | `curl ...` | Show the latest stable release of Perl |
+
+## Functions
+
+* `newpl`: creates a basic Perl script file and opens it with $EDITOR.
+
+* `pgs`: Perl Global Substitution: `pgs <find_pattern> <replace_pattern> <filename>`
+ Looks for `<find_pattern>` and replaces it with `<replace_pattern>` in `<filename>`.
+
+* `prep`: Perl grep, because 'grep -P' is terrible: `prep <pattern> [<filename>]`
+ Lets you work with pipes or files (if no `<filename>` provided, use stdin).
+
+## Requirements
+
+In order to make this work, you will need to have perl installed.
+More info on the usage and install: https://www.perl.org/get.html
diff --git a/plugins/phing/README.md b/plugins/phing/README.md
new file mode 100644
index 000000000..e2ac0bdf5
--- /dev/null
+++ b/plugins/phing/README.md
@@ -0,0 +1,8 @@
+# Phing plugin
+
+This plugin adds autocompletion for [`phing`](https://github.com/phingofficial/phing) targets.
+
+To use it, add `phing` to the plugins array of your `.zshrc` file:
+```
+plugins=(... eecms)
+```
diff --git a/plugins/pip/README.md b/plugins/pip/README.md
new file mode 100644
index 000000000..f07b5c058
--- /dev/null
+++ b/plugins/pip/README.md
@@ -0,0 +1,19 @@
+# pip plugin
+
+This plugin adds completion for [pip](https://pip.pypa.io/en/latest/),
+the Python package manager.
+
+To use it, add `pip` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... pip)
+```
+
+## pip cache
+
+The pip plugin caches the names of available pip packages from the PyPI index.
+To trigger the caching process, try to complete `pip install`,
+or you can run `zsh-pip-cache-packages` directly.
+
+To reset the cache, run `zsh-pip-clear-cache` and it will be rebuilt next
+the next time you autocomplete `pip install`.
diff --git a/plugins/pip/pip.plugin.zsh b/plugins/pip/pip.plugin.zsh
index d7236b02a..aaae90185 100644
--- a/plugins/pip/pip.plugin.zsh
+++ b/plugins/pip/pip.plugin.zsh
@@ -10,7 +10,7 @@
# "zsh-pip-clear-cache".
ZSH_PIP_CACHE_FILE=~/.pip/zsh-cache
-ZSH_PIP_INDEXES=(https://pypi.python.org/simple/)
+ZSH_PIP_INDEXES=(https://pypi.org/simple/)
zsh-pip-clear-cache() {
rm $ZSH_PIP_CACHE_FILE
@@ -29,9 +29,10 @@ zsh-pip-cache-packages() {
if [[ ! -f $ZSH_PIP_CACHE_FILE ]]; then
echo -n "(...caching package index...)"
tmp_cache=/tmp/zsh_tmp_cache
+ touch $tmp_cache
for index in $ZSH_PIP_INDEXES ; do
# well... I've already got two problems
- curl $index 2>/dev/null | \
+ curl -L $index 2>/dev/null | \
zsh-pip-clean-packages \
>> $tmp_cache
done
diff --git a/plugins/pipenv/README.md b/plugins/pipenv/README.md
new file mode 100644
index 000000000..ab1c1e442
--- /dev/null
+++ b/plugins/pipenv/README.md
@@ -0,0 +1,28 @@
+# Pipenv
+
+## Installation
+In your `.zshrc` file, add `pipenv` to the plugins section
+
+```
+plugins=(... pipenv ...)
+```
+
+## Features
+This plugin provides some features to simplify the use of Pipenv while working on ZSH.
+- Adds completion for pipenv
+- Auto activates and deactivates pipenv shell
+- Adds short aliases for common pipenv commands
+ - `pch` is aliased to `pipenv check`
+ - `pcl` is aliased to `pipenv clean`
+ - `pgr` is aliased to `pipenv graph`
+ - `pi` is aliased to `pipenv install`
+ - `pidev` is aliased to `pipenv install --dev`
+ - `pl` is aliased to `pipenv lock`
+ - `po` is aliased to `pipenv open`
+ - `prun` is aliased to `pipenv run`
+ - `psh` is aliased to `pipenv shell`
+ - `psy` is aliased to `pipenv sync`
+ - `pu` is aliased to `pipenv uninstall`
+ - `pwh` is aliased to `pipenv --where`
+ - `pvenv` is aliased to `pipenv --venv`
+ - `ppy` is aliased to `pipenv --py`
diff --git a/plugins/pipenv/pipenv.plugin.zsh b/plugins/pipenv/pipenv.plugin.zsh
new file mode 100644
index 000000000..ec41c3e02
--- /dev/null
+++ b/plugins/pipenv/pipenv.plugin.zsh
@@ -0,0 +1,43 @@
+# Pipenv completion
+_pipenv() {
+ eval $(env COMMANDLINE="${words[1,$CURRENT]}" _PIPENV_COMPLETE=complete-zsh pipenv)
+}
+compdef _pipenv pipenv
+
+# Automatic pipenv shell activation/deactivation
+_togglePipenvShell() {
+ # deactivate shell if Pipfile doesn't exist and not in a subdir
+ if [[ ! -a "$PWD/Pipfile" ]]; then
+ if [[ "$PIPENV_ACTIVE" == 1 ]]; then
+ if [[ "$PWD" != "$pipfile_dir"* ]]; then
+ exit
+ fi
+ fi
+ fi
+
+ # activate the shell if Pipfile exists
+ if [[ "$PIPENV_ACTIVE" != 1 ]]; then
+ if [[ -a "$PWD/Pipfile" ]]; then
+ export pipfile_dir="$PWD"
+ pipenv shell
+ fi
+ fi
+}
+autoload -U add-zsh-hook
+add-zsh-hook chpwd _togglePipenvShell
+
+# Aliases
+alias pch="pipenv check"
+alias pcl="pipenv clean"
+alias pgr="pipenv graph"
+alias pi="pipenv install"
+alias pidev="pipenv install --dev"
+alias pl="pipenv lock"
+alias po="pipenv open"
+alias prun="pipenv run"
+alias psh="pipenv shell"
+alias psy="pipenv sync"
+alias pu="pipenv uninstall"
+alias pwh="pipenv --where"
+alias pvenv="pipenv --venv"
+alias ppy="pipenv --py"
diff --git a/plugins/please/README.md b/plugins/please/README.md
new file mode 100644
index 000000000..89bfbf105
--- /dev/null
+++ b/plugins/please/README.md
@@ -0,0 +1,26 @@
+# please plugin
+
+[Please](https://please.build) is a cross-language build system with an emphasis on
+high performance, extensibility and reproduceability. It supports a number of popular
+languages and can automate nearly any aspect of your build process.
+
+This plugin adds autocomplete and major aliases for `plz`, the command line tool for
+Please.
+
+To use it, add `please` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... please)
+```
+
+## Aliases
+
+| Alias | Command |
+|-------|-------------|
+| `pb` | `plz build` |
+| `pt` | `plz test` |
+| `pw` | `plz watch` |
+
+## Maintainer
+
+[@thought-machine](https://github.com/thought-machine)
diff --git a/plugins/please/please.plugin.zsh b/plugins/please/please.plugin.zsh
new file mode 100644
index 000000000..0f58307ab
--- /dev/null
+++ b/plugins/please/please.plugin.zsh
@@ -0,0 +1,7 @@
+if (( $+commands[plz] )); then
+ source <(plz --completion_script)
+fi
+
+alias pb='plz build'
+alias pt='plz test'
+alias pw='plz watch'
diff --git a/plugins/pod/README.md b/plugins/pod/README.md
new file mode 100644
index 000000000..0a3cc7a36
--- /dev/null
+++ b/plugins/pod/README.md
@@ -0,0 +1,10 @@
+# pod
+
+This plugin adds completion for [`CocoaPods`](https://cocoapods.org/).
+CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects.
+
+To use it, add `pod` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... pod)
+```
diff --git a/plugins/pow/README.md b/plugins/pow/README.md
new file mode 100644
index 000000000..1f8a9d136
--- /dev/null
+++ b/plugins/pow/README.md
@@ -0,0 +1,21 @@
+# pow plugin
+
+This plugin adds completion and commands for [pow](http://pow.cx/), a
+zero-configuration Rack server for macOS.
+
+To use it, add pow to the plugins array of your zshrc file:
+
+```sh
+plugins=(... pow)
+```
+
+## Commands
+
+- `kapow` will restart an app.
+
+ ```bash
+ kapow myapp
+ ```
+
+- `kaput` will show the standard output from any pow app.
+- `repow` will restart the pow process.
diff --git a/plugins/powder/README.md b/plugins/powder/README.md
new file mode 100644
index 000000000..a83b1f2d3
--- /dev/null
+++ b/plugins/powder/README.md
@@ -0,0 +1,8 @@
+# Powder
+
+This plugin provides completion for [powder](https://github.com/powder-rb/powder/).
+
+To use it, add powder to the plugins array of your zshrc file:
+```
+plugins=(... powder)
+```
diff --git a/plugins/powify/README.md b/plugins/powify/README.md
new file mode 100644
index 000000000..fd58b860e
--- /dev/null
+++ b/plugins/powify/README.md
@@ -0,0 +1,10 @@
+# powify plugin
+
+This plugin adds autocompletion for [powify](https://github.com/sethvargo/powify),
+an easy-to-use wrapper for Basecamp's [pow](https://github.com/basecamp/pow).
+
+To use it, add powify to the plugins array of your zshrc file:
+
+```sh
+plugins=(... powify)
+```
diff --git a/plugins/profiles/README.md b/plugins/profiles/README.md
new file mode 100644
index 000000000..5aa1918e2
--- /dev/null
+++ b/plugins/profiles/README.md
@@ -0,0 +1,25 @@
+# profiles plugin
+
+This plugin allows you to create separate configuration files for zsh based
+on your long hostname (including the domain).
+
+To use it, add profiles to the plugins array of your zshrc file:
+
+```sh
+plugins=(... profiles)
+```
+
+It takes your `$HOST` variable and looks for files named according to the
+domain parts in `$ZSH_CUSTOM/profiles/` directory.
+
+For example, for `HOST=host.domain.com`, it will try to load the following files,
+in this order:
+
+```text
+$ZSH_CUSTOM/profiles/com
+$ZSH_CUSTOM/profiles/domain.com
+$ZSH_CUSTOM/profiles/host.domain.com
+```
+
+This means that if there are conflicting settings on those files, the one to take
+precedence will be the last applied, i.e. the one in host.domain.com.
diff --git a/plugins/pyenv/README.md b/plugins/pyenv/README.md
new file mode 100644
index 000000000..d063b55b9
--- /dev/null
+++ b/plugins/pyenv/README.md
@@ -0,0 +1,16 @@
+# pyenv
+
+This plugin looks for [pyenv](https://github.com/pyenv/pyenv), a Simple Python version
+management system, and loads it if it's found. It also loads pyenv-virtualenv, a pyenv
+plugin to manage virtualenv, if it's found.
+
+To use it, add `pyenv` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... pyenv)
+```
+
+## Functions
+
+- `pyenv_prompt_info`: displays the Python version in use by pyenv; or the global Python
+ version, if pyenv wasn't found.
diff --git a/plugins/pyenv/pyenv.plugin.zsh b/plugins/pyenv/pyenv.plugin.zsh
index 4e92b8017..40e58b5c2 100644
--- a/plugins/pyenv/pyenv.plugin.zsh
+++ b/plugins/pyenv/pyenv.plugin.zsh
@@ -38,4 +38,4 @@ else
}
fi
-unset FOUND_PYENV dir
+unset FOUND_PYENV pyenvdirs dir
diff --git a/plugins/python/python.plugin.zsh b/plugins/python/python.plugin.zsh
index f754ea261..f39cd80b7 100644
--- a/plugins/python/python.plugin.zsh
+++ b/plugins/python/python.plugin.zsh
@@ -1,15 +1,16 @@
# Find python file
alias pyfind='find . -name "*.py"'
-# Remove python compiled byte-code and mypy cache in either current directory or in a
-# list of specified directories
+# Remove python compiled byte-code and mypy/pytest cache in either the current
+# directory or in a list of specified directories (including sub directories).
function pyclean() {
ZSH_PYCLEAN_PLACES=${*:-'.'}
find ${ZSH_PYCLEAN_PLACES} -type f -name "*.py[co]" -delete
find ${ZSH_PYCLEAN_PLACES} -type d -name "__pycache__" -delete
- find ${ZSH_PYCLEAN_PLACES} -type d -name ".mypy_cache" -delete
+ find ${ZSH_PYCLEAN_PLACES} -depth -type d -name ".mypy_cache" -exec rm -r "{}" +
+ find ${ZSH_PYCLEAN_PLACES} -depth -type d -name ".pytest_cache" -exec rm -r "{}" +
}
# Grep among .py files
-alias pygrep='grep --include="*.py"'
+alias pygrep='grep -r --include="*.py"'
diff --git a/plugins/rails/README.md b/plugins/rails/README.md
new file mode 100644
index 000000000..ad83fffe8
--- /dev/null
+++ b/plugins/rails/README.md
@@ -0,0 +1,83 @@
+# Rails
+
+This plugin adds completion for [Ruby On Rails Framework](https://rubyonrails.org/) and [Rake](https://ruby.github.io/rake/) commands, as well as some aliases for logs and environment variables.
+
+To use it, add `rails` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... rails)
+```
+
+## List of Aliases
+
+### Rails aliases
+
+| Alias | Command | Description |
+|-------|----------------------------|----------------------------------------------------|
+| `rc` | `rails console` | Interact with your Rails app from the CLI |
+| `rcs` | `rails console --sandbox` | Test code in a sandbox, without changing any data |
+| `rd` | `rails destroy` | Undo a generate operation |
+| `rdb` | `rails dbconsole` | Interact with your db from the console |
+| `rgen`| `rails generate` | Generate boilerplate code |
+| `rgm` | `rails generate migration` | Generate a db migration |
+| `rp` | `rails plugin` | Run a Rails plugin command |
+| `ru` | `rails runner` | Run Ruby code in the context of Rails |
+| `rs` | `rails server` | Launch a web server |
+| `rsd` | `rails server --debugger` | Launch a web server with debugger |
+| `rsp` | `rails server --port` | Launch a web server and specify the listening port |
+
+### Rake aliases
+
+| Alias | Command | Description |
+|---------|---------------------------------|--------------------------------------------------------|
+| `rdm` | `rake db:migrate` | Run pending db migrations |
+| `rdms` | `rake db:migrate:status` | Show current db migration status |
+| `rdmtc` | `rake db:migrate db:test:clone` | Run pending migrations and clone db into test database |
+| `rdr` | `rake db:rollback` | Roll back the last migration |
+| `rdc` | `rake db:create` | Create the database |
+| `rds` | `rake db:seed` | Seed the database |
+| `rdd` | `rake db:drop` | Delete the database |
+| `rdrs` | `rake db:reset` | Delete the database and set it up again |
+| `rdtc` | `rake db:test:clone` | Clone the database into the test database |
+| `rdtp` | `rake db:test:prepare` | Duplicate the db schema into your test database |
+| `rdsl` | `rake db:schema:load` | Load the database schema |
+| `rlc` | `rake log:clear` | Clear Rails logs |
+| `rn` | `rake notes` | Search for notes (`FIXME`, `TODO`) in code comments |
+| `rr` | `rake routes` | List all defined routes |
+| `rrg` | `rake routes \| grep` | List and filter the defined routes |
+| `rt` | `rake test` | Run Rails tests |
+| `rmd` | `rake middleware` | Interact with Rails middlewares |
+| `rsts` | `rake stats` | Print code statistics |
+
+### Utility aliases
+
+| Alias | Command | Description |
+|-----------|-------------------------------|------------------------------------------------|
+| `devlog` | `tail -f log/development.log` | Show and follow changes to the development log |
+| `prodlog` | `tail -f log/production.log` | Show and follow changes to the production log |
+| `testlog` | `tail -f log/test.log` | Show and follow changes to the test log |
+
+### Environment settings
+
+| Alias | Command | Description |
+|-------|-------------------------|---------------------------------|
+| `RED` | `RAILS_ENV=development` | Sets `RAILS_ENV` to development |
+| `REP` | `RAILS_ENV=production` | Sets `RAILS_ENV` to production |
+| `RET` | `RAILS_ENV=test` | Sets `RAILS_ENV` to test |
+
+These are global aliases. Use in combination with a command or just run them
+separately. For example: `REP rake db:migrate` will migrate the production db.
+
+### Legacy stuff
+
+| Alias | Command |
+|---------|------------------------------------|
+| `sstat` | `thin --stats "/thin/stats" start` |
+| `sg` | `ruby script/generate` |
+| `sd` | `ruby script/destroy` |
+| `sp` | `ruby script/plugin` |
+| `sr` | `ruby script/runner` |
+| `ssp` | `ruby script/spec` |
+| `sc` | `ruby script/console` |
+| `sd` | `ruby script/server --debugger` |
+
diff --git a/plugins/rails/rails.plugin.zsh b/plugins/rails/rails.plugin.zsh
index eb3f30360..1fd5f0f86 100644
--- a/plugins/rails/rails.plugin.zsh
+++ b/plugins/rails/rails.plugin.zsh
@@ -17,7 +17,7 @@ function _rake_command () {
bin/stubs/rake $@
elif [ -e "bin/rake" ]; then
bin/rake $@
- elif type bundle &> /dev/null && [ -e "Gemfile" ]; then
+ elif type bundle &> /dev/null && ([ -e "Gemfile" ] || [ -e "gems.rb" ]); then
bundle exec rake $@
else
command rake $@
@@ -43,7 +43,7 @@ alias rc='rails console'
alias rcs='rails console --sandbox'
alias rd='rails destroy'
alias rdb='rails dbconsole'
-alias rg='rails generate'
+alias rgen='rails generate'
alias rgm='rails generate migration'
alias rp='rails plugin'
alias ru='rails runner'
diff --git a/plugins/rake/README.md b/plugins/rake/README.md
new file mode 100644
index 000000000..e888c0785
--- /dev/null
+++ b/plugins/rake/README.md
@@ -0,0 +1,37 @@
+# Rake plugin
+
+This plugin adds support for [rake](https://ruby.github.io/rake/), the Ruby
+build tool or Ruby Make.
+
+To use it, add `rake` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... rake)
+```
+
+## Aliases
+
+The plugin aliases the rake command so you can pass arguments when invoking rake tasks
+without having to escape the brackets, i.e., you can run
+```
+rake namespace:task['argument']
+```
+instead of having to do
+```
+rake namespace:task\['argument'\]
+```
+
+| Alias | Command | Description |
+|--------|--------------------------------|-----------------------------------------------|
+| rake | `noglob rake` | Allows unescaped square brackets |
+| brake | `noglob bundle exec rake` | Same as above but call rake using bundler |
+| srake | `noglob sudo rake` | Same as rake but using sudo |
+| sbrake | `noglob sudo bundle exec rake` | Same as above but using both sudo and bundler |
+
+## Jim Weirich
+
+The plugin also aliases `rake` to [`jimweirich`](https://github.com/jimweirich), author of Rake
+and big time contributor to the Ruby open source community. He passed away in 2014:
+
+> Thank you Jim for everything you contributed to the Ruby and open source community
+> over the years. We will miss you dearly. — [**@robbyrussell**](https://github.com/ohmyzsh/ohmyzsh/commit/598a9c6f990756386517d66b6bcf77e53791e905)
diff --git a/plugins/rbenv/README.md b/plugins/rbenv/README.md
new file mode 100644
index 000000000..43a2e93ac
--- /dev/null
+++ b/plugins/rbenv/README.md
@@ -0,0 +1,26 @@
+# rbenv plugin
+
+The primary job of this plugin is to provide `rbenv_prompt_info` which can be added to your theme to include Ruby
+version and gemset information into your prompt.
+
+Some functionality of this plugin will not work unless you also have the rbenv plugin *gemset* installed.
+https://github.com/jf/rbenv-gemset
+
+To use it, add `rbenv` to the plugins array in your zshrc file:
+```zsh
+plugins=(... rbenv)
+```
+
+## Alias
+
+| Alias | Command | Description |
+|----------------|---------------------|----------------------------------|
+| rubies | `rbenv versions` | List the installed Ruby versions |
+| gemsets | `rbenv gemset list` | List the existing gemsets |
+
+## Functions
+
+* `current_ruby`: The version of Ruby currently being used.
+* `current_gemset`: The name of the current gemset.
+* `gems`: Lists installed gems with enhanced formatting and color.
+* `rbenv_prompt_info`: For adding information to your prompt. Format: `<ruby version>@<current gemset>`.
diff --git a/plugins/rbenv/rbenv.plugin.zsh b/plugins/rbenv/rbenv.plugin.zsh
index 7430e9625..ed46d355b 100644
--- a/plugins/rbenv/rbenv.plugin.zsh
+++ b/plugins/rbenv/rbenv.plugin.zsh
@@ -1,60 +1,65 @@
-_homebrew-installed() {
- type brew &> /dev/null
-}
-
-FOUND_RBENV=0
-rbenvdirs=("$HOME/.rbenv" "/usr/local/rbenv" "/opt/rbenv" "/usr/local/opt/rbenv")
-if _homebrew-installed && rbenv_homebrew_path=$(brew --prefix rbenv 2>/dev/null); then
- rbenvdirs=($rbenv_homebrew_path "${rbenvdirs[@]}")
- unset rbenv_homebrew_path
- if [[ $RBENV_ROOT = '' ]]; then
- RBENV_ROOT="$HOME/.rbenv"
- fi
+# This plugin loads rbenv into the current shell and provides prompt info via
+# the 'rbenv_prompt_info' function.
+
+FOUND_RBENV=$+commands[rbenv]
+
+if [[ $FOUND_RBENV -ne 1 ]]; then
+ rbenvdirs=("$HOME/.rbenv" "/usr/local/rbenv" "/opt/rbenv" "/usr/local/opt/rbenv")
+ for dir in $rbenvdirs; do
+ if [[ -d $dir/bin ]]; then
+ export PATH="$dir/bin:$PATH"
+ FOUND_RBENV=1
+ break
+ fi
+ done
fi
-for rbenvdir in "${rbenvdirs[@]}" ; do
- if [ -d $rbenvdir/bin -a $FOUND_RBENV -eq 0 ] ; then
- FOUND_RBENV=1
- if [[ $RBENV_ROOT = '' ]]; then
- RBENV_ROOT=$rbenvdir
+if [[ $FOUND_RBENV -ne 1 ]]; then
+ if (( $+commands[brew] )) && dir=$(brew --prefix rbenv 2>/dev/null); then
+ if [[ -d $dir/bin ]]; then
+ export PATH="$dir/bin:$PATH"
+ FOUND_RBENV=1
+ fi
fi
- export RBENV_ROOT
- export PATH=${rbenvdir}/bin:$PATH
+fi
+
+if [[ $FOUND_RBENV -eq 1 ]]; then
eval "$(rbenv init --no-rehash - zsh)"
alias rubies="rbenv versions"
alias gemsets="rbenv gemset list"
function current_ruby() {
- echo "$(rbenv version-name)"
+ echo "$(rbenv version-name)"
}
function current_gemset() {
- echo "$(rbenv gemset active 2&>/dev/null | sed -e ":a" -e '$ s/\n/+/gp;N;b a' | head -n1)"
+ echo "$(rbenv gemset active 2&>/dev/null | sed -e ":a" -e '$ s/\n/+/gp;N;b a' | head -n1)"
}
- function gems {
- local rbenv_path=$(rbenv prefix)
- gem list $@ | sed -E \
- -e "s/\([0-9a-z, \.]+( .+)?\)/$fg[blue]&$reset_color/g" \
- -e "s|$(echo $rbenv_path)|$fg[magenta]\$rbenv_path$reset_color|g" \
- -e "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \
- -e "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g"
+ function gems() {
+ local rbenv_path=$(rbenv prefix)
+ gem list $@ | sed -E \
+ -e "s/\([0-9a-z, \.]+( .+)?\)/$fg[blue]&$reset_color/g" \
+ -e "s|$(echo $rbenv_path)|$fg[magenta]\$rbenv_path$reset_color|g" \
+ -e "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \
+ -e "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g"
}
function rbenv_prompt_info() {
- if [[ -n $(current_gemset) ]] ; then
- echo "$(current_ruby)@$(current_gemset)"
- else
- echo "$(current_ruby)"
- fi
+ if [[ -n $(current_gemset) ]] ; then
+ echo "$(current_ruby)@$(current_gemset)"
+ else
+ echo "$(current_ruby)"
+ fi
}
- fi
-done
-unset rbenvdir
-
-if [ $FOUND_RBENV -eq 0 ] ; then
- alias rubies='ruby -v'
- function gemsets() { echo 'not supported' }
- function rbenv_prompt_info() { echo "system: $(ruby -v | cut -f-2 -d ' ')" }
+else
+ alias rubies="ruby -v"
+ function gemsets() { echo "not supported" }
+ function current_ruby() { echo "not supported" }
+ function current_gemset() { echo "not supported" }
+ function gems() { echo "not supported" }
+ function rbenv_prompt_info() { echo "system: $(ruby -v | cut -f-2 -d ' ')" }
fi
+
+unset FOUND_RBENV rbenvdirs dir
diff --git a/plugins/react-native/README.md b/plugins/react-native/README.md
index 0cfaa36b4..d0a53b8d7 100644
--- a/plugins/react-native/README.md
+++ b/plugins/react-native/README.md
@@ -16,40 +16,61 @@ plugins=(... react-native)
| **rn** | `react-native` |
| **rns** | `react-native start` |
| **rnlink** | `react-native link` |
-| _App testing_ |
+| _Logging_ | |
+| **rnland** | `react-native log-android` |
+| **rnlios** | `react-native log-ios` |
+| _App Testing_ | |
| **rnand** | `react-native run-android` |
| **rnios** | `react-native run-ios` |
+| _iPhone_ | |
| **rnios4s** | `react-native run-ios --simulator "iPhone 4s"` |
| **rnios5** | `react-native run-ios --simulator "iPhone 5"` |
| **rnios5s** | `react-native run-ios --simulator "iPhone 5s"` |
| **rnios6** | `react-native run-ios --simulator "iPhone 6"` |
| **rnios6s** | `react-native run-ios --simulator "iPhone 6s"` |
-| **rnios7** | `react-native run-ios --simulator "iPhone7"` |
+| **rnios6p** | `react-native run-ios --simulator "iPhone 6 Plus"` |
+| **rnios6sp** | `react-native run-ios --simulator "iPhone 6s Plus"` |
+| **rnios7** | `react-native run-ios --simulator "iPhone 7"` |
| **rnios7p** | `react-native run-ios --simulator "iPhone 7 Plus"` |
| **rnios8** | `react-native run-ios --simulator "iPhone 8"` |
| **rnios8p** | `react-native run-ios --simulator "iPhone 8 Plus"` |
| **rniosse** | `react-native run-ios --simulator "iPhone SE"` |
| **rniosx** | `react-native run-ios --simulator "iPhone X"` |
-| **rniosxs** | `react-native run-ios --simulator "iPhone XS"` |
-| **rniosxsm** | `react-native run-ios --simulator "iPhone XS Max"` |
-| **rniosxr** | `react-native run-ios --simulator "iPhone XR"` |
-| _iPads_ | |
+| **rniosxs** | `react-native run-ios --simulator "iPhone Xs"` |
+| **rniosxsm** | `react-native run-ios --simulator "iPhone Xs Max"` |
+| **rniosxr** | `react-native run-ios --simulator "iPhone Xʀ"` |
+| **rnios11** | `react-native run-ios --simulator "iPhone 11"` |
+| **rnios11p** | `react-native run-ios --simulator "iPhone 11 Pro"` |
+| **rnios11pm** | `react-native run-ios --simulator "iPhone 11 Pro Max"` |
+| _iPad_ | |
| **rnipad2** | `react-native run-ios --simulator "iPad 2"` |
+| **rnipad5** | `react-native run-ios --simulator "iPad (5th generation)"` |
+| **rnipad6** | `react-native run-ios --simulator "iPad (6th generation)"` |
| **rnipadr** | `react-native run-ios --simulator "iPad Retina"` |
-| **rnipada** | 'react-native run-ios --simulator "iPad Air"' |
-| **rnipada2** | 'react-native run-ios --simulator "iPad Air 2"' |
-| **rnipad5** | 'react-native run-ios --simulator "iPad (5th generation)"' |
-| **rnipad9** | 'react-native run-ios --simulator "iPad Pro (9.7-inch)"' |
-| **rnipad12** | 'react-native run-ios --simulator "iPad Pro (12.9-inch)"' |
-| **rnipad122** | 'react-native run-ios --simulator "iPad Pro (12.9-inch) (2nd generation)"' |
-| **rnipad10** | 'react-native run-ios --simulator "iPad Pro (10.5-inch)"' |
-| **rnipad6** | 'react-native run-ios --simulator "iPad Pro (6th generation)"' |
-| **rnipad11** | 'react-native run-ios --simulator "iPad Pro (11-inch)"' |
-| **rnipad123** | 'react-native run-ios --simulator "iPad Pro (12.9-inch) (3rd generation)"' |
-| _Apple TVs_ | |
+| **rnipada** | `react-native run-ios --simulator "iPad Air"` |
+| **rnipada2** | `react-native run-ios --simulator "iPad Air 2"` |
+| **rnipada3** | `react-native run-ios --simulator "iPad Air (3rd generation)"` |
+| **rnipadm2** | `react-native run-ios --simulator "iPad mini 2"` |
+| **rnipadm3** | `react-native run-ios --simulator "iPad mini 3"` |
+| **rnipadm4** | `react-native run-ios --simulator "iPad mini 4"` |
+| **rnipadm5** | `react-native run-ios --simulator "iPad mini (5th generation)"` |
+| **rnipadp9** | `react-native run-ios --simulator "iPad Pro (9.7-inch)"` |
+| **rnipadp12** | `react-native run-ios --simulator "iPad Pro (12.9-inch)"` |
+| **rnipadp122** | `react-native run-ios --simulator "iPad Pro (12.9-inch) (2nd generation)"` |
+| **rnipadp10** | `react-native run-ios --simulator "iPad Pro (10.5-inch)"` |
+| **rnipad11** | `react-native run-ios --simulator "iPad Pro (11-inch)"` |
+| **rnipad123** | `react-native run-ios --simulator "iPad Pro (12.9-inch) (3rd generation)"` |
+| _Apple TV_ | |
| **rnatv** | `react-native run-ios --simulator "Apple TV"` |
| **rnatv4k** | `react-native run-ios --simulator "Apple TV 4K"` |
| **rnatv4k1080**| `react-native run-ios --simulator "Apple TV 4K (at 1080p)"` |
-| _Logging_ |
-| **rnland** | `react-native log-android` |
-| **rnlios** | `react-native log-ios` |
+| **rnipad123** | `react-native run-ios --simulator "iPad Pro (12.9-inch) (3rd generation)"` |
+| _Apple Watch_ | |
+| **rnaw38** | `react-native run-ios --simulator "Apple Watch - 38mm"` |
+| **rnaw42** | `react-native run-ios --simulator "Apple Watch - 42mm"` |
+| **rnaws238** | `react-native run-ios --simulator "Apple Watch Series 2 - 38mm"` |
+| **rnaws242** | `react-native run-ios --simulator "Apple Watch Series 2 - 42mm"` |
+| **rnaws338** | `react-native run-ios --simulator "Apple Watch Series 3 - 38mm"` |
+| **rnaws342** | `react-native run-ios --simulator "Apple Watch Series 3 - 42mm"` |
+| **rnaws440** | `react-native run-ios --simulator "Apple Watch Series 4 - 40mm"` |
+| **rnaws444** | `react-native run-ios --simulator "Apple Watch Series 4 - 44mm"` |
diff --git a/plugins/react-native/react-native.plugin.zsh b/plugins/react-native/react-native.plugin.zsh
index a4092a694..b33dedfed 100644
--- a/plugins/react-native/react-native.plugin.zsh
+++ b/plugins/react-native/react-native.plugin.zsh
@@ -1,40 +1,64 @@
+# React Native
alias rn='react-native'
alias rns='react-native start'
alias rnlink='react-native link'
-
+alias rnland='react-native log-android'
+alias rnlios='react-native log-ios'
alias rnand='react-native run-android'
alias rnios='react-native run-ios'
+
+# iPhone
alias rnios4s='react-native run-ios --simulator "iPhone 4s"'
alias rnios5='react-native run-ios --simulator "iPhone 5"'
alias rnios5s='react-native run-ios --simulator "iPhone 5s"'
alias rnios6='react-native run-ios --simulator "iPhone 6"'
+alias rnios6p='react-native run-ios --simulator "iPhone 6 Plus"'
alias rnios6s='react-native run-ios --simulator "iPhone 6s"'
+alias rnios6sp='react-native run-ios --simulator "iPhone 6s Plus"'
alias rnios7='react-native run-ios --simulator "iPhone 7"'
alias rnios7p='react-native run-ios --simulator "iPhone 7 Plus"'
alias rnios8='react-native run-ios --simulator "iPhone 8"'
alias rnios8p='react-native run-ios --simulator "iPhone 8 Plus"'
alias rniosse='react-native run-ios --simulator "iPhone SE"'
alias rniosx='react-native run-ios --simulator "iPhone X"'
-alias rniosxs='react-native run-ios --simulator "iPhone XS"'
-alias rniosxsm='react-native run-ios --simulator "iPhone XS Max"'
-alias rniosxr='react-native run-ios --simulator "iPhone XR"'
+alias rniosxs='react-native run-ios --simulator "iPhone Xs"'
+alias rniosxsm='react-native run-ios --simulator "iPhone Xs Max"'
+alias rniosxr='react-native run-ios --simulator "iPhone Xʀ"'
+alias rnios11='react-native run-ios --simulator "iPhone 11"'
+alias rnios11p='react-native run-ios --simulator "iPhone 11 Pro"'
+alias rnios11pm='react-native run-ios --simulator "iPhone 11 Pro Max"'
+
+# iPad
alias rnipad2='react-native run-ios --simulator "iPad 2"'
+alias rnipad5='react-native run-ios --simulator "iPad (5th generation)"'
+alias rnipad6='react-native run-ios --simulator "iPad (6th generation)"'
alias rnipadr='react-native run-ios --simulator "iPad Retina"'
alias rnipada='react-native run-ios --simulator "iPad Air"'
alias rnipada2='react-native run-ios --simulator "iPad Air 2"'
-alias rnipad5='react-native run-ios --simulator "iPad (5th generation)"'
-alias rnipad9='react-native run-ios --simulator "iPad Pro (9.7-inch)"'
-alias rnipad12='react-native run-ios --simulator "iPad Pro (12.9-inch)"'
-alias rnipad122='react-native run-ios --simulator "iPad Pro (12.9-inch) (2nd generation)"'
-alias rnipad10='react-native run-ios --simulator "iPad Pro (10.5-inch)"'
-alias rnipad6='react-native run-ios --simulator "iPad Pro (6th generation)"'
+alias rnipada3='react-native run-ios --simulator "iPad Air (3rd generation)"'
+alias rnipadm2='react-native run-ios --simulator "iPad mini 2"'
+alias rnipadm3='react-native run-ios --simulator "iPad mini 3"'
+alias rnipadm4='react-native run-ios --simulator "iPad mini 4"'
+alias rnipadm5='react-native run-ios --simulator "iPad mini (5th generation)"'
+alias rnipadp9='react-native run-ios --simulator "iPad Pro (9.7-inch)"'
+alias rnipadp12='react-native run-ios --simulator "iPad Pro (12.9-inch)"'
+alias rnipadp122='react-native run-ios --simulator "iPad Pro (12.9-inch) (2nd generation)"'
+alias rnipadp10='react-native run-ios --simulator "iPad Pro (10.5-inch)"'
alias rnipad11='react-native run-ios --simulator "iPad Pro (11-inch)"'
alias rnipad123='react-native run-ios --simulator "iPad Pro (12.9-inch) (3rd generation)"'
+# Apple TV
alias rnatv='react-native run-ios --simulator "Apple TV"'
alias rnatv4k='react-native run-ios --simulator "Apple TV 4K"'
alias rnatv4k1080='react-native run-ios --simulator "Apple TV 4K (at 1080p)"'
-alias rnland='react-native log-android'
-alias rnlios='react-native log-ios'
+# Apple Watch
+alias rnaw38='react-native run-ios --simulator "Apple Watch - 38mm"'
+alias rnaw42='react-native run-ios --simulator "Apple Watch - 42mm"'
+alias rnaws238='react-native run-ios --simulator "Apple Watch Series 2 - 38mm"'
+alias rnaws242='react-native run-ios --simulator "Apple Watch Series 2 - 42mm"'
+alias rnaws338='react-native run-ios --simulator "Apple Watch Series 3 - 38mm"'
+alias rnaws342='react-native run-ios --simulator "Apple Watch Series 3 - 42mm"'
+alias rnaws440='react-native run-ios --simulator "Apple Watch Series 4 - 40mm"'
+alias rnaws444='react-native run-ios --simulator "Apple Watch Series 4 - 44mm"'
diff --git a/plugins/rebar/README.md b/plugins/rebar/README.md
new file mode 100644
index 000000000..456ba45c7
--- /dev/null
+++ b/plugins/rebar/README.md
@@ -0,0 +1,9 @@
+# rebar plugin
+
+This plugin adds completions for the [rebar](https://www.rebar3.org/) Erlang build tool.
+
+To use it, add `rebar` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... rebar)
+```
diff --git a/plugins/redis-cli/README.md b/plugins/redis-cli/README.md
new file mode 100644
index 000000000..bb6e94a0f
--- /dev/null
+++ b/plugins/redis-cli/README.md
@@ -0,0 +1,15 @@
+# Redis-CLI
+
+This plugin adds [redis-cli](https://redis.io/topics/rediscli) completion, based off of Homebrew completion.
+
+To use it, add `redis-cli` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... redis-cli)
+```
+
+## Requirements
+
+In order to make this work, you will need to have redis installed.
+
+More info on the usage and install: https://redis.io/topics/quickstart
diff --git a/plugins/ripgrep/README.md b/plugins/ripgrep/README.md
index 794b105ee..937f73c81 100644
--- a/plugins/ripgrep/README.md
+++ b/plugins/ripgrep/README.md
@@ -8,6 +8,6 @@ To use it, add `ripgrep` to the plugins array in your zshrc file:
plugins=(... ripgrep)
```
-Completion is taken from the ripgrep release [`0.10.0`](https://github.com/BurntSushi/ripgrep/releases/tag/0.10.0).
+Completion is taken from the ripgrep release [`11.0.2`](https://github.com/BurntSushi/ripgrep/releases/tag/11.0.2).
-Updated on September 27th, 2018.
+Updated on August 16th, 2019.
diff --git a/plugins/ripgrep/_ripgrep b/plugins/ripgrep/_ripgrep
index 53f135dde..d7dcfd64a 100644
--- a/plugins/ripgrep/_ripgrep
+++ b/plugins/ripgrep/_ripgrep
@@ -3,6 +3,12 @@
##
# zsh completion function for ripgrep
#
+# Run ci/test_complete.sh after building to ensure that the options supported by
+# this function stay in synch with the `rg` binary.
+#
+# For convenience, a completion reference guide is included at the bottom of
+# this file.
+#
# Originally based on code from the zsh-users project — see copyright notice
# below.
@@ -37,6 +43,7 @@ _rg() {
+ '(exclusive)' # Misc. fully exclusive options
'(: * -)'{-h,--help}'[display help information]'
'(: * -)'{-V,--version}'[display version information]'
+ '(: * -)'--pcre2-version'[print the version of PCRE2 used by ripgrep, if available]'
+ '(buffered)' # buffering options
'--line-buffered[force line buffering]'
@@ -79,7 +86,7 @@ _rg() {
+ '(file-name)' # File-name options
{-H,--with-filename}'[show file name for matches]'
- "--no-filename[don't show file name for matches]"
+ {-I,--no-filename}"[don't show file name for matches]"
+ '(file-system)' # File system options
"--one-file-system[don't descend into directories on other file systems]"
@@ -97,6 +104,10 @@ _rg() {
'*'{-g+,--glob=}'[include/exclude files matching specified glob]:glob'
'*--iglob=[include/exclude files matching specified case-insensitive glob]:glob'
+ + '(glob-case-insensitive)' # File-glob case sensitivity options
+ '--glob-case-insensitive[treat -g/--glob patterns case insensitively]'
+ $no'--no-glob-case-insensitive[treat -g/--glob patterns case sensitively]'
+
+ '(heading)' # Heading options
'(pretty-vimgrep)--heading[show matches grouped by file name]'
"(pretty-vimgrep)--no-heading[don't show matches grouped by file name]"
@@ -105,9 +116,17 @@ _rg() {
'--hidden[search hidden files and directories]'
$no"--no-hidden[don't search hidden files and directories]"
+ + '(hybrid)' # hybrid regex options
+ '--auto-hybrid-regex[dynamically use PCRE2 if necessary]'
+ $no"--no-auto-hybrid-regex[don't dynamically use PCRE2 if necessary]"
+
+ '(ignore)' # Ignore-file options
- "(--no-ignore-global --no-ignore-parent --no-ignore-vcs)--no-ignore[don't respect ignore files]"
- $no'(--ignore-global --ignore-parent --ignore-vcs)--ignore[respect ignore files]'
+ "(--no-ignore-global --no-ignore-parent --no-ignore-vcs --no-ignore-dot)--no-ignore[don't respect ignore files]"
+ $no'(--ignore-global --ignore-parent --ignore-vcs --ignore-dot)--ignore[respect ignore files]'
+
+ + '(ignore-file-case-insensitive)' # Ignore-file case sensitivity options
+ '--ignore-file-case-insensitive[process ignore files case insensitively]'
+ $no'--no-ignore-file-case-insensitive[process ignore files case sensitively]'
+ '(ignore-global)' # Global ignore-file options
"--no-ignore-global[don't respect global ignore files]"
@@ -121,6 +140,10 @@ _rg() {
"--no-ignore-vcs[don't respect version control ignore files]"
$no'--ignore-vcs[respect version control ignore files]'
+ + '(ignore-dot)' # .ignore-file options
+ "--no-ignore-dot[don't respect .ignore files]"
+ $no'--ignore-dot[respect .ignore files]'
+
+ '(json)' # JSON options
'--json[output results in JSON Lines format]'
$no"--no-json[don't output results in JSON Lines format]"
@@ -134,6 +157,10 @@ _rg() {
$no"--no-crlf[don't use CRLF as line terminator]"
'(text)--null-data[use NUL as line terminator]'
+ + '(max-columns-preview)' # max column preview options
+ '--max-columns-preview[show preview for long lines (with -M)]'
+ $no"--no-max-columns-preview[don't show preview for long lines (with -M)]"
+
+ '(max-depth)' # Directory-depth options
'--max-depth=[specify max number of directories to descend]:number of directories'
'!--maxdepth=:number of directories'
@@ -213,6 +240,8 @@ _rg() {
+ '(text)' # Binary-search options
{-a,--text}'[search binary files as if they were text]'
+ "--binary[search binary files, don't print binary data]"
+ $no"--no-binary[don't search binary files]"
$no"(--null-data)--no-text[don't search binary files as if they were text]"
+ '(threads)' # Thread-count options
@@ -364,7 +393,7 @@ _rg_encodings() {
shift{-,_}jis csshiftjis {,x-}sjis ms_kanji ms932
utf{,-}8 utf-16{,be,le} unicode-1-1-utf-8
windows-{31j,874,949,125{0..8}} dos-874 tis-620 ansi_x3.4-1968
- x-user-defined auto
+ x-user-defined auto none
)
_wanted encodings expl encoding compadd -a "$@" - _encodings
@@ -382,6 +411,156 @@ _rg_types() {
_rg "$@"
+################################################################################
+# ZSH COMPLETION REFERENCE
+#
+# For the convenience of developers who aren't especially familiar with zsh
+# completion functions, a brief reference guide follows. This is in no way
+# comprehensive; it covers just enough of the basic structure, syntax, and
+# conventions to help someone make simple changes like adding new options. For
+# more complete documentation regarding zsh completion functions, please see the
+# following:
+#
+# * http://zsh.sourceforge.net/Doc/Release/Completion-System.html
+# * https://github.com/zsh-users/zsh/blob/master/Etc/completion-style-guide
+#
+# OVERVIEW
+#
+# Most zsh completion functions are defined in terms of `_arguments`, which is a
+# shell function that takes a series of argument specifications. The specs for
+# `rg` are stored in an array, which is common for more complex functions; the
+# elements of the array are passed to `_arguments` on invocation.
+#
+# ARGUMENT-SPECIFICATION SYNTAX
+#
+# The following is a contrived example of the argument specs for a simple tool:
+#
+# '(: * -)'{-h,--help}'[display help information]'
+# '(-q -v --quiet --verbose)'{-q,--quiet}'[decrease output verbosity]'
+# '!(-q -v --quiet --verbose)--silent'
+# '(-q -v --quiet --verbose)'{-v,--verbose}'[increase output verbosity]'
+# '--color=[specify when to use colors]:when:(always never auto)'
+# '*:example file:_files'
+#
+# Although there may appear to be six specs here, there are actually nine; we
+# use brace expansion to combine specs for options that go by multiple names,
+# like `-q` and `--quiet`. This is customary, and ties in with the fact that zsh
+# merges completion possibilities together when they have the same description.
+#
+# The first line defines the option `-h`/`--help`. With most tools, it isn't
+# useful to complete anything after `--help` because it effectively overrides
+# all others; the `(: * -)` at the beginning of the spec tells zsh not to
+# complete any other operands (`:` and `*`) or options (`-`) after this one has
+# been used. The `[...]` at the end associates a description with `-h`/`--help`;
+# as mentioned, zsh will see the identical descriptions and merge these options
+# together when offering completion possibilities.
+#
+# The next line defines `-q`/`--quiet`. Here we don't want to suppress further
+# completions entirely, but we don't want to offer `-q` if `--quiet` has been
+# given (since they do the same thing), nor do we want to offer `-v` (since it
+# doesn't make sense to be quiet and verbose at the same time). We don't need to
+# tell zsh not to offer `--quiet` a second time, since that's the default
+# behaviour, but since this line expands to two specs describing `-q` *and*
+# `--quiet` we do need to explicitly list all of them here.
+#
+# The next line defines a hidden option `--silent` — maybe it's a deprecated
+# synonym for `--quiet`. The leading `!` indicates that zsh shouldn't offer this
+# option during completion. The benefit of providing a spec for an option that
+# shouldn't be completed is that, if someone *does* use it, we can correctly
+# suppress completion of other options afterwards.
+#
+# The next line defines `-v`/`--verbose`; this works just like `-q`/`--quiet`.
+#
+# The next line defines `--color`. In this example, `--color` doesn't have a
+# corresponding short option, so we don't need to use brace expansion. Further,
+# there are no other options it's exclusive with (just itself), so we don't need
+# to define those at the beginning. However, it does take a mandatory argument.
+# The `=` at the end of `--color=` indicates that the argument may appear either
+# like `--color always` or like `--color=always`; this is how most GNU-style
+# command-line tools work. The corresponding short option would normally use `+`
+# — for example, `-c+` would allow either `-c always` or `-calways`. For this
+# option, the arguments are known ahead of time, so we can simply list them in
+# parentheses at the end (`when` is used as the description for the argument).
+#
+# The last line defines an operand (a non-option argument). In this example, the
+# operand can be used any number of times (the leading `*`), and it should be a
+# file path, so we tell zsh to call the `_files` function to complete it. The
+# `example file` in the middle is the description to use for this operand; we
+# could use a space instead to accept the default provided by `_files`.
+#
+# GROUPING ARGUMENT SPECIFICATIONS
+#
+# Newer versions of zsh support grouping argument specs together. All specs
+# following a `+` and then a group name are considered to be members of the
+# named group. Grouping is useful mostly for organisational purposes; it makes
+# the relationship between different options more obvious, and makes it easier
+# to specify exclusions.
+#
+# We could rewrite our example above using grouping as follows:
+#
+# '(: * -)'{-h,--help}'[display help information]'
+# '--color=[specify when to use colors]:when:(always never auto)'
+# '*:example file:_files'
+# + '(verbosity)'
+# {-q,--quiet}'[decrease output verbosity]'
+# '!--silent'
+# {-v,--verbose}'[increase output verbosity]'
+#
+# Here we take advantage of a useful feature of spec grouping — when the group
+# name is surrounded by parentheses, as in `(verbosity)`, it tells zsh that all
+# of the options in that group are exclusive with each other. As a result, we
+# don't need to manually list out the exclusions at the beginning of each
+# option.
+#
+# Groups can also be referred to by name in other argument specs; for example:
+#
+# '(xyz)--aaa' '*: :_files'
+# + xyz --xxx --yyy --zzz
+#
+# Here we use the group name `xyz` to tell zsh that `--xxx`, `--yyy`, and
+# `--zzz` are not to be completed after `--aaa`. This makes the exclusion list
+# much more compact and reusable.
+#
+# CONVENTIONS
+#
+# zsh completion functions generally adhere to the following conventions:
+#
+# * Use two spaces for indentation
+# * Combine specs for options with different names using brace expansion
+# * In combined specs, list the short option first (as in `{-a,--text}`)
+# * Use `+` or `=` as described above for options that take arguments
+# * Provide a description for all options, option-arguments, and operands
+# * Capitalise/punctuate argument descriptions as phrases, not complete
+# sentences — 'display help information', never 'Display help information.'
+# (but still capitalise acronyms and proper names)
+# * Write argument descriptions as verb phrases — 'display x', 'enable y',
+# 'use z'
+# * Word descriptions to make it clear when an option expects an argument;
+# usually this is done with the word 'specify', as in 'specify x' or
+# 'use specified x')
+# * Write argument descriptions as tersely as possible — for example, articles
+# like 'a' and 'the' should be omitted unless it would be confusing
+#
+# Other conventions currently used by this function:
+#
+# * Order argument specs alphabetically by group name, then option name
+# * Group options that are directly related, mutually exclusive, or frequently
+# referenced by other argument specs
+# * Use only characters in the set [a-z0-9_-] in group names
+# * Order exclusion lists as follows: short options, long options, groups
+# * Use American English in descriptions
+# * Use 'don't' in descriptions instead of 'do not'
+# * Word descriptions for related options as similarly as possible. For example,
+# `--foo[enable foo]` and `--no-foo[disable foo]`, or `--foo[use foo]` and
+# `--no-foo[don't use foo]`
+# * Word descriptions to make it clear when an option only makes sense with
+# another option, usually by adding '(with -x)' to the end
+# * Don't quote strings or variables unnecessarily. When quotes are required,
+# prefer single-quotes to double-quotes
+# * Prefix option specs with `$no` when the option serves only to negate the
+# behaviour of another option that must be provided explicitly by the user.
+# This prevents rarely used options from cluttering up the completion menu
+################################################################################
# ------------------------------------------------------------------------------
# Copyright (c) 2011 Github zsh-users - http://github.com/zsh-users
diff --git a/plugins/rust/README.md b/plugins/rust/README.md
new file mode 100644
index 000000000..83d7d91ba
--- /dev/null
+++ b/plugins/rust/README.md
@@ -0,0 +1,9 @@
+# rust
+
+This plugin adds completion for [`rustc`](https://doc.rust-lang.org/rustc/index.html), the compiler for the Rust programming language.
+
+To use it, add `rust` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... rust)
+```
diff --git a/plugins/rvm/README.md b/plugins/rvm/README.md
new file mode 100644
index 000000000..9d6fd8f85
--- /dev/null
+++ b/plugins/rvm/README.md
@@ -0,0 +1,19 @@
+# Ruby Version Manager plugin
+
+This plugin adds some utility functions and completions for [Ruby Version Manager](https://rvm.io/).
+
+To use it, add `rvm` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... rvm)
+```
+
+## Functions
+| Alias | Command |
+|----------------|----------------------|
+| `rb18` | `rvm use ruby-1.8.7` |
+| `rb19` | `rvm use ruby-1.9.3` |
+| `rb20` | `rvm use ruby-2.0.0` |
+| `rb21` | `rvm use ruby-2.1.2` |
+| `rvm-update` | `rvm get head` |
+| `gems` | `gem list` |
diff --git a/plugins/safe-paste/README.md b/plugins/safe-paste/README.md
new file mode 100644
index 000000000..a2e7ddbfc
--- /dev/null
+++ b/plugins/safe-paste/README.md
@@ -0,0 +1,9 @@
+# safe-paste
+
+Preventing any code from actually running while pasting, so you have a chance to review what was actually pasted before running it.
+
+To use it, add `safe-paste` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... safe-paste)
+```
diff --git a/plugins/salt/_salt b/plugins/salt/_salt
index 10b782af4..78d8611d2 100644
--- a/plugins/salt/_salt
+++ b/plugins/salt/_salt
@@ -271,7 +271,7 @@ _salt_comp(){
fi
if _cache_invalid salt/salt_dir || ! _retrieve_cache salt/salt_dir; then
- salt_dir="${$(python2 -c 'import salt; print(salt.__file__);')%__init__*}"
+ salt_dir="${$(python2 -c 'import sys; del sys.path[0]; import salt; print(salt.__file__);')%__init__*}"
_store_cache salt/salt_dir salt_dir
fi
}
diff --git a/plugins/sbt/README.md b/plugins/sbt/README.md
index f1a5753b9..f0201938e 100644
--- a/plugins/sbt/README.md
+++ b/plugins/sbt/README.md
@@ -17,16 +17,16 @@ plugins=(... sbt)
| sbcln | `sbt clean` | Deletes all generated files |
| sbcc | `sbt clean compile` | Deletes generated files, compiles the main sources |
| sbco | `sbt console` | Starts Scala with the compiled sources and all dependencies |
-| sbcq | `sbt console-quick` | Starts Scala with all dependencies |
-| sbcp | `sbt console-project` | Starts Scala with sbt and the build definitions |
+| sbcq | `sbt consoleQuick` | Starts Scala with all dependencies |
+| sbcp | `sbt consoleProject` | Starts Scala with sbt and the build definitions |
| sbd | `sbt doc` | Generates API documentation for Scala source files |
| sbdc | `sbt dist:clean` | Deletes the distribution packages |
| sbdi | `sbt dist` | Creates the distribution packages |
-| sbgi | `sbt gen-idea` | Create Idea project files |
+| sbgi | `sbt genIdea` | Create Idea project files |
| sbp | `sbt publish` | Publishes artifacts to the repository |
-| sbpl | `sbt publish-local` | Publishes artifacts to the local Ivy repository |
+| sbpl | `sbt publishLocal` | Publishes artifacts to the local Ivy repository |
| sbr | `sbt run` | Runs the main class for the project |
-| sbrm | `sbt run-main` | Runs the specified main class for the project |
+| sbrm | `sbt runMain` | Runs the specified main class for the project |
| sbu | `sbt update` | Resolves and retrieves external dependencies |
| sbx | `sbt test` | Compiles and runs all tests |
| sba | `sbt assembly` | Create a fat JAR with all dependencies |
diff --git a/plugins/sbt/_sbt b/plugins/sbt/_sbt
index a601c9b97..2138a722f 100644
--- a/plugins/sbt/_sbt
+++ b/plugins/sbt/_sbt
@@ -6,23 +6,23 @@ _sbt_commands=(
'clean:delete files produced by the build'
'compile:compile sources'
'console:start the Scala REPL with project classes on the classpath'
- 'console-quick:start the Scala REPL with project deps on the classpath'
- 'console-project:start the Scala REPL w/sbt+build-def on the classpath'
+ 'consoleQuick:start the Scala REPL with project deps on the classpath'
+ 'consoleProject:start the Scala REPL w/sbt+build-def on the classpath'
'dist:generate distribution artifacts'
'dist\:clean:clean distribution artifacts'
'doc:generate API documentation'
- 'gen-idea:generate Intellij Idea project files'
+ 'genIdea:generate Intellij Idea project files'
'package:produce the main artifact, such as a binary jar'
- 'package-doc:produce a doc artifact, such as a jar containing API docs'
- 'package-src:produce a source artifact, such as a jar containing sources'
+ 'packageDoc:produce a doc artifact, such as a jar containing API docs'
+ 'packageSrc:produce a source artifact, such as a jar containing sources'
'publish:publish artifacts to a repository'
- 'publish-local:publish artifacts to the local repository'
- 'publish-m2:publish artifacts to the local Maven 2 repository'
+ 'publishLocal:publish artifacts to the local repository'
+ 'publishM2:publish artifacts to the local Maven 2 repository'
'run:run a main class'
- 'run-main:run the main class selected by the first argument'
+ 'runMain:run the main class selected by the first argument'
'test:execute all tests'
- 'test-only:execute the tests provided as arguments'
- 'test-quick:execute previously failed tests'
+ 'testOnly:execute the tests provided as arguments'
+ 'testQuick:execute previously failed tests'
'update:resolve and optionally retrieve dependencies'
)
diff --git a/plugins/sbt/sbt.plugin.zsh b/plugins/sbt/sbt.plugin.zsh
index f883b7fee..851302c68 100644
--- a/plugins/sbt/sbt.plugin.zsh
+++ b/plugins/sbt/sbt.plugin.zsh
@@ -9,17 +9,17 @@
alias sbc='sbt compile'
alias sbcc='sbt clean compile'
alias sbco='sbt console'
-alias sbcq='sbt console-quick'
+alias sbcq='sbt consoleQuick'
alias sbcln='sbt clean'
-alias sbcp='sbt console-project'
+alias sbcp='sbt consoleProject'
alias sbd='sbt doc'
alias sbdc='sbt dist:clean'
alias sbdi='sbt dist'
-alias sbgi='sbt gen-idea'
+alias sbgi='sbt genIdea'
alias sbp='sbt publish'
-alias sbpl='sbt publish-local'
+alias sbpl='sbt publishLocal'
alias sbr='sbt run'
-alias sbrm='sbt run-main'
+alias sbrm='sbt runMain'
alias sbu='sbt update'
alias sbx='sbt test'
alias sba='sbt assembly'
diff --git a/plugins/screen/README.md b/plugins/screen/README.md
new file mode 100644
index 000000000..103e17237
--- /dev/null
+++ b/plugins/screen/README.md
@@ -0,0 +1,10 @@
+# screen
+
+This plugin sets title and hardstatus of the tab window for [screen](https://www.gnu.org/software/screen/),
+the terminal multiplexer.
+
+To use it add `screen` to the plugins array in your zshrc file.
+
+```zsh
+plugins=(... screen)
+```
diff --git a/plugins/sdk/README.md b/plugins/sdk/README.md
new file mode 100644
index 000000000..b237f3b4c
--- /dev/null
+++ b/plugins/sdk/README.md
@@ -0,0 +1,8 @@
+# sdk
+
+Plugin for SDKMAN, a tool for managing parallel versions of multiple Software Development Kits on most Unix based systems.
+Provides autocompletion for all known commands.
+
+## Requirements
+
+ * [SDKMAN](http://sdkman.io/)
diff --git a/plugins/sdk/sdk.plugin.zsh b/plugins/sdk/sdk.plugin.zsh
new file mode 100644
index 000000000..d00459b16
--- /dev/null
+++ b/plugins/sdk/sdk.plugin.zsh
@@ -0,0 +1,82 @@
+### SDKMAN Autocomplete for Oh My Zsh
+
+# This is the output from sdkman. All the these options are supported at the
+# moment.
+
+# Usage: sdk <command> [candidate] [version]
+# sdk offline <enable|disable>
+#
+# commands:
+# install or i <candidate> [version]
+# uninstall or rm <candidate> <version>
+# list or ls [candidate]
+# use or u <candidate> [version]
+# default or d <candidate> [version]
+# current or c [candidate]
+# upgrade or ug [candidate]
+# version or v
+# broadcast or b
+# help or h
+# offline [enable|disable]
+# selfupdate [force]
+# update
+# flush <candidates|broadcast|archives|temp>
+#
+# candidate : the SDK to install: groovy, scala, grails, gradle, kotlin, etc.
+# use list command for comprehensive list of candidates
+# eg: $ sdk list
+#
+# version : where optional, defaults to latest stable if not provided
+# eg: $ sdk install groovy
+
+local _sdk_commands=(
+ install i
+ uninstall rm
+ list ls
+ use u
+ default d
+ current c
+ upgrade ug
+ version v
+ broadcast b
+ help h
+ offline
+ selfupdate
+ update
+ flush
+)
+
+_listInstalledVersions() {
+ __sdkman_build_version_csv $1 | sed -e "s/,/ /g"
+}
+
+_listInstallableVersions() {
+ __sdkman_list_versions $1 | grep "^ " | sed -e "s/\* /*/g" | \
+ sed -e "s/>//g" | xargs -n 1 echo | grep -v "^*"
+}
+
+_listAllVersion() {
+ __sdkman_list_versions $1 | grep "^ " | sed -e "s/\*/ /g" | sed -e "s/>//g"
+}
+
+_sdk () {
+ case $CURRENT in
+ 2) compadd -- $_sdk_commands ;;
+ 3) case "$words[2]" in
+ i|install|rm|uninstall|ls|list|u|use|d|default|c|current|ug|upgrade)
+ compadd -- $SDKMAN_CANDIDATES ;;
+ offline) compadd -- enable disable ;;
+ selfupdate) compadd -- force ;;
+ flush) compadd -- candidates broadcast archives temp ;;
+ esac
+ ;;
+ 4) case "$words[2]" in
+ rm|uninstall|d|default) compadd -- $(_listInstalledVersions $words[3]) ;;
+ i|install) compadd -- $(_listInstallableVersions $words[3]) ;;
+ u|use) compadd -- $(_listAllVersion $words[3]) ;;
+ esac
+ ;;
+ esac
+}
+
+compdef _sdk sdk
diff --git a/plugins/sfdx/README.md b/plugins/sfdx/README.md
new file mode 100644
index 000000000..259c17fbe
--- /dev/null
+++ b/plugins/sfdx/README.md
@@ -0,0 +1,11 @@
+# sfdx plugin
+
+This plugin provides autocompletion for the [Salesforce DX](https://developer.salesforce.com/tools/sfdxcli) CLI.
+
+To use it, add `sfdx` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... sfdx)
+```
+
+Original repository: https://github.com/wadewegner/salesforce-cli-zsh-completion
diff --git a/plugins/sfdx/_sfdx b/plugins/sfdx/_sfdx
new file mode 100644
index 000000000..42ee55970
--- /dev/null
+++ b/plugins/sfdx/_sfdx
@@ -0,0 +1,1110 @@
+#compdef sfdx
+
+# DESCRIPTION: Zsh completion script for the Salesforce CLI
+# AUTHOR: Wade Wegner (@WadeWegner)
+# REPO: https://github.com/wadewegner/salesforce-cli-zsh-completion
+# LICENSE: https://github.com/wadewegner/salesforce-cli-zsh-completion/blob/master/LICENSE
+
+local -a _1st_arguments
+
+_1st_arguments=(
+ "force\:alias\:list":"list username aliases for the Salesforce CLI"
+ "force\:alias\:set":"set username aliases for the Salesforce CLI"
+ "force\:apex\:class\:create":"create an Apex class"
+ "force\:apex\:execute":"execute anonymous Apex code"
+ "force\:apex\:log\:get":"fetch a debug log"
+ "force\:apex\:log\:list":"list debug logs"
+ "force\:apex\:log\:tail":"start debug logging and display logs"
+ "force\:apex\:test\:report":"display test results"
+ "force\:apex\:test\:run":"invoke Apex tests"
+ "force\:apex\:trigger\:create":"create an Apex trigger"
+ "force\:auth\:jwt\:grant":"authorize an org using the JWT flow"
+ "force\:auth\:logout":"log out from authorized orgs"
+ "force\:auth\:sfdxurl\:store":"authorize an org using an SFDX auth URL"
+ "force\:auth\:web\:login":"authorize an org using the web login flow"
+ "force\:config\:get":"get config var values for given names"
+ "force\:config\:list":"list config vars for the Salesforce CLI"
+ "force\:config\:set":"set config vars for the Salesforce CLI"
+ "force\:data\:bulk\:delete":"bulk delete records from a csv file"
+ "force\:data\:bulk\:status":"view the status of a bulk data load job or batch"
+ "force\:data\:bulk\:upsert":"bulk upsert records from a CSV file"
+ "force\:data\:record\:create":"create a record"
+ "force\:data\:record\:delete":"delete a record"
+ "force\:data\:record\:get":"view a record"
+ "force\:data\:record\:update":"update a record"
+ "force\:data\:soql\:query":"execute a SOQL query"
+ "force\:data\:tree\:export":"export data from an org into sObject tree format for force:data:tree:import consumption"
+ "force\:data\:tree\:import":"import data into an org using SObject Tree Save API"
+ "force\:doc\:commands\:display":"display help for force commands"
+ "force\:doc\:commands\:list":"list the force commands"
+ "force\:lightning\:app\:create":"create a Lightning app"
+ "force\:lightning\:component\:create":"create a bundle for an Aura component or a Lightning web component"
+ "force\:lightning\:event\:create":"create a Lightning event"
+ "force\:lightning\:interface\:create":"create a Lightning interface"
+ "force\:lightning\:lint":"analyse (lint) Lightning component code"
+ "force\:lightning\:test\:create":"create a Lightning test"
+ "force\:lightning\:test\:install":"install Lightning Testing Service unmanaged package in your org"
+ "force\:lightning\:test\:run":"invoke Aura component tests"
+ "force\:limits\:api\:display":"display current org’s limits"
+ "force\:mdapi\:convert":"convert metadata from the Metadata API format into the source format"
+ "force\:mdapi\:deploy":"deploy metadata to an org using Metadata API"
+ "force\:mdapi\:deploy\:cancel":"cancel a metadata deployment"
+ "force\:mdapi\:deploy\:report":"check the status of a metadata deployment"
+ "force\:mdapi\:retrieve":"retrieve metadata from an org using Metadata API"
+ "force\:mdapi\:retrieve\:report":"check the status of a metadata retrieval"
+ "force\:org\:create":"create a scratch org"
+ "force\:org\:delete":"mark a scratch org for deletion"
+ "force\:org\:display":"get org description"
+ "force\:org\:list":"list all orgs you’ve created or authenticated to"
+ "force\:org\:open":"open an org in your browser"
+ "force\:org\:shape\:create":"create a snapshot of org edition, features, and licenses"
+ "force\:org\:shape\:delete":"delete all org shapes for a target org"
+ "force\:org\:shape\:list":"list all org shapes you’ve created"
+ "force\:org\:snapshot\:create":"snapshot a scratch org"
+ "force\:org\:snapshot\:delete":"delete a scratch org snapshot"
+ "force\:org\:snapshot\:get":"get details about a scratch org snapshot"
+ "force\:org\:snapshot\:list":"list scratch org snapshots"
+ "force\:package1\:version\:create":"create a first-generation package version in the release org"
+ "force\:package1\:version\:create\:get":"retrieve the status of a package version creation request"
+ "force\:package1\:version\:display":"display details about a first-generation package version"
+ "force\:package1\:version\:list":"list package versions for the specified first-generation package or for the org"
+ "force\:package\:create":"create a package"
+ "force\:package\:hammertest\:list":"list the statuses of running and completed hammer tests"
+ "force\:package\:hammertest\:report":"display the status or results of a hammer test"
+ "force\:package\:hammertest\:run":"run ISV Hammer"
+ "force\:package\:install":"install a package in the target org"
+ "force\:package\:install\:report":"retrieve the status of a package installation request"
+ "force\:package\:installed\:list":"list the org’s installed packages"
+ "force\:package\:list":"list all packages in the Dev Hub org"
+ "force\:package\:uninstall":"uninstall a second-generation package from the target org"
+ "force\:package\:uninstall\:report":"retrieve status of package uninstall request"
+ "force\:package\:update":"update package details"
+ "force\:package\:version\:create":"create a package version"
+ "force\:package\:version\:create\:list":"list package version creation requests"
+ "force\:package\:version\:create\:report":"retrieve details about a package version creation request"
+ "force\:package\:version\:list":"list all package versions in the Dev Hub org"
+ "force\:package\:version\:promote":"promote a package version to released"
+ "force\:package\:version\:report":"retrieve details about a package version in the Dev Hub org"
+ "force\:package\:version\:update":"update a package version"
+ "force\:project\:create":"create a new SFDX project"
+ "force\:project\:upgrade":"update project config files to the latest format"
+ "force\:schema\:sobject\:describe":"describe an object"
+ "force\:schema\:sobject\:list":"list all objects of a specified category"
+ "force\:source\:convert":"convert source into Metadata API format"
+ "force\:source\:delete":"delete source from your project and from a non-source-tracked org"
+ "force\:source\:deploy":"deploy source to a non-source-tracked org"
+ "force\:source\:open":"edit a Lightning Page with Lightning App Builder"
+ "force\:source\:pull":"pull source from the scratch org to the project"
+ "force\:source\:push":"push source to a scratch org from the project"
+ "force\:source\:retrieve":"retrieve source from a non-source-tracked org"
+ "force\:source\:status":"list local changes and/or changes in a scratch org"
+ "force\:user\:create":"create a user for a scratch org"
+ "force\:user\:display":"displays information about a user of a scratch org"
+ "force\:user\:list":"lists all users of a scratch org"
+ "force\:user\:password\:generate":"generate a password for scratch org users"
+ "force\:user\:permset\:assign":"assign a permission set to one or more users of an org"
+ "force\:visualforce\:component\:create":"create a Visualforce component"
+ "force\:visualforce\:page\:create":"create a Visualforce page"
+)
+
+_arguments '*:: :->command'
+
+if (( CURRENT == 1 )); then
+ _describe -t commands "sfdx command" _1st_arguments
+ return
+fi
+
+local -a _command_args
+case "$words[1]" in
+ force:limits:api:display)
+ _command_args=(
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:lightning:app:create)
+ _command_args=(
+ '(-n|--appname)'{-n,--appname}'[name of the generated Lightning app]' \
+ '(-t|--template)'{-t,--template}'[template to use for file creation (DefaultLightningApp*)]' \
+ '(-d|--outputdir)'{-d,--outputdir}'[folder for saving the created files]' \
+ '(-r|--reflect)'{-r,--reflect}'[switch to return flag detailed information]' \
+ '(-a|--apiversion)'{-a,--apiversion}'[API version number (45.0*,44.0)]' \
+ '(--json)--json[JSON output]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:data:bulk:delete)
+ _command_args=(
+ '(-s|--sobjecttype)'{-s,--sobjecttype}'[the sObject type of the records you’re deleting]' \
+ '(-f|--csvfile)'{-f,--csvfile}'[the path to the CSV file containing the ids of the records to delete]:file:_files' \
+ '(-w|--wait)'{-w,--wait}'[the number of minutes to wait for the command to complete before displaying the results]' \
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:data:bulk:status)
+ _command_args=(
+ '(-i|--jobid)'{-i,--jobid}'[the ID of the job you want to view or of the job whose batch you want to view]' \
+ '(-b|--batchid)'{-b,--batchid}'[the ID of the batch whose status you want to view]' \
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:data:bulk:upsert)
+ _command_args=(
+ '(-s|--sobjecttype)'{-s,--sobjecttype}'[the sObject type of the records you want to upsert]' \
+ '(-f|--csvfile)'{-f,--csvfile}'[the path to the CSV file that defines the records to upsert]:file:_files' \
+ '(-i|--externalid)'{-i,--externalid}'[the column name of the external ID]' \
+ '(-w|--wait)'{-w,--wait}'[the number of minutes to wait for the command to complete before displaying the results]' \
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:apex:class:create)
+ _command_args=(
+ '(-n|--classname)'{-n,--classname}'[name of the generated Apex class]' \
+ '(-t|--template)'{-t,--template}'[template to use for file creation (DefaultApexClass*,ApexException,ApexUnitTest,InboundEmailService)]' \
+ '(-d|--outputdir)'{-d,--outputdir}'[folder for saving the created files]' \
+ '(-r|--reflect)'{-r,--reflect}'[switch to return flag detailed information]' \
+ '(-a|--apiversion)'{-a,--apiversion}'[API version number (45.0*,44.0)]' \
+ '(--json)--json[JSON output]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:doc:commands:display)
+ _command_args=(
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:doc:commands:list)
+ _command_args=(
+ '(-u|--usage)'{-u,--usage}'[list only docopt usage strings]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:visualforce:component:create)
+ _command_args=(
+ '(-t|--template)'{-t,--template}'[template to use for file creation (DefaultVFComponent*)]' \
+ '(-d|--outputdir)'{-d,--outputdir}'[folder for saving the created files]' \
+ '(-r|--reflect)'{-r,--reflect}'[switch to return flag detailed information]' \
+ '(-n|--componentname)'{-n,--componentname}'[name of the generated Visualforce component]' \
+ '(-a|--apiversion)'{-a,--apiversion}'[API version number (45.0*,44.0)]' \
+ '(-l|--label)'{-l,--label}'[Visualforce component label]' \
+ '(--json)--json[JSON output]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:lightning:component:create)
+ _command_args=(
+ '(-n|--componentname)'{-n,--componentname}'[name of the generated Lightning component]' \
+ '(-t|--template)'{-t,--template}'[template to use for file creation (DefaultLightningCmp*)]' \
+ '(-d|--outputdir)'{-d,--outputdir}'[folder for saving the created files]' \
+ '(-r|--reflect)'{-r,--reflect}'[switch to return flag detailed information]' \
+ '(-a|--apiversion)'{-a,--apiversion}'[API version number (45.0*,44.0)]' \
+ '(--type)--type[type of the Lightning component (aura*,lwc)]' \
+ '(--json)--json[JSON output]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:mdapi:convert)
+ _command_args=(
+ '(-r|--rootdir)'{-r,--rootdir}'[the root directory containing the Metadata API–formatted metadata]:file:_files' \
+ '(-d|--outputdir)'{-d,--outputdir}'[the output directory to store the source–formatted files]:file:_files' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:source:convert)
+ _command_args=(
+ '(-r|--rootdir)'{-r,--rootdir}'[a source directory other than the default package to convert]:file:_files' \
+ '(-d|--outputdir)'{-d,--outputdir}'[output directory to store the Metadata API–formatted files in]:file:_files' \
+ '(-n|--packagename)'{-n,--packagename}'[name of the package to associate with the metadata-formatted files]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:org:create)
+ _command_args=(
+ '(-f|--definitionfile)'{-f,--definitionfile}'[path to a scratch org definition file]:file:_files' \
+ '(-j|--definitionjson)'{-j,--definitionjson}'[scratch org definition in json format ]' \
+ '(-n|--nonamespace)'{-n,--nonamespace}'[creates the scratch org with no namespace]' \
+ '(-c|--noancestors)'{-c,--noancestors}'[do not include second-generation package ancestors in the scratch org]' \
+ '(-i|--clientid)'{-i,--clientid}'[connected app consumer key]' \
+ '(-s|--setdefaultusername)'{-s,--setdefaultusername}'[set the created org as the default username]' \
+ '(-a|--setalias)'{-a,--setalias}'[set an alias for for the created scratch org]' \
+ '(-e|--env)'{-e,--env}'[environment where the scratch org is created: \[sandbox*,virtual,prototype\] (sandbox*,virtual,prototype)]' \
+ '(-w|--wait)'{-w,--wait}'[the streaming client socket timeout (in minutes) (default:6, min:2)]' \
+ '(-d|--durationdays)'{-d,--durationdays}'[duration of the scratch org (in days) (default:7, min:1, max:30)]' \
+ '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:package:create)
+ _command_args=(
+ '(-n|--name)'{-n,--name}'[package name]' \
+ '(-t|--packagetype)'{-t,--packagetype}'[package type (Managed,Unlocked)]' \
+ '(-d|--description)'{-d,--description}'[package description]' \
+ '(-e|--nonamespace)'{-e,--nonamespace}'[creates the package with no namespace; available only for unlocked packages.]' \
+ '(-r|--path)'{-r,--path}'[path to directory that contains the contents of the package]:file:_files' \
+ '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:user:create)
+ _command_args=(
+ '(-f|--definitionfile)'{-f,--definitionfile}'[file path to a user definition]:file:_files' \
+ '(-a|--setalias)'{-a,--setalias}'[set an alias for the created username to reference within the CLI]' \
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:project:create)
+ _command_args=(
+ '(-n|--projectname)'{-n,--projectname}'[name of the generated project]' \
+ '(-t|--template)'{-t,--template}'[template to use for file creation (Defaultsfdx-project.json*)]' \
+ '(-d|--outputdir)'{-d,--outputdir}'[folder for saving the created files]' \
+ '(-r|--reflect)'{-r,--reflect}'[switch to return flag detailed information]' \
+ '(-l|--loginurl)'{-l,--loginurl}'[Salesforce instance login URL (https://login.salesforce.com*)]' \
+ '(--sourceapiversion)--sourceapiversion[source API version number (45.0*)]' \
+ '(-s|--namespace)'{-s,--namespace}'[project associated namespace]' \
+ '(-p|--defaultpackagedir)'{-p,--defaultpackagedir}'[default package directory name (force-app*)]' \
+ '(-x|--manifest)'{-x,--manifest}'[generate a manifest (package.xml) for change-set-based development]' \
+ '(--json)--json[JSON output]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:org:delete)
+ _command_args=(
+ '(-p|--noprompt)'{-p,--noprompt}'[no prompt to confirm deletion]' \
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org]' \
+ '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:source:delete)
+ _command_args=(
+ '(-r|--noprompt)'{-r,--noprompt}'[do not prompt for delete confirmation]' \
+ '(-w|--wait)'{-w,--wait}'[wait time for command to finish in minutes (default: 33) (default:33, min:1)]' \
+ '(-p|--sourcepath)'{-p,--sourcepath}'[comma-separated list of paths to the local metadata to delete]:file:_files' \
+ '(-m|--metadata)'{-m,--metadata}'[comma-separated list of names of metadata components to delete]' \
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:mdapi:deploy)
+ _command_args=(
+ '(-c|--checkonly)'{-c,--checkonly}'[validate deploy but don’t save to the org (default:false)]' \
+ '(-d|--deploydir)'{-d,--deploydir}'[root of directory tree of files to deploy]:file:_files' \
+ '(-w|--wait)'{-w,--wait}'[wait time for command to finish in minutes (default: 0)]' \
+ '(-i|--jobid)'{-i,--jobid}'[(deprecated) job ID of the deployment you want to check; defaults to your most recent CLI deployment if not specified]' \
+ '(-l|--testlevel)'{-l,--testlevel}'[deployment testing level (NoTestRun,RunSpecifiedTests,RunLocalTests,RunAllTestsInOrg)]' \
+ '(-r|--runtests)'{-r,--runtests}'[tests to run if --testlevel RunSpecifiedTests]' \
+ '(-e|--rollbackonerror)'{-e,--rollbackonerror}'[(deprecated) roll back deployment for any failure (default:true)]' \
+ '(-o|--ignoreerrors)'{-o,--ignoreerrors}'[ignore any errors and do not roll back deployment (default:false)]' \
+ '(-g|--ignorewarnings)'{-g,--ignorewarnings}'[whether a warning will allow a deployment to complete successfully (default:false)]' \
+ '(-q|--validateddeployrequestid)'{-q,--validateddeployrequestid}'[request ID of the validated deployment to run a Quick Deploy]' \
+ '(-f|--zipfile)'{-f,--zipfile}'[path to .zip file of metadata to deploy]:file:_files' \
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ '(--verbose)--verbose[verbose output of deploy results]' \
+ )
+ ;;
+ force:source:deploy)
+ _command_args=(
+ '(-w|--wait)'{-w,--wait}'[wait time for command to finish in minutes (default: 33) (default:33, min:1)]' \
+ '(-m|--metadata)'{-m,--metadata}'[comma-separated list of metadata component names]' \
+ '(-p|--sourcepath)'{-p,--sourcepath}'[comma-separated list of paths to the local source files to deploy]:file:_files' \
+ '(-x|--manifest)'{-x,--manifest}'[file path for manifest (package.xml) of components to deploy]:file:_files' \
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:mdapi:deploy:cancel)
+ _command_args=(
+ '(-w|--wait)'{-w,--wait}'[wait time for command to finish in minutes (default: 33) (default:33, min:1)]' \
+ '(-i|--jobid)'{-i,--jobid}'[job ID of the deployment you want to cancel; defaults to your most recent CLI deployment if not specified]' \
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:mdapi:deploy:report)
+ _command_args=(
+ '(-w|--wait)'{-w,--wait}'[wait time for command to finish in minutes (default: 0)]' \
+ '(-i|--jobid)'{-i,--jobid}'[job ID of the deployment you want to check; defaults to your most recent CLI deployment if not specified]' \
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ '(--verbose)--verbose[verbose output of deploy results]' \
+ )
+ ;;
+ force:org:display)
+ _command_args=(
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ '(--verbose)--verbose[emit additional command output to stdout]' \
+ )
+ ;;
+ force:user:display)
+ _command_args=(
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:lightning:event:create)
+ _command_args=(
+ '(-n|--eventname)'{-n,--eventname}'[name of the generated Lightning event]' \
+ '(-t|--template)'{-t,--template}'[template to use for file creation (DefaultLightningEvt*)]' \
+ '(-d|--outputdir)'{-d,--outputdir}'[folder for saving the created files]' \
+ '(-r|--reflect)'{-r,--reflect}'[switch to return flag detailed information]' \
+ '(-a|--apiversion)'{-a,--apiversion}'[API version number (45.0*,44.0)]' \
+ '(--json)--json[JSON output]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:apex:execute)
+ _command_args=(
+ '(-f|--apexcodefile)'{-f,--apexcodefile}'[path to a local file containing Apex code]:file:_files' \
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:config:get)
+ _command_args=(
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ '(--verbose)--verbose[emit additional command output to stdout]' \
+ )
+ ;;
+ force:package:hammertest:list)
+ _command_args=(
+ '(-i|--packageversionid)'{-i,--packageversionid}'[ID of the package version to list results for]' \
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:package:hammertest:report)
+ _command_args=(
+ '(-i|--requestid)'{-i,--requestid}'[ID of the hammer request to report on]' \
+ '(-s|--summary)'{-s,--summary}'[report only a results summary (hide Apex test failures)]' \
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:package:hammertest:run)
+ _command_args=(
+ '(-i|--packageversionid)'{-i,--packageversionid}'[ID of the package version to test]' \
+ '(-s|--subscriberorg)'{-s,--subscriberorg}'[comma-separated list of subscriber orgs IDs]' \
+ '(-f|--subscriberfile)'{-f,--subscriberfile}'[file with list of subscriber orgs IDs, one per line]' \
+ '(-d|--scheduledrundatetime)'{-d,--scheduledrundatetime}'[earliest date/time to run the test]' \
+ '(-p|--preview)'{-p,--preview}'[run the package hammer test in the Salesforce preview version]' \
+ '(-t|--apextests)'{-t,--apextests}'[run the apex tests in the subscriber org]' \
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:package:install)
+ _command_args=(
+ '(-w|--wait)'{-w,--wait}'[number of minutes to wait for installation status]' \
+ '(-k|--installationkey)'{-k,--installationkey}'[installation key for key-protected package (default: null)]' \
+ '(-b|--publishwait)'{-b,--publishwait}'[number of minutes to wait for subscriber package version ID to become available in the target org ]' \
+ '(-r|--noprompt)'{-r,--noprompt}'[allow Remote Site Settings and Content Security Policy websites to send or receive data without confirmation]' \
+ '(-p|--package)'{-p,--package}'[ID (starts with 04t) or alias of the package version to install]' \
+ '(-s|--securitytype)'{-s,--securitytype}'[security access type for the installed package (AllUsers,AdminsOnly)]' \
+ '(-t|--upgradetype)'{-t,--upgradetype}'[the upgrade type for the package installation (Mixed*,DeprecateOnly)]' \
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:package:install:report)
+ _command_args=(
+ '(-i|--requestid)'{-i,--requestid}'[ID of the package install request you want to check]' \
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:package:installed:list)
+ _command_args=(
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:lightning:interface:create)
+ _command_args=(
+ '(-n|--interfacename)'{-n,--interfacename}'[name of the generated Lightning interface]' \
+ '(-t|--template)'{-t,--template}'[template to use for file creation (DefaultLightningIntf*)]' \
+ '(-d|--outputdir)'{-d,--outputdir}'[folder for saving the created files]' \
+ '(-r|--reflect)'{-r,--reflect}'[switch to return flag detailed information]' \
+ '(-a|--apiversion)'{-a,--apiversion}'[API version number (45.0*,44.0)]' \
+ '(--json)--json[JSON output]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:auth:jwt:grant)
+ _command_args=(
+ '(-u|--username)'{-u,--username}'[authentication username]' \
+ '(-f|--jwtkeyfile)'{-f,--jwtkeyfile}'[path to a file containing the private key]:file:_files' \
+ '(-i|--clientid)'{-i,--clientid}'[OAuth client ID (sometimes called the consumer key)]' \
+ '(-r|--instanceurl)'{-r,--instanceurl}'[the login URL of the instance the org lives on]' \
+ '(-d|--setdefaultdevhubusername)'{-d,--setdefaultdevhubusername}'[set the authenticated org as the default dev hub org for scratch org creation]' \
+ '(-s|--setdefaultusername)'{-s,--setdefaultusername}'[set the authenticated org as the default username that all commands run against]' \
+ '(-a|--setalias)'{-a,--setalias}'[set an alias for the authenticated org]' \
+ '(-p|--noprompt)'{-p,--noprompt}'[do not prompt for auth confirmation in demo mode]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:lightning:lint)
+ _command_args=(
+ '(--ignore)--ignore[pattern used to ignore some folders]' \
+ '(--files)--files[pattern used to include specific files]' \
+ '(--json)--json[format output as JSON]' \
+ '(--config)--config[path to a custom ESLint configuration file]' \
+ '(--verbose)--verbose[report warnings in addition to errors]' \
+ '(--exit)--exit[exit with error code 1 if there are lint issues]' \
+ )
+ ;;
+ force:alias:list)
+ _command_args=(
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:config:list)
+ _command_args=(
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:org:list)
+ _command_args=(
+ '(--all)--all[include expired, deleted, and unknown-status scratch orgs]' \
+ '(--clean)--clean[remove all local org authorizations for non-active orgs]' \
+ '(-p|--noprompt)'{-p,--noprompt}'[do not prompt for confirmation]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ '(--verbose)--verbose[list more information about each org]' \
+ )
+ ;;
+ force:package:list)
+ _command_args=(
+ '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ '(--verbose)--verbose[display extended package detail]' \
+ )
+ ;;
+ force:user:list)
+ _command_args=(
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:apex:log:get)
+ _command_args=(
+ '(-c|--color)'{-c,--color}'[colorize noteworthy log lines]' \
+ '(-i|--logid)'{-i,--logid}'[ID of the log to display]' \
+ '(-n|--number)'{-n,--number}'[number of most recent logs to display (min:1, max:25)]' \
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:apex:log:list)
+ _command_args=(
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:apex:log:tail)
+ _command_args=(
+ '(-c|--color)'{-c,--color}'[colorize noteworthy log lines]' \
+ '(-d|--debuglevel)'{-d,--debuglevel}'[debug level for trace flag]' \
+ '(-s|--skiptraceflag)'{-s,--skiptraceflag}'[skip trace flag setup]' \
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:auth:logout)
+ _command_args=(
+ '(-a|--all)'{-a,--all}'[include all authenticated orgs]' \
+ '(-p|--noprompt)'{-p,--noprompt}'[do not prompt for confirmation]' \
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:org:open)
+ _command_args=(
+ '(-p|--path)'{-p,--path}'[navigation URL path]' \
+ '(-r|--urlonly)'{-r,--urlonly}'[display navigation URL, but don’t launch browser]' \
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:source:open)
+ _command_args=(
+ '(-f|--sourcefile)'{-f,--sourcefile}'[file to edit]:file:_files' \
+ '(-r|--urlonly)'{-r,--urlonly}'[generate a navigation URL; don’t launch the editor]' \
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:visualforce:page:create)
+ _command_args=(
+ '(-t|--template)'{-t,--template}'[template to use for file creation (DefaultVFPage*)]' \
+ '(-d|--outputdir)'{-d,--outputdir}'[folder for saving the created files]' \
+ '(-r|--reflect)'{-r,--reflect}'[switch to return flag detailed information]' \
+ '(-n|--pagename)'{-n,--pagename}'[name of the generated Visualforce page]' \
+ '(-a|--apiversion)'{-a,--apiversion}'[API version number (45.0*,44.0)]' \
+ '(-l|--label)'{-l,--label}'[Visualforce page label]' \
+ '(--json)--json[JSON output]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:user:password:generate)
+ _command_args=(
+ '(-o|--onbehalfof)'{-o,--onbehalfof}'[comma-separated list of usernames for which to generate passwords]' \
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:user:permset:assign)
+ _command_args=(
+ '(-n|--permsetname)'{-n,--permsetname}'[the name of the permission set to assign]' \
+ '(-o|--onbehalfof)'{-o,--onbehalfof}'[comma-separated list of usernames or aliases to assign the permission set to]' \
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:source:pull)
+ _command_args=(
+ '(-w|--wait)'{-w,--wait}'[wait time for command to finish in minutes (default: 33) (default:33, min:1)]' \
+ '(-f|--forceoverwrite)'{-f,--forceoverwrite}'[ignore conflict warnings and overwrite changes to the project]' \
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:source:push)
+ _command_args=(
+ '(-f|--forceoverwrite)'{-f,--forceoverwrite}'[ignore conflict warnings and overwrite changes to scratch org]' \
+ '(-g|--ignorewarnings)'{-g,--ignorewarnings}'[deploy changes even if warnings are generated]' \
+ '(-r|--replacetokens)'{-r,--replacetokens}'[replace tokens in source files prior to deployment]' \
+ '(-w|--wait)'{-w,--wait}'[wait time for command to finish in minutes (default: 33) (default:33, min:1)]' \
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:data:record:create)
+ _command_args=(
+ '(-s|--sobjecttype)'{-s,--sobjecttype}'[the type of the record you’re creating]' \
+ '(-v|--values)'{-v,--values}'[the <fieldName>=<value> pairs you’re creating]' \
+ '(-t|--usetoolingapi)'{-t,--usetoolingapi}'[create the record with tooling api]' \
+ '(--perflog)--perflog[get API performance data.]' \
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:data:record:delete)
+ _command_args=(
+ '(-s|--sobjecttype)'{-s,--sobjecttype}'[the type of the record you’re deleting]' \
+ '(-i|--sobjectid)'{-i,--sobjectid}'[the ID of the record you’re deleting]' \
+ '(-w|--where)'{-w,--where}'[a list of <fieldName>=<value> pairs to search for]' \
+ '(-t|--usetoolingapi)'{-t,--usetoolingapi}'[delete the record with Tooling API]' \
+ '(--perflog)--perflog[get API performance data.]' \
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:data:record:get)
+ _command_args=(
+ '(-s|--sobjecttype)'{-s,--sobjecttype}'[the type of the record you’re retrieving]' \
+ '(-i|--sobjectid)'{-i,--sobjectid}'[the ID of the record you’re retrieving]' \
+ '(-w|--where)'{-w,--where}'[a list of <fieldName>=<value> pairs to search for]' \
+ '(-t|--usetoolingapi)'{-t,--usetoolingapi}'[retrieve the record with Tooling API]' \
+ '(--perflog)--perflog[get API performance data.]' \
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:data:record:update)
+ _command_args=(
+ '(-s|--sobjecttype)'{-s,--sobjecttype}'[the type of the record you’re updating]' \
+ '(-i|--sobjectid)'{-i,--sobjectid}'[the ID of the record you’re updating]' \
+ '(-w|--where)'{-w,--where}'[a list of <fieldName>=<value> pairs to search for]' \
+ '(-v|--values)'{-v,--values}'[the <fieldName>=<value> pairs you’re updating]' \
+ '(-t|--usetoolingapi)'{-t,--usetoolingapi}'[update the record with Tooling API]' \
+ '(--perflog)--perflog[get API performance data.]' \
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:mdapi:retrieve)
+ _command_args=(
+ '(-a|--apiversion)'{-a,--apiversion}'[target API version for the retrieve (default 45.0)]' \
+ '(-w|--wait)'{-w,--wait}'[wait time for command to finish in minutes (default: -1 (no limit))]' \
+ '(-r|--retrievetargetdir)'{-r,--retrievetargetdir}'[directory root for the retrieved files]:file:_files' \
+ '(-k|--unpackaged)'{-k,--unpackaged}'[file path of manifest of components to retrieve]:file:_files' \
+ '(-d|--sourcedir)'{-d,--sourcedir}'[source dir to use instead of default manifest sfdx-project.xml]:file:_files' \
+ '(-p|--packagenames)'{-p,--packagenames}'[a comma-separated list of packages to retrieve]' \
+ '(-s|--singlepackage)'{-s,--singlepackage}'[a single-package retrieve (default: false)]' \
+ '(-i|--jobid)'{-i,--jobid}'[(deprecated) job ID of the retrieve you want to check; defaults to your most recent CLI retrieval if not specified]' \
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ '(--verbose)--verbose[verbose output of retrieve result]' \
+ )
+ ;;
+ force:source:retrieve)
+ _command_args=(
+ '(-w|--wait)'{-w,--wait}'[wait time for command to finish in minutes (default: 33) (default:33, min:1)]' \
+ '(-x|--manifest)'{-x,--manifest}'[file path for manifest (package.xml) of components to retrieve]:file:_files' \
+ '(-m|--metadata)'{-m,--metadata}'[comma-separated list of metadata component names]' \
+ '(-p|--sourcepath)'{-p,--sourcepath}'[comma-separated list of source file paths to retrieve]:file:_files' \
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:mdapi:retrieve:report)
+ _command_args=(
+ '(-w|--wait)'{-w,--wait}'[wait time for command to finish in minutes (default: -1 (no limit))]' \
+ '(-r|--retrievetargetdir)'{-r,--retrievetargetdir}'[directory root for the retrieved files]:file:_files' \
+ '(-i|--jobid)'{-i,--jobid}'[job ID of the retrieve you want to check; defaults to your most recent CLI retrieval if not specified]' \
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ '(--verbose)--verbose[verbose output of retrieve result]' \
+ )
+ ;;
+ force:alias:set)
+ _command_args=(
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:config:set)
+ _command_args=(
+ '(-g|--global)'{-g,--global}'[set config var globally (to be used from any directory)]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:auth:sfdxurl:store)
+ _command_args=(
+ '(-f|--sfdxurlfile)'{-f,--sfdxurlfile}'[path to a file containing the sfdx url]:file:_files' \
+ '(-d|--setdefaultdevhubusername)'{-d,--setdefaultdevhubusername}'[set the authenticated org as the default dev hub org for scratch org creation]' \
+ '(-s|--setdefaultusername)'{-s,--setdefaultusername}'[set the authenticated org as the default username that all commands run against]' \
+ '(-a|--setalias)'{-a,--setalias}'[set an alias for the authenticated org]' \
+ '(-p|--noprompt)'{-p,--noprompt}'[do not prompt for auth confirmation in demo mode]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:org:shape:create)
+ _command_args=(
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:org:shape:delete)
+ _command_args=(
+ '(-p|--noprompt)'{-p,--noprompt}'[do not prompt for confirmation]' \
+ '(-u|--targetusername)'{-u,--targetusername}'[username for the target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:org:shape:list)
+ _command_args=(
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ '(--verbose)--verbose[list more information about each org shape]' \
+ )
+ ;;
+ force:org:snapshot:create)
+ _command_args=(
+ '(-o|--sourceorg)'{-o,--sourceorg}'[ID or locally authenticated username or alias of scratch org to snapshot]' \
+ '(-n|--snapshotname)'{-n,--snapshotname}'[unique name of snapshot]' \
+ '(-d|--description)'{-d,--description}'[description of snapshot]' \
+ '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:org:snapshot:delete)
+ _command_args=(
+ '(-s|--snapshot)'{-s,--snapshot}'[name or ID of snapshot to delete]' \
+ '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:org:snapshot:get)
+ _command_args=(
+ '(-s|--snapshot)'{-s,--snapshot}'[name or ID of snapshot to retrieve]' \
+ '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:org:snapshot:list)
+ _command_args=(
+ '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:schema:sobject:describe)
+ _command_args=(
+ '(-s|--sobjecttype)'{-s,--sobjecttype}'[the API name of the object to describe]' \
+ '(-t|--usetoolingapi)'{-t,--usetoolingapi}'[execute with Tooling API]' \
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:schema:sobject:list)
+ _command_args=(
+ '(-c|--sobjecttypecategory)'{-c,--sobjecttypecategory}'[the type of objects to list (all|custom|standard)]' \
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:data:soql:query)
+ _command_args=(
+ '(-q|--query)'{-q,--query}'[SOQL query to execute]' \
+ '(-t|--usetoolingapi)'{-t,--usetoolingapi}'[execute query with Tooling API]' \
+ '(-r|--resultformat)'{-r,--resultformat}'[query result format emitted to stdout; --json flag overrides this parameter (human*,csv,json)]' \
+ '(--perflog)--perflog[get API performance data.]' \
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:source:status)
+ _command_args=(
+ '(-a|--all)'{-a,--all}'[list all the changes that have been made]' \
+ '(-l|--local)'{-l,--local}'[list the changes that have been made locally]' \
+ '(-r|--remote)'{-r,--remote}'[list the changes that have been made in the scratch org]' \
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:lightning:test:create)
+ _command_args=(
+ '(-n|--testname)'{-n,--testname}'[name of the generated Lightning test]' \
+ '(-t|--template)'{-t,--template}'[template to use for file creation (DefaultLightningTest*)]' \
+ '(-d|--outputdir)'{-d,--outputdir}'[folder for saving the created files]' \
+ '(-r|--reflect)'{-r,--reflect}'[switch to return flag detailed information]' \
+ '(--json)--json[JSON output]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:lightning:test:install)
+ _command_args=(
+ '(-w|--wait)'{-w,--wait}'[number of minutes to wait for installation status (default:2)]' \
+ '(-r|--releaseversion)'{-r,--releaseversion}'[release version of Lightning Testing Service (default:latest)]' \
+ '(-t|--packagetype)'{-t,--packagetype}'[type of unmanaged package. 'full' option contains both jasmine and mocha, plus examples (full*,jasmine,mocha)]' \
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:apex:test:report)
+ _command_args=(
+ '(-i|--testrunid)'{-i,--testrunid}'[ID of test run]' \
+ '(-c|--codecoverage)'{-c,--codecoverage}'[retrieve code coverage results]' \
+ '(-d|--outputdir)'{-d,--outputdir}'[directory to store test run files]:file:_files' \
+ '(-r|--resultformat)'{-r,--resultformat}'[test result format emitted to stdout; --json flag overrides this parameter (human*,tap,junit,json)]' \
+ '(-w|--wait)'{-w,--wait}'[the streaming client socket timeout (in minutes) (default:6, min:2)]' \
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ '(--verbose)--verbose[display Apex test processing details]' \
+ )
+ ;;
+ force:apex:test:run)
+ _command_args=(
+ '(-n|--classnames)'{-n,--classnames}'[comma-separated list of Apex test class names to run]' \
+ '(-s|--suitenames)'{-s,--suitenames}'[comma-separated list of Apex test suite names to run]' \
+ '(-t|--tests)'{-t,--tests}'[comma-separated list of Apex test class names or IDs and, if applicable, test methods to run]' \
+ '(-c|--codecoverage)'{-c,--codecoverage}'[retrieve code coverage results]' \
+ '(-d|--outputdir)'{-d,--outputdir}'[directory to store test run files]:file:_files' \
+ '(-l|--testlevel)'{-l,--testlevel}'[testlevel enum value (RunLocalTests,RunAllTestsInOrg,RunSpecifiedTests)]' \
+ '(-r|--resultformat)'{-r,--resultformat}'[test result format emitted to stdout; --json flag overrides this parameter (human*,tap,junit,json)]' \
+ '(-w|--wait)'{-w,--wait}'[the streaming client socket timeout (in minutes) (default:6, min:2)]' \
+ '(--precompilewait)--precompilewait[how long to wait (in minutes) for Apex pre-compilation (default:3, min:3)]' \
+ '(-y|--synchronous)'{-y,--synchronous}'[run tests from a single class synchronously]' \
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ '(--verbose)--verbose[display Apex test processing details]' \
+ )
+ ;;
+ force:lightning:test:run)
+ _command_args=(
+ '(-a|--appname)'{-a,--appname}'[name of your Lightning test application]' \
+ '(-d|--outputdir)'{-d,--outputdir}'[directory path to store test run artifacts: for example, log files and test results]:file:_files' \
+ '(-r|--resultformat)'{-r,--resultformat}'[test result format emitted to stdout; --json flag overrides this parameter (human*,tap,junit,json)]' \
+ '(-f|--configfile)'{-f,--configfile}'[path to config file for the test]:file:_files' \
+ '(-o|--leavebrowseropen)'{-o,--leavebrowseropen}'[leave browser open]' \
+ '(-t|--timeout)'{-t,--timeout}'[time (ms) to wait for results element in dom (default:60000)]' \
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:data:tree:export)
+ _command_args=(
+ '(-q|--query)'{-q,--query}'[soql query, or filepath of file containing a soql query, to retrieve records]' \
+ '(-p|--plan)'{-p,--plan}'[generate mulitple sobject tree files and a plan definition file for aggregated import]' \
+ '(-x|--prefix)'{-x,--prefix}'[prefix of generated files]' \
+ '(-d|--outputdir)'{-d,--outputdir}'[directory to store files]:file:_files' \
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:data:tree:import)
+ _command_args=(
+ '(-f|--sobjecttreefiles)'{-f,--sobjecttreefiles}'[comma-delimited, ordered paths of json files containing collection of record trees to insert]:file:_files' \
+ '(-p|--plan)'{-p,--plan}'[path to plan to insert multiple data files that have master-detail relationships]:file:_files' \
+ '(-c|--contenttype)'{-c,--contenttype}'[if data file extension is not .json, provide content type (applies to all files)]' \
+ '(--confighelp)--confighelp[display schema information for the --plan configuration file to stdout; if you use this option, all other options except --json are ignored]' \
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:apex:trigger:create)
+ _command_args=(
+ '(-n|--triggername)'{-n,--triggername}'[name of the generated Apex trigger]' \
+ '(-t|--template)'{-t,--template}'[template to use for file creation (ApexTrigger*)]' \
+ '(-d|--outputdir)'{-d,--outputdir}'[folder for saving the created files]' \
+ '(-r|--reflect)'{-r,--reflect}'[switch to return flag detailed information]' \
+ '(-a|--apiversion)'{-a,--apiversion}'[API version number (45.0*,44.0)]' \
+ '(-s|--sobject)'{-s,--sobject}'[sObject to create a trigger on (SOBJECT*)]' \
+ '(-e|--triggerevents)'{-e,--triggerevents}'[events that fire the trigger (before insert*,before update,before delete,after insert,after update,after delete,after undelete)]' \
+ '(--json)--json[JSON output]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:package:uninstall)
+ _command_args=(
+ '(-w|--wait)'{-w,--wait}'[number of minutes to wait for uninstall status]' \
+ '(-p|--package)'{-p,--package}'[ID (starts with 04t) or alias of the package version to uninstall]' \
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:package:uninstall:report)
+ _command_args=(
+ '(-i|--requestid)'{-i,--requestid}'[ID of the package uninstall request you want to check]' \
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:package:update)
+ _command_args=(
+ '(-p|--package)'{-p,--package}'[ID (starts with 0Ho) or alias of the package to update]' \
+ '(-n|--name)'{-n,--name}'[new package name]' \
+ '(-d|--description)'{-d,--description}'[new package description]' \
+ '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:project:upgrade)
+ _command_args=(
+ '(-f|--forceupgrade)'{-f,--forceupgrade}'[run all upgrades even if project has already been upgraded]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:package:version:create)
+ _command_args=(
+ '(-p|--package)'{-p,--package}'[ID (starts with 0Ho) or alias of the package to create a version of]' \
+ '(-d|--path)'{-d,--path}'[path to directory that contains the contents of the package]:file:_files' \
+ '(-f|--definitionfile)'{-f,--definitionfile}'[path to a definition file similar to scratch org definition file that contains the list of features and org preferences that the metadata of the package version depends on]:file:_files' \
+ '(-b|--branch)'{-b,--branch}'[the package version’s branch]' \
+ '(-t|--tag)'{-t,--tag}'[the package version’s tag]' \
+ '(-k|--installationkey)'{-k,--installationkey}'[installation key for key-protected package (either --installationkey or --installationkeybypass is required)]' \
+ '(-x|--installationkeybypass)'{-x,--installationkeybypass}'[bypass the installation key requirement (either --installationkey or --installationkeybypass is required)]' \
+ '(-r|--preserve)'{-r,--preserve}'[temp files are preserved that would otherwise be deleted]' \
+ '(-j|--validateschema)'{-j,--validateschema}'[sfdx-project.json is validated against JSON schema]' \
+ '(-w|--wait)'{-w,--wait}'[minutes to wait for the package version to be created (default:0)]' \
+ '(-s|--buildinstance)'{-s,--buildinstance}'[the instance where the package version will be created——for example, NA50]' \
+ '(-o|--sourceorg)'{-o,--sourceorg}'[the source org ID used to copy the org shape for the build org]' \
+ '(-a|--versionname)'{-a,--versionname}'[the name of the package version to be created]' \
+ '(-n|--versionnumber)'{-n,--versionnumber}'[the version number of the package version to be created]' \
+ '(-e|--versiondescription)'{-e,--versiondescription}'[the description of the package version to be created]' \
+ '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:package1:version:create)
+ _command_args=(
+ '(-i|--packageid)'{-i,--packageid}'[ID of the metadata package (starts with 033) of which you’re creating a new version]' \
+ '(-n|--name)'{-n,--name}'[package version name]' \
+ '(-d|--description)'{-d,--description}'[package version description]' \
+ '(-v|--version)'{-v,--version}'[package version in major.minor format, for example, 3.2]' \
+ '(-m|--managedreleased)'{-m,--managedreleased}'[create a managed package version]' \
+ '(-r|--releasenotesurl)'{-r,--releasenotesurl}'[release notes URL]' \
+ '(-p|--postinstallurl)'{-p,--postinstallurl}'[post install URL]' \
+ '(-k|--installationkey)'{-k,--installationkey}'[installation key for key-protected package (default: null)]' \
+ '(-w|--wait)'{-w,--wait}'[minutes to wait for the package version to be created (default: 2 minutes)]' \
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:package1:version:create:get)
+ _command_args=(
+ '(-i|--requestid)'{-i,--requestid}'[PackageUploadRequest ID]' \
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:package:version:create:list)
+ _command_args=(
+ '(-c|--createdlastdays)'{-c,--createdlastdays}'[created in the last specified number of days (starting at 00:00:00 of first day to now; 0 for today)]' \
+ '(-s|--status)'{-s,--status}'[filter the list by version creation request status (Queued,InProgress,Success,Error)]' \
+ '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:package:version:create:report)
+ _command_args=(
+ '(-i|--packagecreaterequestid)'{-i,--packagecreaterequestid}'[package version creation request ID (starts with 08c)]' \
+ '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:package1:version:display)
+ _command_args=(
+ '(-i|--packageversionid)'{-i,--packageversionid}'[metadata package version ID (starts with 04t)]' \
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:package:version:list)
+ _command_args=(
+ '(-c|--createdlastdays)'{-c,--createdlastdays}'[created in the last specified number of days (starting at 00:00:00 of first day to now; 0 for today)]' \
+ '(-m|--modifiedlastdays)'{-m,--modifiedlastdays}'[list items modified in the specified last number of days (starting at 00:00:00 of first day to now; 0 for today)]' \
+ '(-p|--packages)'{-p,--packages}'[filter results on specified comma-delimited packages (aliases or 0Ho IDs)]' \
+ '(-r|--released)'{-r,--released}'[display released versions only]' \
+ '(-o|--orderby)'{-o,--orderby}'[order by the specified package version fields]' \
+ '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \
+ '(--concise)--concise[display limited package version details]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ '(--verbose)--verbose[display extended package version details]' \
+ )
+ ;;
+ force:package1:version:list)
+ _command_args=(
+ '(-i|--packageid)'{-i,--packageid}'[metadata package ID (starts with 033)]' \
+ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:package:version:promote)
+ _command_args=(
+ '(-p|--package)'{-p,--package}'[ID (starts with 04t) or alias of the package version to promote]' \
+ '(-n|--noprompt)'{-n,--noprompt}'[no prompt to confirm setting the package version as released]' \
+ '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:package:version:report)
+ _command_args=(
+ '(-p|--package)'{-p,--package}'[ID (starts with 04t) or alias of the package to retrieve details for]' \
+ '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ '(--verbose)--verbose[displays extended package version details]' \
+ )
+ ;;
+ force:package:version:update)
+ _command_args=(
+ '(-p|--package)'{-p,--package}'[ID (starts with 04t) or alias of the package to update a version of]' \
+ '(-a|--versionname)'{-a,--versionname}'[new package version name]' \
+ '(-e|--versiondescription)'{-e,--versiondescription}'[new package version description]' \
+ '(-b|--branch)'{-b,--branch}'[new package version branch]' \
+ '(-t|--tag)'{-t,--tag}'[new package version tag]' \
+ '(-k|--installationkey)'{-k,--installationkey}'[new installation key for key-protected package (default: null)]' \
+ '(-v|--targetdevhubusername)'{-v,--targetdevhubusername}'[username or alias for the dev hub org; overrides default dev hub org]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ force:auth:web:login)
+ _command_args=(
+ '(-i|--clientid)'{-i,--clientid}'[OAuth client ID (sometimes called the consumer key)]' \
+ '(-r|--instanceurl)'{-r,--instanceurl}'[the login URL of the instance the org lives on]' \
+ '(-d|--setdefaultdevhubusername)'{-d,--setdefaultdevhubusername}'[set the authenticated org as the default dev hub org for scratch org creation]' \
+ '(-s|--setdefaultusername)'{-s,--setdefaultusername}'[set the authenticated org as the default username that all commands run against]' \
+ '(-a|--setalias)'{-a,--setalias}'[set an alias for the authenticated org]' \
+ '(--disablemasking)--disablemasking[disable masking of user input (for use with problematic terminals)]' \
+ '(-p|--noprompt)'{-p,--noprompt}'[do not prompt for auth confirmation in demo mode]' \
+ '(--json)--json[format output as json]' \
+ '(--loglevel)--loglevel[logging level for this command invocation (error*,trace,debug,info,warn,fatal)]' \
+ )
+ ;;
+ esac
+
+_arguments \
+ $_command_args \
+ && return 0
diff --git a/plugins/singlechar/README.md b/plugins/singlechar/README.md
new file mode 100644
index 000000000..d89029900
--- /dev/null
+++ b/plugins/singlechar/README.md
@@ -0,0 +1,118 @@
+# Singlechar plugin
+
+This plugin adds single char shortcuts (and combinations) for some commands.
+
+To use it, add `singlechar` to the plugins array of your zshrc file:
+```
+plugins=(... singlechar)
+```
+
+## Aliases
+
+### CAT, GREP, CURL, WGET
+
+| Alias | Command | Description |
+|-------|------------------|-------------|
+| y | `grep -Ri` | Find case-insensitive string in all files and directories, recursively. Follows symlinks. |
+| n | `grep -Rvi` | Same as above but only show lines that don't match the string. |
+| f | `grep -Rli` | Same as 'y' but only print the filenames where the string is found. |
+| fn | `grep -Rlvi` | Same as above but only show files that don't contain the string. |
+| f. | `find . \| grep` | Grep list of files in current directory |
+| f: | `find` | 'find' command |
+| p | `less` | 'less' command |
+| m | `man` | 'man' command |
+| d | `wget` | 'wget' command |
+| u | `curl` | 'curl' command |
+| c | `cat` | 'cat' command |
+| w | `echo >` | Write arguments to file, overwriting it if it exists. |
+| a | `echo >>` | Write arguments to file, appending them if the file exists. |
+| w: | `cat >` | Write stdin to file, overwriting if it exists. |
+| a: | `cat >>` | Write stdin to file, appending it if the file exists. |
+
+### XARGS
+
+These aliases are versions of the aliases above but using xargs. This can be used
+by piping the arguments to the xargs aliases.
+
+| Alias | Command | Description |
+|-------|----------------------|---------------------------------|
+| x | `xargs` | 'xargs' command |
+| xy | `xargs grep -Ri` | Same as 'y' alias using xargs. |
+| xn | `xargs grep -Rvi` | Same as 'n' alias using xargs. |
+| xf | `xargs grep -Rli` | Same as 'f' alias using xargs. |
+| xfn | `xargs grep -Rlvi` | Same as 'fn' alias using xargs. |
+| xf. | `xargs find \| grep` | Same as 'f.' alias using xargs. |
+| xf: | `xargs find` | Same as 'f:' alias using xargs. |
+| xc | `xargs cat` | Same as 'c' alias using xargs. |
+| xp | `xargs less` | Same as 'p' alias using xargs. |
+| xm | `xargs man` | Same as 'm' alias using xargs. |
+| xd | `xargs wget` | Same as 'd' alias using xargs. |
+| xu | `xargs curl` | Same as 'u' alias using xargs. |
+| xw | `xargs echo >` | Same as 'w' alias using xargs. |
+| xa | `xargs echo >>` | Same as 'a' alias using xargs. |
+| xw: | `xargs cat >` | Same as 'w:' alias using xargs. |
+| xa: | `xargs >>` | Same as 'a:' alias using xargs. |
+
+### SUDO
+
+These aliases are versions of the aliases above in [CAT, GREP, CURL, WGET](#cat-grep-curl-wget)
+but using sudo to run them with root permission.
+
+| Alias | Command | Description |
+|-------|-----------------------|--------------------------------|
+| s | `sudo` | 'sudo' command |
+| sy | `sudo grep -Ri` | Same as 'y' alias using sudo. |
+| sn | `sudo grep -Riv` | Same as 'n' alias using sudo. |
+| sf | `sudo grep -Rli` | Same as 'f' alias using sudo. |
+| sfn | `sudo grep -Rlvi` | Same as 'fn' alias using sudo. |
+| sf. | `sudo find . \| grep` | Same as 'f.' alias using sudo. |
+| sf: | `sudo find` | Same as 'f:' alias using sudo. |
+| sp | `sudo less` | Same as 'p' alias using sudo. |
+| sm | `sudo man` | Same as 'm' alias using sudo. |
+| sd | `sudo wget` | Same as 'd' alias using sudo. |
+| sc | `sudo cat` | Same as 'c' alias using sudo. |
+| sw | `sudo echo >` | Same as 'w' alias using sudo. |
+| sa | `sudo echo >>` | Same as 'a' alias using sudo. |
+| sw: | `sudo cat >` | Same as 'w:' alias using sudo. |
+| sa: | `sudo cat >>` | Same as 'a:' alias using sudo. |
+
+### SUDO-XARGS
+
+Same as above but using both sudo and xargs.
+
+| Alias | Command | Description |
+|-------|---------------------------|---------------------------------|
+| sx | `sudo xargs` | 'sudo xargs' command |
+| sxy | `sudo xargs grep -Ri` | Same as 'xy' alias using sudo. |
+| sxn | `sudo xargs grep -Riv` | Same as 'xn' alias using sudo. |
+| sxf | `sudo xargs grep -li` | Same as 'xf' alias using sudo. |
+| sxfn | `sudo xargs grep -lvi` | Same as 'xfn' alias using sudo. |
+| sxf. | `sudo xargs find \| grep` | Same as 'xf.' alias using sudo. |
+| sxf: | `sudo xargs find` | Same as 'xf:' alias using sudo. |
+| sxp | `sudo xargs less` | Same as 'xp' alias using sudo. |
+| sxm | `sudo xargs man` | Same as 'xm' alias using sudo. |
+| sxd | `sudo xargs wget` | Same as 'xd' alias using sudo. |
+| sxu | `sudo xargs curl` | Same as 'xu' alias using sudo. |
+| sxc | `sudo xargs cat` | Same as 'xc' alias using sudo. |
+| sxw | `sudo xargs echo >` | Same as 'xw' alias using sudo. |
+| sxa | `sudo xargs echo >>` | Same as 'xa' alias using sudo. |
+| sxw: | `sudo xargs cat >` | Same as 'xw:' alias using sudo. |
+| sxa: | `sudo xargs cat >>` | Same as 'xa:' alias using sudo. |
+
+## Options
+
+The commands `grep`, `sudo`, `wget`, `curl`, and `less` can be configured to use other commands
+via the setup variables below, before Oh My Zsh is sourced. If they are not set yet, they will
+use their default values:
+
+| Setup variable | Default value |
+|----------------|---------------|
+| GREP | `grep` |
+| ROOT | `sudo` |
+| WGET | `wget` |
+| CURL | `curl` |
+| PAGER | `less` |
+
+## Author
+
+- [Karolin Varner](https://github.com/koraa)
diff --git a/plugins/singlechar/singlechar.plugin.zsh b/plugins/singlechar/singlechar.plugin.zsh
index 44bd998aa..d4b0b6735 100644
--- a/plugins/singlechar/singlechar.plugin.zsh
+++ b/plugins/singlechar/singlechar.plugin.zsh
@@ -1,13 +1,3 @@
-################################################################################
-# FILE: singlechar.plugin.zsh
-# DESCRIPTION: oh-my-zsh plugin file.
-# AUTHOR: Michael Varner (musikmichael@web.de)
-# VERSION: 1.0.0
-#
-# This plugin adds single char shortcuts (and combinations) for some commands.
-#
-################################################################################
-
###########################
# Settings
@@ -130,4 +120,4 @@ alias sxd='"$ROOT" xargs "$WGET"'
alias sxu='"$ROOT" xargs "$CURL"'
alias sxw:='"$ROOT" xargs cat >'
-alias sxa:='"$ROOT" xargs cat >>' \ No newline at end of file
+alias sxa:='"$ROOT" xargs cat >>'
diff --git a/plugins/sprunge/README.md b/plugins/sprunge/README.md
new file mode 100644
index 000000000..2a363d3bd
--- /dev/null
+++ b/plugins/sprunge/README.md
@@ -0,0 +1,31 @@
+# Sprunge plugin
+
+This plugin uploads data and fetch URL from the pastebin http://sprunge.us
+
+To enable it, add 'sprunge' to your plugins:
+```
+plugins=(... sprunge)
+```
+
+## Usage
+
+| Command | Description |
+|------------------------------|-------------------------------------------|
+| `sprunge filename.txt` | Uploads filename.txt |
+| `sprunge "this is a string"` | Uploads plain text |
+| `sprunge < filename.txt` | Redirects filename.txt content to sprunge |
+| `echo data \| sprunge` | Any piped data will be uploaded |
+
+Once sprunge has processed the input it will give you a unique HTTP address:
+```
+$ sprunge "hello"
+http://sprunge.us/XxjnKz
+```
+
+## Notes
+
+- Sprunge accepts piped data, stdin redirection, text strings as input or filenames.
+ Only one of these can be used at a time.
+- Argument precedence goes as follows: stdin > piped input > text strings.
+- If a filename is mispelled or doesn't have the necessary path description, it will NOT
+ generate an error, but instead treat it as a text string.
diff --git a/plugins/sprunge/sprunge.plugin.zsh b/plugins/sprunge/sprunge.plugin.zsh
index e1c89b729..5d5687a82 100644
--- a/plugins/sprunge/sprunge.plugin.zsh
+++ b/plugins/sprunge/sprunge.plugin.zsh
@@ -2,12 +2,9 @@
# Created by the blogger at the URL below...I don't know where to find his/her name
# Original found at https://www.shellperson.net/sprunge-pastebin-script/
-usage() {
-description | fmt -s >&2
-}
-
-description() {
-cat << HERE
+sprunge() {
+ if [[ "$1" = --help ]]; then
+ fmt -s >&2 << EOF
DESCRIPTION
Upload data and fetch URL from the pastebin http://sprunge.us
@@ -19,44 +16,41 @@ USAGE
piped_data | $0
NOTES
---------------------------------------------------------------------------
-* INPUT METHODS *
-$0 can accept piped data, STDIN redirection [<filename.txt], text strings following the command as arguments, or filenames as arguments. Only one of these methods can be used at a time, so please see the note on precedence. Also, note that using a pipe or STDIN redirection will treat tabs as spaces, or disregard them entirely (if they appear at the beginning of a line). So I suggest using a filename as an argument if tabs are important either to the function or readability of the code.
-
-* PRECEDENCE *
-STDIN redirection has precedence, then piped input, then a filename as an argument, and finally text strings as an arguments.
-
- EXAMPLE:
- echo piped | "$0" arguments.txt < stdin_redirection.txt
-
-In this example, the contents of file_as_stdin_redirection.txt would be uploaded. Both the piped_text and the file_as_argument.txt are ignored. If there is piped input and arguments, the arguments will be ignored, and the piped input uploaded.
-
-* FILENAMES *
-If a filename is misspelled or doesn't have the necessary path description, it will NOT generate an error, but will instead treat it as a text string and upload it.
---------------------------------------------------------------------------
-
-HERE
-exit
-}
-
-sprunge() {
- if [ -t 0 ]; then
- echo Running interactively, checking for arguments... >&2
- if [ "$*" ]; then
- echo Arguments present... >&2
- if [ -f "$*" ]; then
- echo Uploading the contents of "$*"... >&2
- cat "$*"
- else
- echo Uploading the text: \""$*"\"... >&2
- echo "$*"
- fi | curl -F 'sprunge=<-' http://sprunge.us
- else
- echo No arguments found, printing USAGE and exiting. >&2
- usage
- fi
- else
- echo Using input from a pipe or STDIN redirection... >&2
- curl -F 'sprunge=<-' http://sprunge.us
- fi
+ Input Methods:
+ $0 can accept piped data, STDIN redirection [< filename.txt], text strings following the command as arguments, or filenames as arguments. Only one of these methods can be used at a time, so please see the note on precedence. Also, note that using a pipe or STDIN redirection will treat tabs as spaces, or disregard them entirely (if they appear at the beginning of a line). So I suggest using a filename as an argument if tabs are important either to the function or readability of the code.
+
+ Precedence:
+ STDIN redirection has precedence, then piped input, then a filename as an argument, and finally text strings as arguments. For example:
+
+ echo piped | $0 arguments.txt < stdin_redirection.txt
+
+ In this example, the contents of file_as_stdin_redirection.txt would be uploaded. Both the piped_text and the file_as_argument.txt are ignored. If there is piped input and arguments, the arguments will be ignored, and the piped input uploaded.
+
+ Filenames:
+ If a filename is misspelled or doesn't have the necessary path description, it will NOT generate an error, but will instead treat it as a text string and upload it.
+
+EOF
+ return
+ fi
+
+ if [ -t 0 ]; then
+ echo Running interactively, checking for arguments... >&2
+ if [ "$*" ]; then
+ echo Arguments present... >&2
+ if [ -f "$*" ]; then
+ echo Uploading the contents of "$*"... >&2
+ cat "$*"
+ else
+ echo Uploading the text: \""$*"\"... >&2
+ echo "$*"
+ fi | curl -F 'sprunge=<-' http://sprunge.us
+ else
+ echo No arguments found, printing USAGE and exiting. >&2
+ sprunge --help
+ return 1
+ fi
+ else
+ echo Using input from a pipe or STDIN redirection... >&2
+ curl -F 'sprunge=<-' http://sprunge.us
+ fi
}
diff --git a/plugins/ssh-agent/ssh-agent.plugin.zsh b/plugins/ssh-agent/ssh-agent.plugin.zsh
index a7a4ee33a..6ab041c21 100644
--- a/plugins/ssh-agent/ssh-agent.plugin.zsh
+++ b/plugins/ssh-agent/ssh-agent.plugin.zsh
@@ -5,14 +5,14 @@ function _start_agent() {
zstyle -s :omz:plugins:ssh-agent lifetime lifetime
# start ssh-agent and setup environment
- echo starting ssh-agent...
+ echo Starting ssh-agent...
ssh-agent -s ${lifetime:+-t} ${lifetime} | sed 's/^echo/#echo/' >! $_ssh_env_cache
chmod 600 $_ssh_env_cache
. $_ssh_env_cache > /dev/null
}
function _add_identities() {
- local id line sig
+ local id line sig lines
local -a identities loaded_sigs loaded_ids not_loaded
zstyle -a :omz:plugins:ssh-agent identities identities
@@ -32,10 +32,12 @@ function _add_identities() {
fi
# get list of loaded identities' signatures and filenames
- for line in ${(f)"$(ssh-add -l)"}; do
- loaded_sigs+=${${(z)line}[2]}
- loaded_ids+=${${(z)line}[3]}
- done
+ if lines=$(ssh-add -l); then
+ for line in ${(f)lines}; do
+ loaded_sigs+=${${(z)line}[2]}
+ loaded_ids+=${${(z)line}[3]}
+ done
+ fi
# add identities if not already loaded
for id in $identities; do
diff --git a/plugins/sublime/README.md b/plugins/sublime/README.md
index 2ad629fad..22999241f 100644
--- a/plugins/sublime/README.md
+++ b/plugins/sublime/README.md
@@ -1,25 +1,37 @@
-## sublime
+# sublime
-Plugin for Sublime Text, a cross platform text and code editor, available for Linux, Mac OS X, and Windows.
+Plugin for [Sublime Text](https://www.sublimetext.com/), a cross platform text and code editor,
+available for Linux, macOS, and Windows.
-### Requirements
+To use the plugin, add `sublime` to the plugins array of your zshrc file:
- * [Sublime Text](https://www.sublimetext.com/)
+```zsh
+plugins=(... sublime)
+```
-### Usage
+Sublime Text has to be installed to use the plugin.
- * If `st` command is called without an argument, launch Sublime Text
+## Usage
- * If `st` is passed a directory, `cd` to it and open it in Sublime Text
+The plugin defines several aliases, such as:
- * If `st` is passed a file, open it in Sublime Text
+- `st`: opens Sublime Text. If passed a file or directory, Sublime Text will open it.
- * If `stt` command is called, it is equivalent to `st .`, opening the current folder in Sublime Text
+- `stt`: open Sublime Text on the current directory.
- * If `sst` command is called, it is like `sudo st`, opening the file or folder in Sublime Text. Useful for editing system protected files.
+- `sst`: if `sudo` is available, `sst` will open Sublime Text with root permissions, so that
+ you can modify any file or directory that you pass it. Useful to edit system files.
- * If `stp` command is called, it find a `.sublime-project` file by traversing up the directory structure. If there is no `.sublime-project` file, but if the current folder is a Git repo, opens up the root directory of the repo. If the current folder is not a Git repo, then opens up the current directory.
+There are also a few functions available:
- * If `stn` command is called without an argument, create a stub `.sublime-project` file in the current working directory if one does not already exist
+- `find_project` (or `stp` alias): if called, the function will search for a `.sublime-project` file
+ on the current directory or its parents, until it finds none.
- * If `stn` is passed a directory, create a stub `.sublime-project` file in it
+ If there is no `.sublime-project` file but the current folder is in a Git repository, it will open
+ Sublime Text on the root directory of the repository.
+
+ If there is no Git repository, it will then open Sublime Text on the current directory.
+
+- `create_project` (or `stn` alias): if called without an argument, create a stub `.sublime-project`
+ file in the current working directory, if one does not already exist. If passed a directory, create
+ a stub `.sublime-project` file in it.
diff --git a/plugins/sublime/sublime.plugin.zsh b/plugins/sublime/sublime.plugin.zsh
index 485028d9f..dd5063360 100644
--- a/plugins/sublime/sublime.plugin.zsh
+++ b/plugins/sublime/sublime.plugin.zsh
@@ -1,121 +1,118 @@
-# Sublime Text Aliases
+# Sublime Text aliases
-() {
+alias st=subl
+alias stt='subl .'
-if [[ "$OSTYPE" == linux* ]]; then
- local _sublime_linux_paths
- _sublime_linux_paths=(
+# Define sst only if sudo exists
+(( $+commands[sudo] )) && alias sst='sudo subl'
+
+alias stp=find_project
+alias stn=create_project
+
+
+# Search for the Sublime Text command if not found
+(( $+commands[subl] )) || {
+ declare -a _sublime_paths
+
+ if [[ "$OSTYPE" == linux* ]]; then
+ if [[ "$(uname -r)" = *icrosoft* ]]; then
+ _sublime_paths=(
+ "$(wslpath -u 'C:\Program Files\Sublime Text 3\subl.exe' 2>/dev/null)"
+ "$(wslpath -u 'C:\Program Files\Sublime Text 2\subl.exe' 2>/dev/null)"
+ )
+ else
+ _sublime_paths=(
"$HOME/bin/sublime_text"
"/opt/sublime_text/sublime_text"
"/opt/sublime_text_3/sublime_text"
"/usr/bin/sublime_text"
"/usr/local/bin/sublime_text"
"/usr/bin/subl"
- "/opt/sublime_text_3/sublime_text"
"/usr/bin/subl3"
+ )
+ fi
+ elif [[ "$OSTYPE" = darwin* ]]; then
+ _sublime_paths=(
+ "/usr/local/bin/subl"
+ "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl"
+ "/Applications/Sublime Text 3.app/Contents/SharedSupport/bin/subl"
+ "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl"
+ "$HOME/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl"
+ "$HOME/Applications/Sublime Text 3.app/Contents/SharedSupport/bin/subl"
+ "$HOME/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl"
)
- for _sublime_path in $_sublime_linux_paths; do
- if [[ -a $_sublime_path ]]; then
- st_run() { $_sublime_path $@ >/dev/null 2>&1 &| }
- st_run_sudo() {sudo $_sublime_path $@ >/dev/null 2>&1}
- alias sst=st_run_sudo
- alias st=st_run
- break
- fi
- done
-elif [[ "$OSTYPE" = darwin* ]]; then
- local _sublime_darwin_paths
- _sublime_darwin_paths=(
- "/usr/local/bin/subl"
- "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl"
- "/Applications/Sublime Text 3.app/Contents/SharedSupport/bin/subl"
- "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl"
- "$HOME/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl"
- "$HOME/Applications/Sublime Text 3.app/Contents/SharedSupport/bin/subl"
- "$HOME/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl"
+ elif [[ "$OSTYPE" = cygwin ]]; then
+ _sublime_paths=(
+ "$(cygpath "$ProgramW6432/Sublime Text 2")/subl.exe"
+ "$(cygpath "$ProgramW6432/Sublime Text 3")/subl.exe"
)
- for _sublime_path in $_sublime_darwin_paths; do
- if [[ -a $_sublime_path ]]; then
- subl () { "$_sublime_path" $* }
- alias st=subl
- break
- fi
- done
-elif [[ "$OSTYPE" = 'cygwin' ]]; then
- local _sublime_cygwin_paths
- _sublime_cygwin_paths=(
- "$(cygpath $ProgramW6432/Sublime\ Text\ 2)/sublime_text.exe"
- "$(cygpath $ProgramW6432/Sublime\ Text\ 3)/sublime_text.exe"
+ elif [[ "$OSTYPE" = msys ]]; then
+ _sublime_paths=(
+ "/c/Program Files/Sublime Text 2/subl.exe"
+ "/c/Program Files/Sublime Text 3/subl.exe"
)
- for _sublime_path in $_sublime_cygwin_paths; do
- if [[ -a $_sublime_path ]]; then
- subl () { "$_sublime_path" $* }
- alias st=subl
- break
- fi
- done
-fi
+ fi
-}
+ for _sublime_path in $_sublime_paths; do
+ if [[ -a $_sublime_path ]]; then
+ alias subl="'$_sublime_path'"
+ (( $+commands[sudo] )) && alias sst="sudo '$_sublime_path'"
+ break
+ fi
+ done
-alias stt='st .'
+ unset _sublime_paths _sublime_path
+}
-find_project()
-{
- local PROJECT_ROOT="${PWD}"
- local FINAL_DEST="."
+function find_project() {
+ local PROJECT_ROOT="${PWD}"
+ local FINAL_DEST="."
- while [[ $PROJECT_ROOT != "/" && ! -d "$PROJECT_ROOT/.git" ]]; do
- PROJECT_ROOT=$(dirname $PROJECT_ROOT)
- done
+ while [[ $PROJECT_ROOT != "/" && ! -d "$PROJECT_ROOT/.git" ]]; do
+ PROJECT_ROOT=$(dirname $PROJECT_ROOT)
+ done
- if [[ $PROJECT_ROOT != "/" ]]; then
- local PROJECT_NAME="${PROJECT_ROOT##*/}"
+ if [[ $PROJECT_ROOT != "/" ]]; then
+ local PROJECT_NAME="${PROJECT_ROOT##*/}"
- local SUBL_DIR=$PROJECT_ROOT
- while [[ $SUBL_DIR != "/" && ! -f "$SUBL_DIR/$PROJECT_NAME.sublime-project" ]]; do
- SUBL_DIR=$(dirname $SUBL_DIR)
- done
+ local SUBL_DIR=$PROJECT_ROOT
+ while [[ $SUBL_DIR != "/" && ! -f "$SUBL_DIR/$PROJECT_NAME.sublime-project" ]]; do
+ SUBL_DIR=$(dirname $SUBL_DIR)
+ done
- if [[ $SUBL_DIR != "/" ]]; then
- FINAL_DEST="$SUBL_DIR/$PROJECT_NAME.sublime-project"
- else
- FINAL_DEST=$PROJECT_ROOT
- fi
+ if [[ $SUBL_DIR != "/" ]]; then
+ FINAL_DEST="$SUBL_DIR/$PROJECT_NAME.sublime-project"
+ else
+ FINAL_DEST=$PROJECT_ROOT
fi
+ fi
- st $FINAL_DEST
+ subl $FINAL_DEST
}
function create_project() {
-
- local _target=$1
-
- if [[ "${_target}" == "" ]]; then
- _target=$(pwd);
- elif [[ ! -d ${_target} ]]; then
- echo "${_target} is not a valid directory"
- return 1
- fi
-
- local _sublime_project_file=$_target/$(basename $_target).sublime-project
-
- if [[ ! -f $_sublime_project_file ]]; then
-
- touch $_sublime_project_file
-
- echo -e "{" >> $_sublime_project_file
- echo -e "\t\"folders\":" >> $_sublime_project_file
- echo -e "\t\t[{" >> $_sublime_project_file
- echo -e "\t\t\t\"path\": \".\"," >> $_sublime_project_file
- echo -e "\t\t\t\"file_exclude_patterns\": []" >> $_sublime_project_file
- echo -e "\t\t}]" >> $_sublime_project_file
- echo -e "}" >> $_sublime_project_file
-
- echo -e "New Sublime Text project created:\n\t${_sublime_project_file}"
-
- fi
+ local _target=$1
+
+ if [[ "${_target}" == "" ]]; then
+ _target=$(pwd);
+ elif [[ ! -d ${_target} ]]; then
+ echo "${_target} is not a valid directory"
+ return 1
+ fi
+
+ local _sublime_project_file=$_target/$(basename $_target).sublime-project
+
+ if [[ ! -f $_sublime_project_file ]]; then
+ touch $_sublime_project_file
+
+ echo -e "{" >> $_sublime_project_file
+ echo -e "\t\"folders\":" >> $_sublime_project_file
+ echo -e "\t\t[{" >> $_sublime_project_file
+ echo -e "\t\t\t\"path\": \".\"," >> $_sublime_project_file
+ echo -e "\t\t\t\"file_exclude_patterns\": []" >> $_sublime_project_file
+ echo -e "\t\t}]" >> $_sublime_project_file
+ echo -e "}" >> $_sublime_project_file
+
+ echo -e "New Sublime Text project created:\n\t${_sublime_project_file}"
+ fi
}
-
-alias stp=find_project
-alias stn=create_project
diff --git a/plugins/sudo/README.md b/plugins/sudo/README.md
index ebfdfd10d..25eb85829 100644
--- a/plugins/sudo/README.md
+++ b/plugins/sudo/README.md
@@ -13,10 +13,10 @@ Easily prefix your current or previous commands with `sudo` by pressing <kbd>esc
)
```
-2. Reload the source file or restart your Terminal session:
+2. Restart your shell or restart your Terminal session:
```console
- $ source ~/.zshrc
+ $ exec zsh
$
```
diff --git a/plugins/sudo/sudo.plugin.zsh b/plugins/sudo/sudo.plugin.zsh
index 0b843822e..f405b025f 100644
--- a/plugins/sudo/sudo.plugin.zsh
+++ b/plugins/sudo/sudo.plugin.zsh
@@ -28,4 +28,6 @@ sudo-command-line() {
}
zle -N sudo-command-line
# Defined shortcut keys: [Esc] [Esc]
-bindkey "\e\e" sudo-command-line
+bindkey -M emacs '\e\e' sudo-command-line
+bindkey -M vicmd '\e\e' sudo-command-line
+bindkey -M viins '\e\e' sudo-command-line
diff --git a/plugins/supervisor/README.md b/plugins/supervisor/README.md
new file mode 100644
index 000000000..1eacea6d3
--- /dev/null
+++ b/plugins/supervisor/README.md
@@ -0,0 +1,12 @@
+# supervisor plugin
+
+This plugin adds tab-completion for `supervisord`/`supervisorctl` in [Supervisor](http://supervisord.org/).
+Supervisor is a client/server system that allows its users to monitor and control a number
+of processes on UNIX-like operating systems.
+
+To use it, add `supervisor` to the plugins array in your zshrc file:
+```zsh
+plugins=(... supervisor)
+```
+
+These scripts are from [zshcompfunc4supervisor](https://bitbucket.org/hhatto/zshcompfunc4supervisor).
diff --git a/plugins/supervisor/_supervisorctl b/plugins/supervisor/_supervisorctl
index d159f20e0..9f576c0c0 100644
--- a/plugins/supervisor/_supervisorctl
+++ b/plugins/supervisor/_supervisorctl
@@ -112,6 +112,13 @@ _supervisorctl_start() {
'*::supvervisor process:_get_supervisor_procs'
}
+(( $+functions[_supervisorctl_restart] )) ||
+_supervisorctl_restart() {
+ # TODO: add 'all'
+ _arguments -s \
+ '*::supvervisor process:_get_supervisor_procs'
+}
+
(( $+functions[_supervisorctl_status] )) ||
_supervisorctl_status() {
_arguments \
diff --git a/plugins/svn-fast-info/svn-fast-info.plugin.zsh b/plugins/svn-fast-info/svn-fast-info.plugin.zsh
index 9ea7f641d..fe5265315 100644
--- a/plugins/svn-fast-info/svn-fast-info.plugin.zsh
+++ b/plugins/svn-fast-info/svn-fast-info.plugin.zsh
@@ -16,30 +16,30 @@ function svn_prompt_info() {
if [[ -n $repo_need_upgrade ]]; then
printf '%s%s%s%s%s%s%s\n' \
- $ZSH_PROMPT_BASE_COLOR \
- $ZSH_THEME_SVN_PROMPT_PREFIX \
- $ZSH_PROMPT_BASE_COLOR \
- $repo_need_upgrade \
- $ZSH_PROMPT_BASE_COLOR \
- $ZSH_THEME_SVN_PROMPT_SUFFIX \
- $ZSH_PROMPT_BASE_COLOR
+ "$ZSH_PROMPT_BASE_COLOR" \
+ "$ZSH_THEME_SVN_PROMPT_PREFIX" \
+ "$ZSH_PROMPT_BASE_COLOR" \
+ "$repo_need_upgrade" \
+ "$ZSH_PROMPT_BASE_COLOR" \
+ "$ZSH_THEME_SVN_PROMPT_SUFFIX" \
+ "$ZSH_PROMPT_BASE_COLOR"
else
- printf '%s%s%s %s%s:%s%s%s%s%s' \
- $ZSH_PROMPT_BASE_COLOR \
- $ZSH_THEME_SVN_PROMPT_PREFIX \
+ printf '%s%s%s%s %s%s%s:%s%s%s%s' \
+ "$ZSH_PROMPT_BASE_COLOR" \
+ "$ZSH_THEME_SVN_PROMPT_PREFIX" \
\
"$(svn_status_info $info)" \
- $ZSH_PROMPT_BASE_COLOR \
+ "$ZSH_PROMPT_BASE_COLOR" \
\
- $ZSH_THEME_BRANCH_NAME_COLOR \
- $(svn_current_branch_name $info) \
- $ZSH_PROMPT_BASE_COLOR \
+ "$ZSH_THEME_BRANCH_NAME_COLOR" \
+ "$(svn_current_branch_name $info)" \
+ "$ZSH_PROMPT_BASE_COLOR" \
\
- $(svn_current_revision $info) \
- $ZSH_PROMPT_BASE_COLOR \
+ "$(svn_current_revision $info)" \
+ "$ZSH_PROMPT_BASE_COLOR" \
\
- $ZSH_THEME_SVN_PROMPT_SUFFIX \
- $ZSH_PROMPT_BASE_COLOR
+ "$ZSH_THEME_SVN_PROMPT_SUFFIX" \
+ "$ZSH_PROMPT_BASE_COLOR"
fi
}
@@ -63,11 +63,12 @@ function svn_current_revision() {
function svn_status_info() {
local svn_status_string="$ZSH_THEME_SVN_PROMPT_CLEAN"
local svn_status="$(svn status 2> /dev/null)";
- if command grep -E '^\s*A' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_ADDITIONS:-+}"; fi
- if command grep -E '^\s*D' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_DELETIONS:-✖}"; fi
- if command grep -E '^\s*M' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_MODIFICATIONS:-✎}"; fi
- if command grep -E '^\s*[R~]' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_REPLACEMENTS:-∿}"; fi
- if command grep -E '^\s*\?' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_UNTRACKED:-?}"; fi
- if command grep -E '^\s*[CI!L]' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_DIRTY:-'!'}"; fi
+ if command grep -E '^\s*A' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string${ZSH_THEME_SVN_PROMPT_ADDITIONS:-+}"; fi
+ if command grep -E '^\s*D' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string${ZSH_THEME_SVN_PROMPT_DELETIONS:-✖}"; fi
+ if command grep -E '^\s*M' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string${ZSH_THEME_SVN_PROMPT_MODIFICATIONS:-✎}"; fi
+ if command grep -E '^\s*[R~]' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string${ZSH_THEME_SVN_PROMPT_REPLACEMENTS:-∿}"; fi
+ if command grep -E '^\s*\?' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string${ZSH_THEME_SVN_PROMPT_UNTRACKED:-?}"; fi
+ if command grep -E '^\s*[CI!L]' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string${ZSH_THEME_SVN_PROMPT_DIRTY:-!}"; fi
echo $svn_status_string
}
+
diff --git a/plugins/swiftpm/README.md b/plugins/swiftpm/README.md
index 07ca25651..a722c03e4 100644
--- a/plugins/swiftpm/README.md
+++ b/plugins/swiftpm/README.md
@@ -2,7 +2,7 @@
## Description
-This plugin provides a few utilities that make you faster on your daily work with the [Swift Package Manager](https://github.com/apple/swift-package-manager).
+This plugin provides a few utilities that make you faster on your daily work with the [Swift Package Manager](https://github.com/apple/swift-package-manager), as well as autocompletion for Swift 5.1.
To start using it, add the `swiftpm` plugin to your `plugins` array in `~/.zshrc`:
diff --git a/plugins/swiftpm/_swift b/plugins/swiftpm/_swift
index bed6e13a7..fe6f1c9aa 100644
--- a/plugins/swiftpm/_swift
+++ b/plugins/swiftpm/_swift
@@ -72,16 +72,25 @@ _swift_build() {
"--build-path[Specify build/cache directory ]:Specify build/cache directory :_files"
"(--chdir -C)"{--chdir,-C}"[]: :_files"
"--package-path[Change working directory before any other operation]:Change working directory before any other operation:_files"
- "--sanitize[Turn on runtime checks for erroneous behavior]: :{_values '' 'address[enable Address sanitizer]' 'thread[enable Thread sanitizer]'}"
+ "--sanitize[Turn on runtime checks for erroneous behavior]: :{_values '' 'address[enable Address sanitizer]' 'thread[enable Thread sanitizer]' 'undefined[enable Undefined Behavior sanitizer]'}"
"--disable-prefetching[]"
"--skip-update[Skip updating dependencies from their remote during a resolution]"
"--disable-sandbox[Disable using the sandbox when executing subprocesses]"
+ "--disable-package-manifest-caching[Disable caching Package.swift manifests]"
"--version[]"
"--destination[]: :_files"
"(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]"
"--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]"
"--static-swift-stdlib[Link Swift stdlib statically]"
- "--enable-build-manifest-caching[Enable llbuild manifest caching \[Experimental\]]"
+ "--force-resolved-versions[]"
+ "--disable-automatic-resolution[Disable automatic resolution if Package.resolved file is out-of-date]"
+ "--enable-index-store[Enable indexing-while-building feature]"
+ "--disable-index-store[Disable indexing-while-building feature]"
+ "--enable-pubgrub-resolver[\[Experimental\] Enable the new Pubgrub dependency resolver]"
+ "--enable-parseable-module-interfaces[]"
+ "--trace-resolver[]"
+ "(--jobs -j)"{--jobs,-j}"[The number of jobs to spawn in parallel during the build process]:The number of jobs to spawn in parallel during the build process: "
+ "--enable-test-discovery[Enable test discovery on platforms without Objective-C runtime]"
"--build-tests[Build both source and test targets]"
"--product[Build the specified product]:Build the specified product: "
"--target[Build the specified target]:Build the specified target: "
@@ -108,17 +117,28 @@ _swift_run() {
"--build-path[Specify build/cache directory ]:Specify build/cache directory :_files"
"(--chdir -C)"{--chdir,-C}"[]: :_files"
"--package-path[Change working directory before any other operation]:Change working directory before any other operation:_files"
- "--sanitize[Turn on runtime checks for erroneous behavior]: :{_values '' 'address[enable Address sanitizer]' 'thread[enable Thread sanitizer]'}"
+ "--sanitize[Turn on runtime checks for erroneous behavior]: :{_values '' 'address[enable Address sanitizer]' 'thread[enable Thread sanitizer]' 'undefined[enable Undefined Behavior sanitizer]'}"
"--disable-prefetching[]"
"--skip-update[Skip updating dependencies from their remote during a resolution]"
"--disable-sandbox[Disable using the sandbox when executing subprocesses]"
+ "--disable-package-manifest-caching[Disable caching Package.swift manifests]"
"--version[]"
"--destination[]: :_files"
"(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]"
"--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]"
"--static-swift-stdlib[Link Swift stdlib statically]"
- "--enable-build-manifest-caching[Enable llbuild manifest caching \[Experimental\]]"
+ "--force-resolved-versions[]"
+ "--disable-automatic-resolution[Disable automatic resolution if Package.resolved file is out-of-date]"
+ "--enable-index-store[Enable indexing-while-building feature]"
+ "--disable-index-store[Disable indexing-while-building feature]"
+ "--enable-pubgrub-resolver[\[Experimental\] Enable the new Pubgrub dependency resolver]"
+ "--enable-parseable-module-interfaces[]"
+ "--trace-resolver[]"
+ "(--jobs -j)"{--jobs,-j}"[The number of jobs to spawn in parallel during the build process]:The number of jobs to spawn in parallel during the build process: "
+ "--enable-test-discovery[Enable test discovery on platforms without Objective-C runtime]"
"--skip-build[Skip building the executable product]"
+ "--build-tests[Build both source and test targets]"
+ "--repl[Launch Swift REPL for the package]"
)
_arguments $arguments && return
}
@@ -140,16 +160,25 @@ _swift_package() {
"--build-path[Specify build/cache directory ]:Specify build/cache directory :_files"
"(--chdir -C)"{--chdir,-C}"[]: :_files"
"--package-path[Change working directory before any other operation]:Change working directory before any other operation:_files"
- "--sanitize[Turn on runtime checks for erroneous behavior]: :{_values '' 'address[enable Address sanitizer]' 'thread[enable Thread sanitizer]'}"
+ "--sanitize[Turn on runtime checks for erroneous behavior]: :{_values '' 'address[enable Address sanitizer]' 'thread[enable Thread sanitizer]' 'undefined[enable Undefined Behavior sanitizer]'}"
"--disable-prefetching[]"
"--skip-update[Skip updating dependencies from their remote during a resolution]"
"--disable-sandbox[Disable using the sandbox when executing subprocesses]"
+ "--disable-package-manifest-caching[Disable caching Package.swift manifests]"
"--version[]"
"--destination[]: :_files"
"(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]"
"--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]"
"--static-swift-stdlib[Link Swift stdlib statically]"
- "--enable-build-manifest-caching[Enable llbuild manifest caching \[Experimental\]]"
+ "--force-resolved-versions[]"
+ "--disable-automatic-resolution[Disable automatic resolution if Package.resolved file is out-of-date]"
+ "--enable-index-store[Enable indexing-while-building feature]"
+ "--disable-index-store[Disable indexing-while-building feature]"
+ "--enable-pubgrub-resolver[\[Experimental\] Enable the new Pubgrub dependency resolver]"
+ "--enable-parseable-module-interfaces[]"
+ "--trace-resolver[]"
+ "(--jobs -j)"{--jobs,-j}"[The number of jobs to spawn in parallel during the build process]:The number of jobs to spawn in parallel during the build process: "
+ "--enable-test-discovery[Enable test discovery on platforms without Objective-C runtime]"
'(-): :->command'
'(-)*:: :->arg'
)
@@ -158,33 +187,28 @@ _swift_package() {
(command)
local modes
modes=(
- 'edit:Put a package in editable mode'
- 'clean:Delete build artifacts'
- 'init:Initialize a new package'
+ 'completion-tool:Completion tool (for shell completions)'
'dump-package:Print parsed Package.swift as JSON'
'describe:Describe the current package'
+ 'clean:Delete build artifacts'
+ 'show-dependencies:Print the resolved dependency graph'
+ 'init:Initialize a new package'
'unedit:Remove a package from editable mode'
- 'update:Update package dependencies'
- 'completion-tool:Completion tool (for shell completions)'
'tools-version:Manipulate tools version of the current package'
- 'reset:Reset the complete cache/build directory'
+ 'fetch:'
'resolve:Resolve package dependencies'
+ 'reset:Reset the complete cache/build directory'
'generate-xcodeproj:Generates an Xcode project'
- 'fetch:'
- 'show-dependencies:Print the resolved dependency graph'
+ 'edit:Put a package in editable mode'
+ 'config:Manipulate configuration of the package'
+ 'update:Update package dependencies'
)
_describe "mode" modes
;;
(arg)
case ${words[1]} in
- (edit)
- _swift_package_edit
- ;;
- (clean)
- _swift_package_clean
- ;;
- (init)
- _swift_package_init
+ (completion-tool)
+ _swift_package_completion-tool
;;
(dump-package)
_swift_package_dump-package
@@ -192,91 +216,92 @@ _swift_package() {
(describe)
_swift_package_describe
;;
- (unedit)
- _swift_package_unedit
+ (clean)
+ _swift_package_clean
;;
- (update)
- _swift_package_update
+ (show-dependencies)
+ _swift_package_show-dependencies
;;
- (completion-tool)
- _swift_package_completion-tool
+ (init)
+ _swift_package_init
+ ;;
+ (unedit)
+ _swift_package_unedit
;;
(tools-version)
_swift_package_tools-version
;;
- (reset)
- _swift_package_reset
+ (fetch)
+ _swift_package_fetch
;;
(resolve)
_swift_package_resolve
;;
+ (reset)
+ _swift_package_reset
+ ;;
(generate-xcodeproj)
_swift_package_generate-xcodeproj
;;
- (fetch)
- _swift_package_fetch
+ (edit)
+ _swift_package_edit
;;
- (show-dependencies)
- _swift_package_show-dependencies
+ (config)
+ _swift_package_config
+ ;;
+ (update)
+ _swift_package_update
;;
esac
;;
esac
}
-_swift_package_edit() {
- arguments=(
- ":The name of the package to edit:_swift_dependency"
- "--revision[The revision to edit]:The revision to edit: "
- "--branch[The branch to create]:The branch to create: "
- "--path[Create or use the checkout at this path]:Create or use the checkout at this path:_files"
- )
- _arguments $arguments && return
-}
-
-_swift_package_clean() {
+_swift_package_completion-tool() {
arguments=(
+ ": :{_values '' 'generate-bash-script[generate Bash completion script]' 'generate-zsh-script[generate Bash completion script]' 'list-dependencies[list all dependencies' names]' 'list-executables[list all executables' names]'}"
)
_arguments $arguments && return
}
-_swift_package_init() {
+_swift_package_dump-package() {
arguments=(
- "--type[empty|library|executable|system-module]: :{_values '' 'empty[generates an empty project]' 'library[generates project for a dynamic library]' 'executable[generates a project for a cli executable]' 'system-module[generates a project for a system module]'}"
)
_arguments $arguments && return
}
-_swift_package_dump-package() {
+_swift_package_describe() {
arguments=(
+ "--type[json|text]: :{_values '' 'text[describe using text format]' 'json[describe using JSON format]'}"
)
_arguments $arguments && return
}
-_swift_package_describe() {
+_swift_package_clean() {
arguments=(
- "--type[json|text]: :{_values '' 'text[describe using text format]' 'json[describe using JSON format]'}"
)
_arguments $arguments && return
}
-_swift_package_unedit() {
+_swift_package_show-dependencies() {
arguments=(
- ":The name of the package to unedit:_swift_dependency"
- "--force[Unedit the package even if it has uncommited and unpushed changes.]"
+ "--format[text|dot|json|flatlist]: :{_values '' 'text[list dependencies using text format]' 'dot[list dependencies using dot format]' 'json[list dependencies using JSON format]'}"
)
_arguments $arguments && return
}
-_swift_package_update() {
+_swift_package_init() {
arguments=(
+ "--type[empty|library|executable|system-module|manifest]: :{_values '' 'empty[generates an empty project]' 'library[generates project for a dynamic library]' 'executable[generates a project for a cli executable]' 'system-module[generates a project for a system module]'}"
+ "--name[Provide custom package name]:Provide custom package name: "
)
_arguments $arguments && return
}
-_swift_package_completion-tool() {
+_swift_package_unedit() {
arguments=(
- ": :{_values '' 'generate-bash-script[generate Bash completion script]' 'generate-zsh-script[generate Bash completion script]' 'list-dependencies[list all dependencies' names]' 'list-executables[list all executables' names]'}"
+ ":The name of the package to unedit:_swift_dependency"
+ "--force[Unedit the package even if it has uncommited and unpushed changes.]"
)
_arguments $arguments && return
}
@@ -289,7 +314,7 @@ _swift_package_tools-version() {
_arguments $arguments && return
}
-_swift_package_reset() {
+_swift_package_fetch() {
arguments=(
)
_arguments $arguments && return
@@ -305,6 +330,12 @@ _swift_package_resolve() {
_arguments $arguments && return
}
+_swift_package_reset() {
+ arguments=(
+ )
+ _arguments $arguments && return
+}
+
_swift_package_generate-xcodeproj() {
arguments=(
"--xcconfig-overrides[Path to xcconfig file]:Path to xcconfig file:_files"
@@ -312,19 +343,78 @@ _swift_package_generate-xcodeproj() {
"--output[Path where the Xcode project should be generated]:Path where the Xcode project should be generated:_files"
"--legacy-scheme-generator[Use the legacy scheme generator]"
"--watch[Watch for changes to the Package manifest to regenerate the Xcode project]"
+ "--skip-extra-files[Do not add file references for extra files to the generated Xcode project]"
)
_arguments $arguments && return
}
-_swift_package_fetch() {
+_swift_package_edit() {
arguments=(
+ ":The name of the package to edit:_swift_dependency"
+ "--revision[The revision to edit]:The revision to edit: "
+ "--branch[The branch to create]:The branch to create: "
+ "--path[Create or use the checkout at this path]:Create or use the checkout at this path:_files"
)
_arguments $arguments && return
}
-_swift_package_show-dependencies() {
+_swift_package_config() {
+ arguments=(
+ '(-): :->command'
+ '(-)*:: :->arg'
+ )
+ _arguments $arguments && return
+ case $state in
+ (command)
+ local modes
+ modes=(
+ 'unset-mirror:Remove an existing mirror'
+ 'get-mirror:Print mirror configuration for the given package dependency'
+ 'set-mirror:Set a mirror for a dependency'
+ )
+ _describe "mode" modes
+ ;;
+ (arg)
+ case ${words[1]} in
+ (unset-mirror)
+ _swift_package_config_unset-mirror
+ ;;
+ (get-mirror)
+ _swift_package_config_get-mirror
+ ;;
+ (set-mirror)
+ _swift_package_config_set-mirror
+ ;;
+ esac
+ ;;
+ esac
+}
+
+_swift_package_config_unset-mirror() {
+ arguments=(
+ "--package-url[The package dependency url]:The package dependency url: "
+ "--mirror-url[The mirror url]:The mirror url: "
+ )
+ _arguments $arguments && return
+}
+
+_swift_package_config_get-mirror() {
+ arguments=(
+ "--package-url[The package dependency url]:The package dependency url: "
+ )
+ _arguments $arguments && return
+}
+
+_swift_package_config_set-mirror() {
+ arguments=(
+ "--package-url[The package dependency url]:The package dependency url: "
+ "--mirror-url[The mirror url]:The mirror url: "
+ )
+ _arguments $arguments && return
+}
+
+_swift_package_update() {
arguments=(
- "--format[text|dot|json|flatlist]: :{_values '' 'text[list dependencies using text format]' 'dot[list dependencies using dot format]' 'json[list dependencies using JSON format]'}"
)
_arguments $arguments && return
}
@@ -346,23 +436,34 @@ _swift_test() {
"--build-path[Specify build/cache directory ]:Specify build/cache directory :_files"
"(--chdir -C)"{--chdir,-C}"[]: :_files"
"--package-path[Change working directory before any other operation]:Change working directory before any other operation:_files"
- "--sanitize[Turn on runtime checks for erroneous behavior]: :{_values '' 'address[enable Address sanitizer]' 'thread[enable Thread sanitizer]'}"
+ "--sanitize[Turn on runtime checks for erroneous behavior]: :{_values '' 'address[enable Address sanitizer]' 'thread[enable Thread sanitizer]' 'undefined[enable Undefined Behavior sanitizer]'}"
"--disable-prefetching[]"
"--skip-update[Skip updating dependencies from their remote during a resolution]"
"--disable-sandbox[Disable using the sandbox when executing subprocesses]"
+ "--disable-package-manifest-caching[Disable caching Package.swift manifests]"
"--version[]"
"--destination[]: :_files"
"(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]"
"--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]"
"--static-swift-stdlib[Link Swift stdlib statically]"
- "--enable-build-manifest-caching[Enable llbuild manifest caching \[Experimental\]]"
+ "--force-resolved-versions[]"
+ "--disable-automatic-resolution[Disable automatic resolution if Package.resolved file is out-of-date]"
+ "--enable-index-store[Enable indexing-while-building feature]"
+ "--disable-index-store[Disable indexing-while-building feature]"
+ "--enable-pubgrub-resolver[\[Experimental\] Enable the new Pubgrub dependency resolver]"
+ "--enable-parseable-module-interfaces[]"
+ "--trace-resolver[]"
+ "(--jobs -j)"{--jobs,-j}"[The number of jobs to spawn in parallel during the build process]:The number of jobs to spawn in parallel during the build process: "
+ "--enable-test-discovery[Enable test discovery on platforms without Objective-C runtime]"
"--skip-build[Skip building the test target]"
"(--list-tests -l)"{--list-tests,-l}"[Lists test methods in specifier format]"
"--generate-linuxmain[Generate LinuxMain.swift entries for the package]"
"--parallel[Run the tests in parallel.]"
+ "--num-workers[Number of tests to execute in parallel.]:Number of tests to execute in parallel.: "
"(--specifier -s)"{--specifier,-s}"[]: : "
"--xunit-output[]: :_files"
"--filter[Run test cases matching regular expression, Format: <test-target>.<test-case> or <test-target>.<test-case>/<test>]:Run test cases matching regular expression, Format: <test-target>.<test-case> or <test-target>.<test-case>/<test>: "
+ "--enable-code-coverage[Test with code coverage enabled]"
)
_arguments $arguments && return
}
diff --git a/plugins/terminalapp/terminalapp.plugin.zsh b/plugins/terminalapp/terminalapp.plugin.zsh
deleted file mode 100644
index 7c0c278b9..000000000
--- a/plugins/terminalapp/terminalapp.plugin.zsh
+++ /dev/null
@@ -1,6 +0,0 @@
-# This file is intentionally empty.
-#
-# The terminalapp plugin is deprecated and may be removed in a future release.
-# Its functionality has been folded in to the core lib/termsupport.zsh, which
-# is loaded for all users. You can remove terminalapp from your $plugins list
-# once all your systems are updated to the current version of Oh My Zsh.
diff --git a/plugins/terminitor/README.md b/plugins/terminitor/README.md
new file mode 100644
index 000000000..8c0e02113
--- /dev/null
+++ b/plugins/terminitor/README.md
@@ -0,0 +1,9 @@
+# Terminitor plugin
+
+This plugin adds completions for the [Terminitor](https://github.com/achiurizo/terminitor) development workflow setup tool.
+
+To use it, add `terminitor` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... terminitor)
+```
diff --git a/plugins/terraform/README.md b/plugins/terraform/README.md
index e5d9e47b6..471aef24e 100644
--- a/plugins/terraform/README.md
+++ b/plugins/terraform/README.md
@@ -10,6 +10,12 @@ Current as of Terraform v0.11.7
### Usage
+To use it, add `terraform` to the plugins array of your `~/.zshrc` file:
+
+```shell
+plugins=(... terraform)
+```
+
* Type `terraform` into your prompt and hit `TAB` to see available completion options
### Expanding ZSH prompt with current Terraform workspace name
@@ -17,7 +23,6 @@ Current as of Terraform v0.11.7
If you want to get current Terraform workspace name in your ZSH prompt open
your .zsh-theme file and in a chosen place insert:
-```
-$FG[045]\
-$(tf_prompt_info)\
+```shell
+PROMPT=$'%{$fg[white]%}$(tf_prompt_info)%{$reset_color%} '
```
diff --git a/plugins/terraform/_terraform b/plugins/terraform/_terraform
index 1d1315a8a..5b3655801 100644
--- a/plugins/terraform/_terraform
+++ b/plugins/terraform/_terraform
@@ -1,6 +1,6 @@
#compdef terraform
-local -a _terraform_cmds
+local -a _terraform_cmds opt_args
_terraform_cmds=(
'apply:Builds or changes infrastructure'
'console:Interactive console for Terraform interpolations'
@@ -16,13 +16,21 @@ _terraform_cmds=(
'push:Upload this Terraform module to Atlas to run'
'refresh:Update local state file against real resources'
'show:Inspect Terraform state or plan'
+ 'state:Advanced state management'
'taint:Manually mark a resource for recreation'
'untaint:Manually unmark a resource as tainted'
'validate:Validates the Terraform files'
'version:Prints the Terraform version'
'workspace:Workspace management'
+ '0.12upgrade:Rewrites pre-0.12 module source code for v0.12'
)
+__012upgrade() {
+ _arguments \
+ '-yes[Skip the initial introduction messages and interactive confirmation. This can be used to run this command in batch from a script.]' \
+ '-force[ Override the heuristic that attempts to detect if a configuration is already written for v0.12 or later. Some of the transformations made by this command are not idempotent, so re-running against the same module may change the meanings expressions in the module.]'
+}
+
__apply() {
_arguments \
'-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]' \
@@ -35,7 +43,7 @@ __apply() {
'-refresh=[(true) Update state prior to checking for differences. This has no effect if a plan file is given to apply.]' \
'-state=[(terraform.tfstate) Path to read and save state (unless state-out is specified).]' \
'-state-out=[(path) Path to write state to that is different than "-state". This can be used to preserve the old state.]' \
- '-target=[(resource) Resource to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]' \
+ '-target=[(resource) Resource to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]:target:__statelist' \
'-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \
'-var-file=[(foo) Set variables in the Terraform configuration from a file. If "terraform.tfvars" or any ".auto.tfvars" files are present, they will be automatically loaded.]'
}
@@ -59,7 +67,7 @@ __destroy() {
'-refresh=[(true) Update state prior to checking for differences. This has no effect if a plan file is given to apply.]' \
'-state=[(terraform.tfstate) Path to read and save state (unless state-out is specified).]' \
'-state-out=[(path) Path to write state to that is different than "-state". This can be used to preserve the old state.]' \
- '-target=[(resource) Resource to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]' \
+ '-target=[(resource) Resource to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]:target:__statelist' \
'-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \
'-var-file=[(foo) Set variables in the Terraform configuration from a file. If "terraform.tfvars" or any ".auto.tfvars" files are present, they will be automatically loaded.]'
}
@@ -140,7 +148,7 @@ __plan() {
'-parallelism=[(10) Limit the number of concurrent operations.]' \
'-refresh=[(true) Update state prior to checking for differences.]' \
'-state=[(statefile) Path to a Terraform state file to use to look up Terraform-managed resources. By default it will use the state "terraform.tfstate" if it exists.]' \
- '-target=[(resource) Resource to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]' \
+ '-target=[(resource) Resource to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]:target:__statelist' \
'-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \
'-var-file=[(foo) Set variables in the Terraform configuration from a file. If "terraform.tfvars" or any ".auto.tfvars" files are present, they will be automatically loaded.]' \
}
@@ -172,7 +180,7 @@ __refresh() {
'-no-color[If specified, output will not contain any color.]' \
'-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]' \
'-state-out=[(path) Path to write state to that is different than "-state". This can be used to preserve the old state.]' \
- '-target=[(resource) A Resource Address to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]' \
+ '-target=[(resource) A Resource Address to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]:target:__statelist' \
'-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \
'-var-file=[(path) Set variables in the Terraform configuration from a file. If "terraform.tfvars" is present, it will be automatically loaded if this flag is not specified.]'
}
@@ -183,6 +191,70 @@ __show() {
'-no-color[If specified, output will not contain any color.]'
}
+__state() {
+ local -a __state_cmds
+ __state_cmds=(
+ 'list:List resources in the state'
+ 'mv:Move an item in the state'
+ 'pull:Pull current state and output to stdout'
+ 'push:Update remote state from a local state file'
+ 'rm:Remove instances from the state'
+ 'show:Show a resource in the state'
+ )
+ _describe -t state "state commands" __state_cmds
+}
+
+__state_list() {
+ _arguments \
+ '-state=[(path) Path to a Terraform state file to use to look up Terraform-managed resources. By default it will use the state "terraform.tfstate" if it exists.]' \
+ '-id=[(id) Filters the results to include only instances whose resource types have an attribute named id whose value equals the given id string.]' \
+ "*:address:__statelist"
+}
+
+__state_mv() {
+ _arguments \
+ "-dry-run[If set, prints out what would've been moved but doesn't actually move anything.]" \
+ "-backup=[(path) Path where Terraform should write the backup for the original state. This can't be disabled. If not set, Terraform will write it to the same path as the statefile with a \".backup\" extension.]:file:_files" \
+ "-backup-out=[(path) Path where Terraform should write the backup for the destination state. This can't be disabled. If not set, Terraform will write it to the same path as the destination state file with a backup extension. This only needs to be specified if -state-out is set to a different path than -state.]:file:_files" \
+ "-lock=[(true|false) Lock the state files when locking is supported.]:lock:(true false)" \
+ "-lock-timeout=[(seconds) Duration to retry a state lock.]" \
+ '-state=[(path) Path to the source state file. Defaults to the configured backend, or "terraform.tfstate"]:file:_files' \
+ "-state-out=[(path) Path to the destination state file to write to. If this isn't specified, the source state file will be used. This can be a new or existing path.]:file:_files" \
+ "::" \
+ ":source:__statelist" \
+ ":destination: "
+}
+
+__state_push() {
+ _arguments \
+ "-force[Write the state even if lineages don't match or the remote serial is higher.]" \
+ '-lock=[(true|false) Lock the state file when locking is supported.]:lock:(true false)' \
+ "-lock-timeout=[(seconds) Duration to retry a state lock.]" \
+ "::" \
+ ":destination:_files"
+}
+
+__state_rm() {
+ _arguments \
+ "-dry-run[If set, prints out what would've been removed but doesn't actually remove anything.]" \
+ "-backup=[(path) Path where Terraform should write the backup for the original state.]:file:_files" \
+ "-lock=[(true|false) Lock the state files when locking is supported.]:lock:(true false)" \
+ "-lock-timeout=[(seconds) Duration to retry a state lock.]" \
+ '-state=[(path) Path to the state file to update. Defaults to the current workspace state.]:file:_files' \
+ "*:address:__statelist"
+}
+
+
+__state_show() {
+ _arguments \
+ '-state=[(path) Path to a Terraform state file to use to look up Terraform-managed resources. By default it will use the state "terraform.tfstate" if it exists.]' \
+ "*:address:__statelist"
+}
+
+__statelist() {
+ compadd $(terraform state list $opt_args[-state])
+}
+
__taint() {
_arguments \
'-allow-missing[If specified, the command will succeed (exit code 0) even if the resource is missing.]' \
@@ -192,7 +264,8 @@ __taint() {
'-module=[(path) The module path where the resource lives. By default this will be root. Child modules can be specified by names. Ex. "consul" or "consul.vpc" (nested modules).]' \
'-no-color[If specified, output will not contain any color.]' \
'-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]' \
- '-state-out=[(path) Path to write updated state file. By default, the "-state" path will be used.]'
+ '-state-out=[(path) Path to write updated state file. By default, the "-state" path will be used.]' \
+ "*:address:__statelist"
}
__untaint() {
@@ -236,6 +309,8 @@ fi
local -a _command_args
case "$words[1]" in
+ 0.12upgrade)
+ __012upgrade ;;
apply)
__apply ;;
console)
@@ -264,6 +339,14 @@ case "$words[1]" in
__refresh ;;
show)
__show ;;
+ state)
+ test $CURRENT -lt 3 && __state
+ [[ $words[2] = "list" ]] && __state_list
+ [[ $words[2] = "mv" ]] && __state_mv
+ [[ $words[2] = "push" ]] && __state_push
+ [[ $words[2] = "rm" ]] && __state_rm
+ [[ $words[2] = "show" ]] && __state_show
+ ;;
taint)
__taint ;;
untaint)
diff --git a/plugins/thefuck/README.md b/plugins/thefuck/README.md
index a9b7550d7..bd407b316 100644
--- a/plugins/thefuck/README.md
+++ b/plugins/thefuck/README.md
@@ -6,4 +6,4 @@
Press `ESC` twice to correct previous console command.
## Notes
-`Esc`-`Esc` key binding conflicts with [sudo](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/sudo) plugin.
+`Esc`-`Esc` key binding conflicts with [sudo](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/sudo) plugin.
diff --git a/plugins/thefuck/thefuck.plugin.zsh b/plugins/thefuck/thefuck.plugin.zsh
index ac88e67de..b8586c70d 100644
--- a/plugins/thefuck/thefuck.plugin.zsh
+++ b/plugins/thefuck/thefuck.plugin.zsh
@@ -15,4 +15,6 @@ fuck-command-line() {
}
zle -N fuck-command-line
# Defined shortcut keys: [Esc] [Esc]
-bindkey "\e\e" fuck-command-line
+bindkey -M emacs '\e\e' fuck-command-line
+bindkey -M vicmd '\e\e' fuck-command-line
+bindkey -M viins '\e\e' fuck-command-line
diff --git a/plugins/thor/README.md b/plugins/thor/README.md
new file mode 100644
index 000000000..09c705d9a
--- /dev/null
+++ b/plugins/thor/README.md
@@ -0,0 +1,10 @@
+# Thor plugin
+
+This plugin adds completion for [Thor](http://whatisthor.com/),
+a ruby toolkit for building powerful command-line interfaces.
+
+To use it, add `thor` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... thor)
+```
diff --git a/plugins/timer/timer.plugin.zsh b/plugins/timer/timer.plugin.zsh
index 231134e7d..728377c5c 100644
--- a/plugins/timer/timer.plugin.zsh
+++ b/plugins/timer/timer.plugin.zsh
@@ -25,5 +25,6 @@ __timer_display_timer_precmd() {
fi
}
-preexec_functions+=(__timer_save_time_preexec)
-precmd_functions+=(__timer_display_timer_precmd)
+autoload -U add-zsh-hook
+add-zsh-hook preexec __timer_save_time_preexec
+add-zsh-hook precmd __timer_display_timer_precmd
diff --git a/plugins/tmux/README.md b/plugins/tmux/README.md
index 427119d3d..db57f5be2 100644
--- a/plugins/tmux/README.md
+++ b/plugins/tmux/README.md
@@ -1,6 +1,6 @@
# tmux
-This plugin provides aliases for [tmux](http://tmux.github.io/), the terminal multiplexer.
+This plugin provides aliases for [tmux](https://tmux.github.io/), the terminal multiplexer.
To use it add `tmux` to the plugins array in your zshrc file.
```zsh
@@ -37,3 +37,5 @@ The plugin also supports the following -
| `ZSH_TMUX_ITERM2` | Sets the `-CC` option for iTerm2 tmux integration (default: `false`) |
| `ZSH_TMUX_FIXTERM_WITHOUT_256COLOR` | `$TERM` to use for non 256-color terminals (default: `screen`) |
| `ZSH_TMUX_FIXTERM_WITH_256COLOR` | `$TERM` to use for 256-color terminals (default: `screen-256color` |
+| `ZSH_TMUX_CONFIG` | Set the configuration path (default: `$HOME/.tmux.conf`) |
+| `ZSH_TMUX_UNICODE` | Set `tmux -u` option to support unicode |
diff --git a/plugins/tmux/tmux.extra.conf b/plugins/tmux/tmux.extra.conf
index beffd380c..c4aaad0b0 100644
--- a/plugins/tmux/tmux.extra.conf
+++ b/plugins/tmux/tmux.extra.conf
@@ -1,2 +1,2 @@
set -g default-terminal $ZSH_TMUX_TERM
-source $HOME/.tmux.conf
+source-file $ZSH_TMUX_CONFIG \ No newline at end of file
diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh
index 2f3c3e79d..e52443a71 100644
--- a/plugins/tmux/tmux.plugin.zsh
+++ b/plugins/tmux/tmux.plugin.zsh
@@ -34,6 +34,10 @@ alias tkss='tmux kill-session -t'
# Tmux states this should be screen-256color, but you may need to change it on
# systems without the proper terminfo
: ${ZSH_TMUX_FIXTERM_WITH_256COLOR:=screen-256color}
+# Set the configuration path
+: ${ZSH_TMUX_CONFIG:=$HOME/.tmux.conf}
+# Set -u option to support unicode
+: ${ZSH_TMUX_UNICODE:=false}
# Determine if the terminal supports 256 colors
if [[ $terminfo[colors] == 256 ]]; then
@@ -43,7 +47,8 @@ else
fi
# Set the correct local config file to use.
-if [[ "$ZSH_TMUX_ITERM2" == "false" && -e "$HOME/.tmux.conf" ]]; then
+if [[ "$ZSH_TMUX_ITERM2" == "false" && -e "$ZSH_TMUX_CONFIG" ]]; then
+ export ZSH_TMUX_CONFIG
export _ZSH_TMUX_FIXED_CONFIG="${0:h:a}/tmux.extra.conf"
else
export _ZSH_TMUX_FIXED_CONFIG="${0:h:a}/tmux.only.conf"
@@ -59,13 +64,18 @@ function _zsh_tmux_plugin_run() {
local -a tmux_cmd
tmux_cmd=(command tmux)
[[ "$ZSH_TMUX_ITERM2" == "true" ]] && tmux_cmd+=(-CC)
+ [[ "$ZSH_TMUX_UNICODE" == "true" ]] && tmux_cmd+=(-u)
# Try to connect to an existing session.
[[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] && $tmux_cmd attach
# If failed, just run tmux, fixing the TERM variable if requested.
if [[ $? -ne 0 ]]; then
- [[ "$ZSH_TMUX_FIXTERM" == "true" ]] && tmux_cmd+=(-f "$_ZSH_TMUX_FIXED_CONFIG")
+ if [[ "$ZSH_TMUX_FIXTERM" == "true" ]]; then
+ tmux_cmd+=(-f "$_ZSH_TMUX_FIXED_CONFIG")
+ elif [[ -e "$ZSH_TMUX_CONFIG" ]]; then
+ tmux_cmd+=(-f "$ZSH_TMUX_CONFIG")
+ fi
$tmux_cmd new-session
fi
diff --git a/plugins/tmuxinator/_tmuxinator b/plugins/tmuxinator/_tmuxinator
index 37032f8d8..9ae25ac38 100644
--- a/plugins/tmuxinator/_tmuxinator
+++ b/plugins/tmuxinator/_tmuxinator
@@ -1,3 +1,6 @@
+#compdef tmuxinator mux
+#autoload
+
_tmuxinator() {
local commands projects
commands=(${(f)"$(tmuxinator commands zsh)"})
@@ -17,5 +20,4 @@ _tmuxinator() {
return
}
-compdef _tmuxinator tmuxinator mux
-alias mux="tmuxinator"
+compdef _tmuxinator tmuxinator
diff --git a/plugins/torrent/README.md b/plugins/torrent/README.md
new file mode 100644
index 000000000..079aafcb0
--- /dev/null
+++ b/plugins/torrent/README.md
@@ -0,0 +1,13 @@
+# torrent
+
+This plugin creates a Torrent file based on a [MagnetURI](https://en.wikipedia.org/wiki/Magnet_URI_scheme).
+
+To use it, add `torrent` to the plugins array in your zshrc file.
+
+```zsh
+plugins=(... torrent)
+```
+
+## Plugin commands
+
+* `magnet_to_torrent <MagnetURI>`: creates Torrent file.
diff --git a/plugins/tugboat/README.md b/plugins/tugboat/README.md
new file mode 100644
index 000000000..14f828f85
--- /dev/null
+++ b/plugins/tugboat/README.md
@@ -0,0 +1,12 @@
+# Tugboat plugin
+
+This plugin adds autocompletion for Tugboat, a command line tool for interacting with your
+[DigitalOcean droplets](https://www.digitalocean.com/products/droplets/).
+
+To use it, add it to the plugins array in your `~/.zshrc` file:
+
+```zsh
+plugins=(... tugboat)
+```
+
+Further documentation for Tugboat can be found in the [Tugboat repository](https://github.com/petems/tugboat).
diff --git a/plugins/ubuntu/README.md b/plugins/ubuntu/README.md
index caa6a90b4..f72182f5c 100644
--- a/plugins/ubuntu/README.md
+++ b/plugins/ubuntu/README.md
@@ -2,7 +2,7 @@
This plugin adds completions and aliases for [Ubuntu](https://www.ubuntu.com/).
-To use it, add `ubuntu` to the plugins array in your zshrc file:
+To use it, add `ubuntu` to the plugins array in your zshrc file:
```zsh
plugins=(... ubuntu)
@@ -10,34 +10,34 @@ plugins=(... ubuntu)
## Aliases
-Commands that use `$APT` will use apt if installed or defer to apt-get otherwise.
-
-| Alias | Command | Description |
-|---------|------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------|
-| acs | `apt-cache search` | Search the apt-cache with the specified criteria |
-| acp | `apt-cache policy` | Display the package source priorities |
-| afs | `apt-file search --regexp` | Perform a regular expression apt-file search |
-| afu | `sudo apt-file update` | Generates or updates the apt-file package database |
-| ag | `sudo $APT` | Run apt-get with sudo |
-| aga | `sudo $APT autoclean` | Clears out the local reposityory of retrieved package files that can no longer be downloaded |
-| agb | `sudo $APT build-dep <source_pkg>` | Installs/Removes packages to satisfy the dependencies of a specified build pkg |
-| agc | `sudo $APT clean` | Clears out the local repository of retrieved package files leaving everything from the lock files |
-| agd | `sudo $APT dselect-upgrade` | Follows dselect choices for package installation |
-| agi | `sudo $APT install <pkg>` | Install the specified package |
-| agli | `apt list --installed` | List the installed packages |
-| aglu | `sudo apt-get -u upgrade --assume-no` | Run an apt-get upgrade assuming no to all prompts |
-| agp | `sudo $APT purge <pkg>` | Remove a package including any configuration files |
-| agr | `sudo $APT remove <pkg>` | Remove a package |
-| ags | `$APT source <pkg>` | Fetch the source for the specified package |
-| agu | `sudo $APT update` | Update package list |
-| agud | `sudo $APT update && sudo $APT dist-upgrade` | Update packages list and perform a distribution upgrade |
-| agug | `sudo $APT upgrade` | Upgrade available packages |
-| agar | `sudo $APT autoremove` | Remove automatically installed packages no longer needed |
-| aguu | `sudo $APT update && sudo $APT upgrade` | Update packages list and upgrade available packages |
-| allpkgs | `dpkg --get-selections \| grep -v deinstall` | Print all installed packages |
-| kclean | `sudo aptitude remove -P ?and(~i~nlinux-(ima\|hea) ?not(~n$(uname -r)))` |Remove ALL kernel images and headers EXCEPT the one in use |
-| mydeb | `time dpkg-buildpackage -rfakeroot -us -uc` | Create a basic .deb package |
-| ppap | `sudo ppa-purge <ppa>` | Remove the specified PPA |
+Commands that use `$APT` will use `apt` if installed or defer to `apt-get` otherwise.
+
+| Alias | Command | Description |
+|---------|--------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------|
+| age | `sudo $APT` | Run apt-get with sudo |
+| acs | `apt-cache search` | Search the apt-cache with the specified criteria |
+| acp | `apt-cache policy` | Display the package source priorities |
+| afs | `apt-file search --regexp` | Perform a regular expression apt-file search |
+| afu | `sudo apt-file update` | Generates or updates the apt-file package database |
+| aga | `sudo $APT autoclean` | Clears out the local reposityory of retrieved package files that can no longer be downloaded |
+| agb | `sudo $APT build-dep <source_pkg>` | Installs/Removes packages to satisfy the dependencies of a specified build pkg |
+| agc | `sudo $APT clean` | Clears out the local repository of retrieved package files leaving everything from the lock files |
+| agd | `sudo $APT dselect-upgrade` | Follows dselect choices for package installation |
+| agi | `sudo $APT install <pkg>` | Install the specified package |
+| agli | `apt list --installed` | List the installed packages |
+| aglu | `sudo apt-get -u upgrade --assume-no` | Run an apt-get upgrade assuming no to all prompts |
+| agp | `sudo $APT purge <pkg>` | Remove a package including any configuration files |
+| agr | `sudo $APT remove <pkg>` | Remove a package |
+| ags | `$APT source <pkg>` | Fetch the source for the specified package |
+| agu | `sudo $APT update` | Update package list |
+| agud | `sudo $APT update && sudo $APT dist-upgrade` | Update packages list and perform a distribution upgrade |
+| agug | `sudo $APT upgrade` | Upgrade available packages |
+| agar | `sudo $APT autoremove` | Remove automatically installed packages no longer needed |
+| aguu | `sudo $APT update && sudo $APT upgrade` | Update packages list and upgrade available packages |
+| allpkgs | `dpkg --get-selections \| grep -v deinstall` | Print all installed packages |
+| kclean | `sudo aptitude remove -P ?and(~i~nlinux-(ima\|hea) ?not(~n$(uname -r)))` |Remove ALL kernel images and headers EXCEPT the one in use |
+| mydeb | `time dpkg-buildpackage -rfakeroot -us -uc` | Create a basic .deb package |
+| ppap | `sudo ppa-purge <ppa>` | Remove the specified PPA |
## Functions
@@ -47,6 +47,14 @@ Commands that use `$APT` will use apt if installed or defer to apt-get otherwise
| aar | `aar ppa:xxxxxx/xxxxxx [packagename]` | apt-add-repository with automatic install/upgrade of the desired package |
| apt-history | `apt-history <action>` | Prints the Apt history of the specified action |
| apt-list-packages | `apt-list-packages` | List packages by size |
-| kerndeb | `kerndeb` | Kernel-package building shortcut |
+| kerndeb | `kerndeb` | Kernel-package building shortcut |
+## Authors:
+- [@AlexBio](https://github.com/AlexBio)
+- [@dbb](https://github.com/dbb)
+- [@Mappleconfusers](https://github.com/Mappleconfusers)
+- [@trinaldi](https://github.com/trinaldi)
+- [Nicolas Jonas](https://nextgenthemes.com)
+- [@loctauxphilippe](https://github.com/loctauxphilippe)
+- [@HaraldNordgren](https://github.com/HaraldNordgren)
diff --git a/plugins/ubuntu/ubuntu.plugin.zsh b/plugins/ubuntu/ubuntu.plugin.zsh
index 198f06743..a53752fb2 100644
--- a/plugins/ubuntu/ubuntu.plugin.zsh
+++ b/plugins/ubuntu/ubuntu.plugin.zsh
@@ -1,76 +1,43 @@
-# Authors:
-# https://github.com/AlexBio
-# https://github.com/dbb
-# https://github.com/Mappleconfusers
-# https://github.com/trinaldi
-# Nicolas Jonas nextgenthemes.com
-# https://github.com/loctauxphilippe
-# https://github.com/HaraldNordgren
-#
-# Debian, Ubuntu and friends related zsh aliases and functions for zsh
-
(( $+commands[apt] )) && APT=apt || APT=apt-get
alias acs='apt-cache search'
-compdef _acs acs='apt-cache search'
alias afs='apt-file search --regexp'
-compdef _afs afs='apt-file search --regexp'
# These are apt/apt-get only
-alias ags="$APT source" # asrc
-compdef _ags ags="$APT source"
+alias ags="$APT source"
-alias acp='apt-cache policy' # app
-compdef _acp acp='apt-cache policy'
+alias acp='apt-cache policy'
#List all installed packages
alias agli='apt list --installed'
-compdef _agli agli='apt list --installed'
-
-# superuser operations ######################################################
# List available updates only
-alias aglu='sudo apt-get -u upgrade --assume-no'
-compdef _aglu aglu='sudo apt-get -u upgrade --assume-no'
+alias aglu='apt list --upgradable'
+
+# superuser operations ######################################################
alias afu='sudo apt-file update'
-compdef _afu afu='sudo apt-file update'
alias ppap='sudo ppa-purge'
-compdef _ppap ppap='sudo ppa-purge'
-
-alias ag="sudo $APT" # age - but without sudo
-alias aga="sudo $APT autoclean" # aac
-alias agb="sudo $APT build-dep" # abd
-alias agc="sudo $APT clean" # adc
-alias agd="sudo $APT dselect-upgrade" # ads
-alias agi="sudo $APT install" # ai
-alias agp="sudo $APT purge" # ap
-alias agr="sudo $APT remove" # ar
-alias agu="sudo $APT update" # ad
-alias agud="sudo $APT update && sudo $APT dist-upgrade" #adu
-alias agug="sudo $APT upgrade" # ag
-alias aguu="sudo $APT update && sudo $APT upgrade" #adg
+
+alias age="sudo $APT"
+alias aga="sudo $APT autoclean"
+alias agb="sudo $APT build-dep"
+alias agc="sudo $APT clean"
+alias agd="sudo $APT dselect-upgrade"
+alias agi="sudo $APT install"
+alias agp="sudo $APT purge"
+alias agr="sudo $APT remove"
+alias agu="sudo $APT update"
+alias agud="sudo $APT update && sudo $APT dist-upgrade"
+alias agug="sudo $APT upgrade"
+alias aguu="sudo $APT update && sudo $APT upgrade"
alias agar="sudo $APT autoremove"
-compdef _ag ag="sudo $APT"
-compdef _aga aga="sudo $APT autoclean"
-compdef _agb agb="sudo $APT build-dep"
-compdef _agc agc="sudo $APT clean"
-compdef _agd agd="sudo $APT dselect-upgrade"
-compdef _agi agi="sudo $APT install"
-compdef _agp agp="sudo $APT purge"
-compdef _agr agr="sudo $APT remove"
-compdef _agu agu="sudo $APT update"
-compdef _agud agud="sudo $APT update && sudo $APT dist-upgrade"
-compdef _agug agug="sudo $APT upgrade"
-compdef _aguu aguu="sudo $APT update && sudo $APT upgrade"
-compdef _agar agar="sudo $APT autoremove"
# Remove ALL kernel images and headers EXCEPT the one in use
-alias kclean='sudo aptitude remove -P ?and(~i~nlinux-(ima|hea) \
- ?not(~n`uname -r`))'
+alias kclean='sudo aptitude remove -P ?and(~i~nlinux-(ima|hea) ?not(~n`uname -r`))'
# Misc. #####################################################################
# print all installed packages
@@ -89,11 +56,11 @@ aar() {
else
read "PACKAGE?Type in the package name to install/upgrade with this ppa [${1##*/}]: "
fi
-
+
if [ -z "$PACKAGE" ]; then
PACKAGE=${1##*/}
fi
-
+
sudo apt-add-repository $1 && sudo $APT update
sudo $APT install $PACKAGE
}
@@ -136,22 +103,22 @@ apt-history () {
# Kernel-package building shortcut
kerndeb () {
- # temporarily unset MAKEFLAGS ( '-j3' will fail )
- MAKEFLAGS=$( print - $MAKEFLAGS | perl -pe 's/-j\s*[\d]+//g' )
- print '$MAKEFLAGS set to '"'$MAKEFLAGS'"
- appendage='-custom' # this shows up in $ (uname -r )
- revision=$(date +"%Y%m%d") # this shows up in the .deb file name
+ # temporarily unset MAKEFLAGS ( '-j3' will fail )
+ MAKEFLAGS=$( print - $MAKEFLAGS | perl -pe 's/-j\s*[\d]+//g' )
+ print '$MAKEFLAGS set to '"'$MAKEFLAGS'"
+ appendage='-custom' # this shows up in $(uname -r)
+ revision=$(date +"%Y%m%d") # this shows up in the .deb file name
- make-kpkg clean
+ make-kpkg clean
- time fakeroot make-kpkg --append-to-version "$appendage" --revision \
- "$revision" kernel_image kernel_headers
+ time fakeroot make-kpkg --append-to-version "$appendage" --revision \
+ "$revision" kernel_image kernel_headers
}
# List packages by size
function apt-list-packages {
- dpkg-query -W --showformat='${Installed-Size} ${Package} ${Status}\n' | \
- grep -v deinstall | \
- sort -n | \
- awk '{print $1" "$2}'
+ dpkg-query -W --showformat='${Installed-Size} ${Package} ${Status}\n' | \
+ grep -v deinstall | \
+ sort -n | \
+ awk '{print $1" "$2}'
}
diff --git a/plugins/ufw/README.md b/plugins/ufw/README.md
new file mode 100644
index 000000000..ac377cd17
--- /dev/null
+++ b/plugins/ufw/README.md
@@ -0,0 +1,18 @@
+# UFW plugin
+
+This plugin adds completion for managing everybody's favorite Uncomplicated Firewall (UFW),
+a simple interface for managing iptables. Learn more about [`UFW`](https://wiki.ubuntu.com/UncomplicatedFirewall).
+
+To use it, add ufw to the plugins array of your zshrc file:
+```
+plugins=(... ufw)
+```
+
+Some of the commands include:
+
+* `allow <port>/<optional: protocol>` add an allow rule
+* `default` set default policy
+* `delete <port>/<optional: protocol>` delete RULE
+* `deny <port>/<optional: protocol>` add deny rule
+* `disable` disables the firewall
+* `enable` enables the firewall
diff --git a/plugins/urltools/README.md b/plugins/urltools/README.md
index 548301c72..29c371070 100644
--- a/plugins/urltools/README.md
+++ b/plugins/urltools/README.md
@@ -21,9 +21,9 @@ Original idea and aliases: [Ruslan Spivak](https://ruslanspivak.wordpress.com/20
## Examples
```zsh
-urlencode 'https://github.com/robbyrussell/oh-my-zsh/search?q=urltools&type=Code'
-# returns https%3A%2F%2Fgithub.com%2Frobbyrussell%2Foh-my-zsh%2Fsearch%3Fq%3Durltools%26type%3DCode
+urlencode 'https://github.com/ohmyzsh/ohmyzsh/search?q=urltools&type=Code'
+# returns https%3A%2F%2Fgithub.com%2Fohmyzsh%2Fohmyzsh%2Fsearch%3Fq%3Durltools%26type%3DCode
-urldecode 'https%3A%2F%2Fgithub.com%2Frobbyrussell%2Foh-my-zsh%2Fsearch%3Fq%3Durltools%26type%3DCode'
-# returns https://github.com/robbyrussell/oh-my-zsh/search?q=urltools&type=Code
+urldecode 'https%3A%2F%2Fgithub.com%2Fohmyzsh%2Fohmyzsh%2Fsearch%3Fq%3Durltools%26type%3DCode'
+# returns https://github.com/ohmyzsh/ohmyzsh/search?q=urltools&type=Code
```
diff --git a/plugins/urltools/urltools.plugin.zsh b/plugins/urltools/urltools.plugin.zsh
index 47d9a34e4..b443e5027 100644
--- a/plugins/urltools/urltools.plugin.zsh
+++ b/plugins/urltools/urltools.plugin.zsh
@@ -12,11 +12,11 @@ if [[ $(whence node) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD
alias urlencode='node -e "console.log(encodeURIComponent(process.argv[1]))"'
alias urldecode='node -e "console.log(decodeURIComponent(process.argv[1]))"'
elif [[ $(whence python3) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xpython" ) ]]; then
- alias urlencode='python3 -c "import sys, urllib.parse as up; print(up.quote_plus(sys.argv[1]))"'
- alias urldecode='python3 -c "import sys, urllib.parse as up; print(up.unquote_plus(sys.argv[1]))"'
+ alias urlencode='python3 -c "import sys; del sys.path[0]; import urllib.parse as up; print(up.quote_plus(sys.argv[1]))"'
+ alias urldecode='python3 -c "import sys; del sys.path[0]; import urllib.parse as up; print(up.unquote_plus(sys.argv[1]))"'
elif [[ $(whence python2) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xpython" ) ]]; then
- alias urlencode='python2 -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1])"'
- alias urldecode='python2 -c "import sys, urllib as ul; print ul.unquote_plus(sys.argv[1])"'
+ alias urlencode='python2 -c "import sys; del sys.path[0]; import urllib as ul; print ul.quote_plus(sys.argv[1])"'
+ alias urldecode='python2 -c "import sys; del sys.path[0]; import urllib as ul; print ul.unquote_plus(sys.argv[1])"'
elif [[ $(whence xxd) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xshell" ) ]]; then
function urlencode() {echo $@ | tr -d "\n" | xxd -plain | sed "s/\(..\)/%\1/g"}
function urldecode() {printf $(echo -n $@ | sed 's/\\/\\\\/g;s/\(%\)\([0-9a-fA-F][0-9a-fA-F]\)/\\x\2/g')"\n"}
diff --git a/plugins/vault/README.md b/plugins/vault/README.md
index 5cdbb16f0..69051d2b2 100644
--- a/plugins/vault/README.md
+++ b/plugins/vault/README.md
@@ -1,18 +1,15 @@
-## Vault (https://www.vaultproject.io) autocomplete plugin
+# Vault plugin
-- Adds autocomplete options for all vault commands.
+Note: this plugin is deprecated. Use the [official autocompletion](https://www.vaultproject.io/docs/commands/index.html#autocompletion) instead.
-####Show help for all commands
-![General Help](https://i.imgur.com/yv5Db1r.png "Help for all commands")
+-------
+Adds autocomplete options for all [vault](https://www.vaultproject.io) commands.
-####Create new Vault token
-![Create token](https://i.imgur.com/xMegNgh.png "Create token")
-
-
-####Enable audit backends
-![Audit backends](https://i.imgur.com/fKLeiSF.png "Audit backends")
-
+To use it, add `vault` to the plugins array in your zshrc file:
+```zsh
+plugins=(... vault)
+```
Crafted with <3 by Valentin Bud ([@valentinbud](https://twitter.com/valentinbud))
diff --git a/plugins/vi-mode/vi-mode.plugin.zsh b/plugins/vi-mode/vi-mode.plugin.zsh
index 93964594b..c91ba05ba 100644
--- a/plugins/vi-mode/vi-mode.plugin.zsh
+++ b/plugins/vi-mode/vi-mode.plugin.zsh
@@ -1,22 +1,31 @@
# Updates editor information when the keymap changes.
function zle-keymap-select() {
+ # update keymap variable for the prompt
+ VI_KEYMAP=$KEYMAP
+
zle reset-prompt
zle -R
}
-# Ensure that the prompt is redrawn when the terminal size changes.
-TRAPWINCH() {
- zle && { zle -R; zle reset-prompt }
+zle -N zle-keymap-select
+
+function vi-accept-line() {
+ VI_KEYMAP=main
+ zle accept-line
}
-zle -N zle-keymap-select
-zle -N edit-command-line
+zle -N vi-accept-line
bindkey -v
+# use custom accept-line widget to update $VI_KEYMAP
+bindkey -M vicmd '^J' vi-accept-line
+bindkey -M vicmd '^M' vi-accept-line
+
# allow v to edit the command line (standard behaviour)
autoload -Uz edit-command-line
+zle -N edit-command-line
bindkey -M vicmd 'v' edit-command-line
# allow ctrl-p, ctrl-n for navigate history (standard behaviour)
@@ -28,8 +37,9 @@ bindkey '^?' backward-delete-char
bindkey '^h' backward-delete-char
bindkey '^w' backward-kill-word
-# allow ctrl-r to perform backward search in history
+# allow ctrl-r and ctrl-s to search the history
bindkey '^r' history-incremental-search-backward
+bindkey '^s' history-incremental-search-forward
# allow ctrl-a and ctrl-e to move to beginning/end of line
bindkey '^a' beginning-of-line
@@ -41,7 +51,7 @@ if [[ "$MODE_INDICATOR" == "" ]]; then
fi
function vi_mode_prompt_info() {
- echo "${${KEYMAP/vicmd/$MODE_INDICATOR}/(main|viins)/}"
+ echo "${${VI_KEYMAP/vicmd/$MODE_INDICATOR}/(main|viins)/}"
}
# define right prompt, if it wasn't defined by a theme
diff --git a/plugins/virtualenvwrapper/README.md b/plugins/virtualenvwrapper/README.md
new file mode 100644
index 000000000..63eb58541
--- /dev/null
+++ b/plugins/virtualenvwrapper/README.md
@@ -0,0 +1,38 @@
+# Virtualenvwrapper plugin
+
+This plugin loads Python's [virtualenvwrapper](https://virtualenvwrapper.readthedocs.io/en/latest/) shell tools.
+
+To use it, add `virtualenvwrapper` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... virtualenvwrapper)
+```
+
+## Usage
+
+The plugin allows to automatically activate virtualenvs on cd into git repositories with a matching name:
+
+```
+➜ github $ cd ansible
+(ansible) ➜ ansible git:(devel) $ cd docs
+(ansible) ➜ docs git:(devel) $ cd ..
+(ansible) ➜ ansible git:(devel) $ cd ..
+➜ github $
+```
+
+We can override this by having a `.venv` file in the directory containing a differently named virtualenv:
+
+```
+➜ github $ cat ansible/.venv
+myvirtualenv
+➜ github $ cd ansible
+(myvirtualenv) ➜ ansible git:(devel) $ cd ..
+➜ github $
+```
+
+We can disable this behaviour by setting `DISABLE_VENV_CD=1` before Oh My Zsh is sourced:
+```zsh
+DISABLE_VENV_CD=1
+plugins=(... virtualenvwrapper)
+source $ZSH/oh-my-zsh.sh
+```
diff --git a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
index e27c6bb76..b07b2a306 100644
--- a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
+++ b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
@@ -77,6 +77,12 @@ if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then
else
ENV_NAME=""
fi
+
+ if [[ -n $CD_VIRTUAL_ENV && "$ENV_NAME" != "$CD_VIRTUAL_ENV" ]]; then
+ # We've just left the repo, deactivate the environment
+ # Note: this only happens if the virtualenv was activated automatically
+ deactivate && unset CD_VIRTUAL_ENV
+ fi
if [[ "$ENV_NAME" != "" ]]; then
# Activate the environment only if it is not already active
if [[ "$VIRTUAL_ENV" != "$WORKON_HOME/$ENV_NAME" ]]; then
@@ -86,17 +92,12 @@ if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then
source $ENV_NAME/bin/activate && export CD_VIRTUAL_ENV="$ENV_NAME"
fi
fi
- elif [[ -n $CD_VIRTUAL_ENV && -n $VIRTUAL_ENV ]]; then
- # We've just left the repo, deactivate the environment
- # Note: this only happens if the virtualenv was activated automatically
- deactivate && unset CD_VIRTUAL_ENV
fi
fi
}
# Append workon_cwd to the chpwd_functions array, so it will be called on cd
# http://zsh.sourceforge.net/Doc/Release/Functions.html
- if ! (( $chpwd_functions[(I)workon_cwd] )); then
- chpwd_functions+=(workon_cwd)
- fi
+ autoload -U add-zsh-hook
+ add-zsh-hook chpwd workon_cwd
fi
diff --git a/plugins/vscode/README.md b/plugins/vscode/README.md
index 8ee45525a..74b5a45aa 100644
--- a/plugins/vscode/README.md
+++ b/plugins/vscode/README.md
@@ -8,6 +8,21 @@ To start using it, add the `vscode` plugin to your `plugins` array in `~/.zshrc`
plugins=(... vscode)
```
+If you are using [Visual Studio Code Insiders](https://code.visualstudio.com/insiders/),
+add the following line in the oh-my-zsh settings section (between the `ZSH_THEME` and
+the `plugins=()` line). This will make the plugin use the Insiders version instead.
+
+```zsh
+ZSH_THEME=...
+
+# Add this line to use code-insiders instead of code
+VSCODE=code-insiders
+
+plugins=(... vscode)
+
+source $ZSH/oh-my-zsh.sh
+```
+
## Common aliases
| Alias | Command | Description |
diff --git a/plugins/vscode/vscode.plugin.zsh b/plugins/vscode/vscode.plugin.zsh
index 902c23ecf..4c15df2b0 100644
--- a/plugins/vscode/vscode.plugin.zsh
+++ b/plugins/vscode/vscode.plugin.zsh
@@ -1,19 +1,22 @@
# VScode zsh plugin
# author: https://github.com/MarsiBarsi
-alias vsc='code .'
-alias vsca='code --add'
-alias vscd='code --diff'
-alias vscg='code --goto'
-alias vscn='code --new-window'
-alias vscr='code --reuse-window'
-alias vscw='code --wait'
-alias vscu='code --user-data-dir'
+# Use main Visual Studio Code version by default
+: ${VSCODE:=code}
-alias vsced='code --extensions-dir'
-alias vscie='code --install-extension'
-alias vscue='code --uninstall-extension'
+alias vsc="$VSCODE ."
+alias vsca="$VSCODE --add"
+alias vscd="$VSCODE --diff"
+alias vscg="$VSCODE --goto"
+alias vscn="$VSCODE --new-window"
+alias vscr="$VSCODE --reuse-window"
+alias vscw="$VSCODE --wait"
+alias vscu="$VSCODE --user-data-dir"
-alias vscv='code --verbose'
-alias vscl='code --log'
-alias vscde='code --disable-extensions'
+alias vsced="$VSCODE --extensions-dir"
+alias vscie="$VSCODE --install-extension"
+alias vscue="$VSCODE --uninstall-extension"
+
+alias vscv="$VSCODE --verbose"
+alias vscl="$VSCODE --log"
+alias vscde="$VSCODE --disable-extensions"
diff --git a/plugins/wd/README.md b/plugins/wd/README.md
index b1deeffd5..91d5d0ae7 100644
--- a/plugins/wd/README.md
+++ b/plugins/wd/README.md
@@ -13,7 +13,7 @@ wd
### oh-my-zsh
-`wd` comes bundled with [oh-my-zshell](https://github.com/robbyrussell/oh-my-zsh)!
+`wd` comes bundled with [oh-my-zshell](https://github.com/ohmyzsh/ohmyzsh)!
Just add the plugin in your `~/.zshrc` file:
@@ -53,7 +53,7 @@ Run either in terminal:
#### Completion
-If you're NOT using [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh) and you want to utilize the zsh-completion feature, you will also need to add the path to your `wd` installation (`~/bin/wd` if you used the automatic installer) to your `fpath`. E.g. in your `~/.zshrc`:
+If you're NOT using [oh-my-zsh](https://github.com/ohmyzsh/ohmyzsh) and you want to utilize the zsh-completion feature, you will also need to add the path to your `wd` installation (`~/bin/wd` if you used the automatic installer) to your `fpath`. E.g. in your `~/.zshrc`:
fpath=(~/path/to/wd $fpath)
@@ -85,7 +85,7 @@ Also, you may have to force a rebuild of `zcompdump` by running:
$ wd ...
This is a wrapper for the zsh `dirs` function.
- (You might need `setopt AUTO_PUSHD` in your `.zshrc` if you hare not using [oh-my-zshell](https://github.com/robbyrussell/oh-my-zsh)).
+ (You might need `setopt AUTO_PUSHD` in your `.zshrc` if you hare not using [oh-my-zshell](https://github.com/ohmyzsh/ohmyzsh)).
* Remove warp point test point:
diff --git a/plugins/wd/wd.plugin.zsh b/plugins/wd/wd.plugin.zsh
index c0559293d..4b7cd3c19 100644
--- a/plugins/wd/wd.plugin.zsh
+++ b/plugins/wd/wd.plugin.zsh
@@ -1,11 +1,7 @@
-#!/bin/zsh
-
# WARP DIRECTORY
# ==============
# oh-my-zsh plugin
#
# @github.com/mfaerevaag/wd
-wd() {
- . $ZSH/plugins/wd/wd.sh
-}
+eval "wd() { source '${0:A:h}/wd.sh' }"
diff --git a/plugins/yarn/README.md b/plugins/yarn/README.md
index 671a272d9..05f18a499 100644
--- a/plugins/yarn/README.md
+++ b/plugins/yarn/README.md
@@ -19,6 +19,7 @@ plugins=(... yarn)
| yap | `yarn add --peer` | Install a package in peerDependencies (`package.json`) |
| yb | `yarn build` | Run the build script defined in `package.json` |
| ycc | `yarn cache clean` | Clean yarn's global cache of packages |
+| yd | `yarn dev` | Run the dev script defined in `package.json` |
| yga | `yarn global add` | Install packages globally on your operating system |
| ygls | `yarn global list` | Lists global installed packages |
| ygrm | `yarn global remove` | Remove global installed packages from your OS |
@@ -26,6 +27,7 @@ plugins=(... yarn)
| yh | `yarn help` | Show help for a yarn command |
| yi | `yarn init` | Interactively creates or updates a package.json file |
| yin | `yarn install` | Install dependencies defined in `package.json` |
+| yln | `yarn lint` | Run the lint script defined in `package.json` |
| yls | `yarn list` | List installed packages |
| yout | `yarn outdated` | Check for outdated package dependencies |
| yp | `yarn pack` | Create a compressed gzip archive of package dependencies |
@@ -34,6 +36,10 @@ plugins=(... yarn)
| ys | `yarn serve` | Start the dev server |
| yst | `yarn start` | Run the start script defined in `package.json` |
| yt | `yarn test` | Run the test script defined in `package.json` |
+| ytc | `yarn test --coverage` | Run the test script defined in `package.json` with coverage |
| yuc | `yarn global upgrade && yarn cache clean` | Upgrade global packages and clean yarn's global cache |
| yui | `yarn upgrade-interactive` | Prompt for which outdated packages to upgrade |
| yup | `yarn upgrade` | Upgrade packages to their latest version |
+| yv | `yarn version` | Update the version of your package |
+| yw | `yarn workspace` | Run a command within a single workspace. |
+| yws | `yarn workspaces` | Run a command within all defined workspaces. |
diff --git a/plugins/yarn/_yarn b/plugins/yarn/_yarn
index 382f58a0a..3689ae960 100644
--- a/plugins/yarn/_yarn
+++ b/plugins/yarn/_yarn
@@ -71,7 +71,7 @@ _global_commands=(
'bin:Displays the location of the yarn bin folder'
'remove:Remove installed package from dependencies updating package.json'
'upgrade:Upgrades packages to their latest version based on the specified range'
- 'upgrade-interactive'
+ 'upgrade-interactive:Interactively upgrade packages'
)
_yarn_commands_scripts() {
@@ -81,9 +81,21 @@ _yarn_commands_scripts() {
}
_yarn_scripts() {
- local -a scripts
- scripts=($(yarn run --json 2>/dev/null | sed -E '/Commands available|possibleCommands/!d;s/.*Commands available from binary scripts: ([^"]+)".*/\1/;s/.*"items":\[([^]]+).*/\1/;s/[" ]//g' | tr , '\n' | sed -e 's/:/\\:/g'))
- _describe 'script' scripts
+ local -a commands binaries scripts
+ local -a scriptNames scriptCommands
+ local i runJSON
+
+ runJSON=$(yarn run --json 2>/dev/null)
+ binaries=($(sed -E '/Commands available/!d;s/.*Commands available from binary scripts: ([^"]+)".*/\1/;s/.*"items":\[([^]]+).*/\1/;s/[" ]//g;s/:/\\:/g;s/,/\n/g' <<< "$runJSON"))
+ scriptNames=($(sed -E '/possibleCommands/!d;s/.*"items":\[([^]]+).*/\1/;s/[" ]//g;s/:/\\:/g;s/,/\n/g' <<< "$runJSON"))
+ scriptCommands=("${(@f)$(sed -E '/possibleCommands/!d;s/.*"hints":\{([^}]+)\}.*/\1/;s/"[^"]+"://g;s/:/\\:/g;s/","/\n/g;s/(^"|"$)//g' <<< "$runJSON")}")
+
+ for (( i=1; i <= $#scriptNames; i++ )); do
+ scripts+=("${scriptNames[$i]}:${scriptCommands[$i]}")
+ done
+
+ commands=($scripts $binaries)
+ _describe 'command' commands
}
_yarn_global_commands() {
@@ -240,7 +252,8 @@ _yarn() {
run)
_arguments \
- '1: :_yarn_scripts'
+ '1: :_yarn_scripts' \
+ '*:: :_default'
;;
tag)
@@ -255,6 +268,11 @@ _yarn() {
'*:: :->team_args'
;;
+ upgrade-interactive)
+ _arguments \
+ '--latest:use the version tagged latest in the registry:'
+ ;;
+
version)
_arguments \
'--new-version:version:' \
@@ -266,6 +284,10 @@ _yarn() {
_arguments \
'1:query:_files'
;;
+
+ *)
+ _default
+ ;;
esac
;;
esac
diff --git a/plugins/yarn/yarn.plugin.zsh b/plugins/yarn/yarn.plugin.zsh
index 9ed8322cd..9cfcb7539 100644
--- a/plugins/yarn/yarn.plugin.zsh
+++ b/plugins/yarn/yarn.plugin.zsh
@@ -4,6 +4,7 @@ alias yad="yarn add --dev"
alias yap="yarn add --peer"
alias yb="yarn build"
alias ycc="yarn cache clean"
+alias yd="yarn dev"
alias yga="yarn global add"
alias ygls="yarn global list"
alias ygrm="yarn global remove"
@@ -11,6 +12,7 @@ alias ygu="yarn global upgrade"
alias yh="yarn help"
alias yi="yarn init"
alias yin="yarn install"
+alias yln="yarn lint"
alias yls="yarn list"
alias yout="yarn outdated"
alias yp="yarn pack"
@@ -19,6 +21,10 @@ alias yrun="yarn run"
alias ys="yarn serve"
alias yst="yarn start"
alias yt="yarn test"
+alias ytc="yarn test --coverage"
alias yuc="yarn global upgrade && yarn cache clean"
alias yui="yarn upgrade-interactive"
alias yup="yarn upgrade"
+alias yv="yarn version"
+alias yw="yarn workspace"
+alias yws="yarn workspaces"
diff --git a/plugins/yii/README.md b/plugins/yii/README.md
new file mode 100644
index 000000000..f1b72e916
--- /dev/null
+++ b/plugins/yii/README.md
@@ -0,0 +1,14 @@
+# Yii plugin
+
+The plugin adds autocomplete commands and subcommands for [yii](https://www.yiiframework.com/).
+
+To use it, add `yii` to the plugins array of your zshrc file:
+```
+plugins=(... yii)
+```
+
+## Aliases
+
+| Alias | Command |
+|--------|----------------------|
+| yiic | `protected/yiic` |
diff --git a/plugins/z/z.sh b/plugins/z/z.sh
index 5fe6d5266..5c5771d62 100644
--- a/plugins/z/z.sh
+++ b/plugins/z/z.sh
@@ -89,7 +89,7 @@ _z() {
if [ $? -ne 0 -a -f "$datafile" ]; then
env rm -f "$tempfile"
else
- [ "$_Z_OWNER" ] && chown $_Z_OWNER:$(id -ng $_Z_OWNER) "$tempfile"
+ [ "$_Z_OWNER" ] && chown $_Z_OWNER:"$(id -ng $_Z_OWNER)" "$tempfile"
env mv -f "$tempfile" "$datafile" || env rm -f "$tempfile"
fi
@@ -110,20 +110,21 @@ _z() {
else
# list/go
+ local echo fnd last list opt typ
while [ "$1" ]; do case "$1" in
- --) while [ "$1" ]; do shift; local fnd="$fnd${fnd:+ }$1";done;;
- -*) local opt=${1:1}; while [ "$opt" ]; do case ${opt:0:1} in
- c) local fnd="^$PWD $fnd";;
- e) local echo=1;;
+ --) while [ "$1" ]; do shift; fnd="$fnd${fnd:+ }$1";done;;
+ -*) opt=${1:1}; while [ "$opt" ]; do case ${opt:0:1} in
+ c) fnd="^$PWD $fnd";;
+ e) echo=1;;
h) echo "${_Z_CMD:-z} [-cehlrtx] args" >&2; return;;
- l) local list=1;;
- r) local typ="rank";;
- t) local typ="recent";;
+ l) list=1;;
+ r) typ="rank";;
+ t) typ="recent";;
x) sed -i -e "\:^${PWD}|.*:d" "$datafile";;
esac; opt=${opt:1}; done;;
- *) local fnd="$fnd${fnd:+ }$1";;
- esac; local last=$1; [ "$#" -gt 0 ] && shift; done
- [ "$fnd" -a "$fnd" != "^$PWD " ] || local list=1
+ *) fnd="$fnd${fnd:+ }$1";;
+ esac; last=$1; [ "$#" -gt 0 ] && shift; done
+ [ "$fnd" -a "$fnd" != "^$PWD " ] || list=1
# if we hit enter on a completion just go there
case "$last" in
@@ -147,7 +148,7 @@ _z() {
function output(matches, best_match, common) {
# list or return the desired directory
if( list ) {
- cmd = "sort -n >&2"
+ cmd = "sort -g >&2"
for( x in matches ) {
if( matches[x] ) {
printf "%-10s %s\n", matches[x], x | cmd
diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template
index abd2c8812..d16713ccb 100644
--- a/templates/zshrc.zsh-template
+++ b/templates/zshrc.zsh-template
@@ -7,7 +7,7 @@ export ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
-# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
+# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="robbyrussell"
# Set list of themes to pick from when loading at random
@@ -26,9 +26,15 @@ ZSH_THEME="robbyrussell"
# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"
+# Uncomment the following line to automatically update without prompting.
+# DISABLE_UPDATE_PROMPT="true"
+
# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13
+# Uncomment the following line if pasting URLs and other text is messed up.
+# DISABLE_MAGIC_FUNCTIONS=true
+
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
@@ -83,9 +89,6 @@ source $ZSH/oh-my-zsh.sh
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
-# ssh
-# export SSH_KEY_PATH="~/.ssh/rsa_id"
-
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
diff --git a/themes/3den.zsh-theme b/themes/3den.zsh-theme
index 1d2c7db7f..ae3a88659 100644
--- a/themes/3den.zsh-theme
+++ b/themes/3den.zsh-theme
@@ -1,4 +1,4 @@
-PROMPT=$'%{$fg[white]%}$(~/.rvm/bin/rvm-prompt) %{$fg_bold[cyan]%}%~%{$reset_color%}$(git_prompt_info) %{$fg[cyan]%}%D{[%I:%M:%S]}\
+PROMPT=$'%{$fg[white]%}$(ruby_prompt_info) %{$fg_bold[cyan]%}%~%{$reset_color%}$(git_prompt_info) %{$fg[cyan]%}%D{[%I:%M:%S]}\
%{$fg_bold[green]%}%n$%{$reset_color%} '
ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[white]%}("
diff --git a/themes/af-magic.zsh-theme b/themes/af-magic.zsh-theme
index 1c6d1732c..d185fa1ab 100644
--- a/themes/af-magic.zsh-theme
+++ b/themes/af-magic.zsh-theme
@@ -6,9 +6,9 @@ if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="green"; fi
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
# primary prompt
-PROMPT='$FG[237]------------------------------------------------------------%{$reset_color%}
+PROMPT='$FG[237]${(l.COLUMNS..-.)}%{$reset_color%}
$FG[032]%~\
-$(git_prompt_info) \
+$(git_prompt_info)$(hg_prompt_info) \
$FG[105]%(!.#.»)%{$reset_color%} '
PROMPT2='%{$fg[red]%}\ %{$reset_color%}'
RPS1='${return_code}'
@@ -21,7 +21,7 @@ eval my_orange='$FG[214]'
# right prompt
if type "virtualenv_prompt_info" > /dev/null
then
- RPROMPT='$(virtualenv_prompt_info)$my_gray%n@%m%{$reset_color%}%'
+ RPROMPT='$FG[078]$(virtualenv_prompt_info)%{$reset_color%} $my_gray%n@%m%{$reset_color%}%'
else
RPROMPT='$my_gray%n@%m%{$reset_color%}%'
fi
@@ -31,3 +31,9 @@ ZSH_THEME_GIT_PROMPT_PREFIX="$FG[075]($FG[078]"
ZSH_THEME_GIT_PROMPT_CLEAN=""
ZSH_THEME_GIT_PROMPT_DIRTY="$my_orange*%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="$FG[075])%{$reset_color%}"
+
+# hg settings
+ZSH_THEME_HG_PROMPT_PREFIX="$FG[075]($FG[078]"
+ZSH_THEME_HG_PROMPT_CLEAN=""
+ZSH_THEME_HG_PROMPT_DIRTY="$my_orange*%{$reset_color%}"
+ZSH_THEME_HG_PROMPT_SUFFIX="$FG[075])%{$reset_color%}"
diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme
index 3c30a9e11..518a14a37 100644
--- a/themes/agnoster.zsh-theme
+++ b/themes/agnoster.zsh-theme
@@ -152,7 +152,6 @@ prompt_bzr() {
if [[ $status_all -gt 0 ]] ; then
prompt_segment yellow black
echo -n "bzr@"$revision
-
else
prompt_segment green black
echo -n "bzr@"$revision
diff --git a/themes/alanpeabody.zsh-theme b/themes/alanpeabody.zsh-theme
index 4a1b1b386..1de90e57b 100644
--- a/themes/alanpeabody.zsh-theme
+++ b/themes/alanpeabody.zsh-theme
@@ -1,17 +1,10 @@
local user='%{$fg[magenta]%}%n@%{$fg[magenta]%}%m%{$reset_color%}'
local pwd='%{$fg[blue]%}%~%{$reset_color%}'
-local rvm=''
-if which rvm-prompt &> /dev/null; then
- rvm='%{$fg[green]%}‹$(rvm-prompt i v g)›%{$reset_color%}'
-else
- if which rbenv &> /dev/null; then
- rvm='%{$fg[green]%}‹$(rbenv version | sed -e "s/ (set.*$//")›%{$reset_color%}'
- fi
-fi
local return_code='%(?..%{$fg[red]%}%? ↵%{$reset_color%})'
local git_branch='$(git_prompt_status)%{$reset_color%}$(git_prompt_info)%{$reset_color%}'
+ZSH_THEME_RVM_PROMPT_OPTIONS="i v g"
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY=""
@@ -24,5 +17,8 @@ ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜"
ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═"
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭"
+ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg[green]%}‹"
+ZSH_THEME_RUBY_PROMPT_SUFFIX="›%{$reset_color%}"
+
PROMPT="${user} ${pwd}$ "
-RPROMPT="${return_code} ${git_branch} ${rvm}"
+RPROMPT="${return_code} ${git_branch} \$(ruby_prompt_info)"
diff --git a/themes/amuse.zsh-theme b/themes/amuse.zsh-theme
index d3f15ace5..3f7ec0bc5 100644
--- a/themes/amuse.zsh-theme
+++ b/themes/amuse.zsh-theme
@@ -1,17 +1,5 @@
# vim:ft=zsh ts=2 sw=2 sts=2
-rvm_current() {
- rvm current 2>/dev/null
-}
-
-rbenv_version() {
- rbenv version 2>/dev/null | awk '{print $1}'
-}
-
-PROMPT='
-%{$fg_bold[green]%}%~%{$reset_color%}$(git_prompt_info) ⌚ %{$fg_bold[red]%}%*%{$reset_color%}
-$ '
-
# Must use Powerline font, for \uE0A0 to render.
ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%}\uE0A0 "
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
@@ -19,11 +7,12 @@ ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}!"
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[green]%}?"
ZSH_THEME_GIT_PROMPT_CLEAN=""
-if [ -e ~/.rvm/bin/rvm-prompt ]; then
- RPROMPT='%{$fg_bold[red]%}‹$(rvm_current)›%{$reset_color%}'
-else
- if which rbenv &> /dev/null; then
- RPROMPT='%{$fg_bold[red]%}$(rbenv_version)%{$reset_color%}'
- fi
-fi
+ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg_bold[red]%}‹"
+ZSH_THEME_RUBY_PROMPT_SUFFIX="›%{$reset_color%}"
+
+PROMPT='
+%{$fg_bold[green]%}%~%{$reset_color%}$(git_prompt_info) ⌚ %{$fg_bold[red]%}%*%{$reset_color%}
+$ '
+
+RPROMPT='$(ruby_prompt_info)'
diff --git a/themes/bira.zsh-theme b/themes/bira.zsh-theme
index 675483996..cdae68d6c 100644
--- a/themes/bira.zsh-theme
+++ b/themes/bira.zsh-theme
@@ -1,30 +1,32 @@
# ZSH Theme - Preview: https://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
-
if [[ $UID -eq 0 ]]; then
- local user_host='%{$terminfo[bold]$fg[red]%}%n@%m%{$reset_color%}'
+ local user_host='%{$terminfo[bold]$fg[red]%}%n@%m %{$reset_color%}'
local user_symbol='#'
else
- local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}'
+ local user_host='%{$terminfo[bold]$fg[green]%}%n@%m %{$reset_color%}'
local user_symbol='$'
fi
-local current_dir='%{$terminfo[bold]$fg[blue]%}%~%{$reset_color%}'
-local rvm_ruby=''
-if which rvm-prompt &> /dev/null; then
- rvm_ruby='%{$fg[red]%}‹$(rvm-prompt i v g)›%{$reset_color%}'
-else
- if which rbenv &> /dev/null; then
- rvm_ruby='%{$fg[red]%}‹$(rbenv version | sed -e "s/ (set.*$//")›%{$reset_color%}'
- fi
-fi
-local git_branch='$(git_prompt_info)%{$reset_color%}'
+local current_dir='%{$terminfo[bold]$fg[blue]%}%~ %{$reset_color%}'
+local git_branch='$(git_prompt_info)'
+local rvm_ruby='$(ruby_prompt_info)'
+local venv_prompt='$(virtualenv_prompt_info)'
-PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch}
+ZSH_THEME_RVM_PROMPT_OPTIONS="i v g"
+
+PROMPT="╭─${user_host}${current_dir}${rvm_ruby}${git_branch}${venv_prompt}
╰─%B${user_symbol}%b "
-RPS1="%B${return_code}%b"
+RPROMPT="%B${return_code}%b"
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹"
ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}"
+ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg[red]%}‹"
+ZSH_THEME_RUBY_PROMPT_SUFFIX="› %{$reset_color%}"
+
+ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX="%{$fg[green]%}‹"
+ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX="› %{$reset_color%}"
+ZSH_THEME_VIRTUALENV_PREFIX=$ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX
+ZSH_THEME_VIRTUALENV_SUFFIX=$ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX
diff --git a/themes/crcandy.zsh-theme b/themes/crcandy.zsh-theme
index 0a63c1245..5b9cd42f8 100644
--- a/themes/crcandy.zsh-theme
+++ b/themes/crcandy.zsh-theme
@@ -1,5 +1,5 @@
PROMPT=$'
-%{$fg_bold[green]%}%n@%m %{$fg[blue]%}%D{[%I:%M:%S]} %{$reset_color%}%{$fg[white]%}[%~]%{$reset_color%} $(git_prompt_info)\
+%{$fg_bold[green]%}%n@%m %{$fg[blue]%}%D{[%H:%M:%S]} %{$reset_color%}%{$fg[white]%}[%~]%{$reset_color%} $(git_prompt_info)\
%{$fg[blue]%}->%{$fg_bold[blue]%} %#%{$reset_color%} '
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}["
diff --git a/themes/crunch.zsh-theme b/themes/crunch.zsh-theme
index 2fc066381..8278661ab 100644
--- a/themes/crunch.zsh-theme
+++ b/themes/crunch.zsh-theme
@@ -29,13 +29,9 @@ ZSH_THEME_GIT_PROMPT_DIRTY=" $CRUNCH_GIT_DIRTY_COLOR✗"
# Our elements:
CRUNCH_TIME_="$CRUNCH_BRACKET_COLOR{$CRUNCH_TIME_COLOR%T$CRUNCH_BRACKET_COLOR}%{$reset_color%}"
-if [ -e ~/.rvm/bin/rvm-prompt ]; then
- CRUNCH_RVM_="$CRUNCH_BRACKET_COLOR"["$CRUNCH_RVM_COLOR\${\$(~/.rvm/bin/rvm-prompt i v g)#ruby-}$CRUNCH_BRACKET_COLOR"]"%{$reset_color%}"
-else
- if which rbenv &> /dev/null; then
- CRUNCH_RVM_="$CRUNCH_BRACKET_COLOR"["$CRUNCH_RVM_COLOR\${\$(rbenv version | sed -e 's/ (set.*$//' -e 's/^ruby-//')}$CRUNCH_BRACKET_COLOR"]"%{$reset_color%}"
- fi
-fi
+ZSH_THEME_RUBY_PROMPT_PREFIX="$CRUNCH_BRACKET_COLOR"["$CRUNCH_RVM_COLOR"
+ZSH_THEME_RUBY_PROMPT_SUFFIX="$CRUNCH_BRACKET_COLOR"]"%{$reset_color%}"
+CRUNCH_RVM_='$(ruby_prompt_info)'
CRUNCH_DIR_="$CRUNCH_DIR_COLOR%~\$(git_prompt_info) "
CRUNCH_PROMPT="$CRUNCH_BRACKET_COLOR➭ "
diff --git a/themes/dallas.zsh-theme b/themes/dallas.zsh-theme
index e9e86177b..d6c417fc3 100644
--- a/themes/dallas.zsh-theme
+++ b/themes/dallas.zsh-theme
@@ -2,14 +2,6 @@
# Grab the current date (%D) and time (%T) wrapped in {}: {%D %T}
DALLAS_CURRENT_TIME_="%{$fg[white]%}{%{$fg[yellow]%}%D %T%{$fg[white]%}}%{$reset_color%}"
-# Grab the current version of ruby in use (via RVM): [ruby-1.8.7]
-if [ -e ~/.rvm/bin/rvm-prompt ]; then
- DALLAS_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[magenta]%}\$(~/.rvm/bin/rvm-prompt i v)%{$fg[white]%}]%{$reset_color%}"
-else
- if which rbenv &> /dev/null; then
- DALLAS_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[magenta]%}\$(rbenv version | sed -e 's/ (set.*$//')%{$fg[white]%}]%{$reset_color%}"
- fi
-fi
# Grab the current machine name: muscato
DALLAS_CURRENT_MACH_="%{$fg[green]%}%m%{$fg[white]%}:%{$reset_color%}"
# Grab the current filepath, use shortcuts: ~/Desktop
@@ -28,5 +20,8 @@ ZSH_THEME_GIT_PROMPT_CLEAN=""
# Add 3 cyan ✗s if this branch is diiirrrty! Dirty branch!
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[cyan]%}✗✗✗"
+ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg[white]%}[%{$fg[magenta]%}"
+ZSH_THEME_RUBY_PROMPT_SUFFIX="%{$fg[white]%}]%{$reset_color%}"
+
# Put it all together!
-PROMPT="$DALLAS_CURRENT_TIME_$DALLAS_CURRENT_RUBY_$DALLAS_CURRENT_MACH_$DALLAS_CURRENT_LOCA_ $DALLAS_CURRENT_USER_$DALLAS_PROMPT_CHAR_ "
+PROMPT="$DALLAS_CURRENT_TIME_\$(ruby_prompt_info)$DALLAS_CURRENT_MACH_$DALLAS_CURRENT_LOCA_ $DALLAS_CURRENT_USER_$DALLAS_PROMPT_CHAR_ "
diff --git a/themes/evan.zsh-theme b/themes/evan.zsh-theme
index 5ef1f40dd..02ca22d4c 100644
--- a/themes/evan.zsh-theme
+++ b/themes/evan.zsh-theme
@@ -1,2 +1,2 @@
-# Evan describes this sexy prompt as: "a skinny, topless prompt"
-PROMPT='%m :: %2~ %B»%b ' \ No newline at end of file
+# Evan's minimal prompt
+PROMPT='%m :: %2~ %B»%b '
diff --git a/themes/fino-time.zsh-theme b/themes/fino-time.zsh-theme
index 9caebc69e..5679e9f37 100644
--- a/themes/fino-time.zsh-theme
+++ b/themes/fino-time.zsh-theme
@@ -25,11 +25,7 @@ function box_name {
}
-rvm_ruby=''
-if type rvm-prompt &>/dev/null; then
- rvm_ruby='using%{$FG[243]%}‹$(rvm-prompt i v g)›%{$reset_color%}'
-fi
-
+local rvm_ruby='using%{$FG[243]%}$(ruby_prompt_info)'
local git_info='$(git_prompt_info)'
@@ -40,3 +36,5 @@ ZSH_THEME_GIT_PROMPT_PREFIX=" %{$FG[239]%}on%{$reset_color%} %{$fg[255]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$FG[202]%}✘✘✘"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$FG[040]%}✔"
+ZSH_THEME_RUBY_PROMPT_PREFIX="‹"
+ZSH_THEME_RUBY_PROMPT_SUFFIX="›%{$reset_color%}"
diff --git a/themes/fino.zsh-theme b/themes/fino.zsh-theme
index 28d6cc2ec..1d8bb30e1 100644
--- a/themes/fino.zsh-theme
+++ b/themes/fino.zsh-theme
@@ -20,15 +20,7 @@ function box_name {
[ -f ~/.box-name ] && cat ~/.box-name || echo ${SHORT_HOST:-$HOST}
}
-local ruby_env=''
-if which rvm-prompt &> /dev/null; then
- ruby_env='using%{$FG[243]%} ‹$(rvm-prompt i v g)›%{$reset_color%}'
-else
- if which rbenv &> /dev/null; then
- ruby_env='using%{$FG[243]%} ‹$(rbenv version-name)›%{$reset_color%}'
- fi
-fi
-
+local ruby_env='using%{$FG[243]%} $(ruby_prompt_info)'
local git_info='$(git_prompt_info)'
local prompt_char='$(prompt_char)'
@@ -40,3 +32,5 @@ ZSH_THEME_GIT_PROMPT_PREFIX=" %{$FG[239]%}on%{$reset_color%} %{$fg[255]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$FG[202]%}✘✘✘"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$FG[040]%}✔"
+ZSH_THEME_RUBY_PROMPT_PREFIX="‹"
+ZSH_THEME_RUBY_PROMPT_SUFFIX="›%{$reset_color%}"
diff --git a/themes/fishy.zsh-theme b/themes/fishy.zsh-theme
index 83bd455b5..00a60f45b 100644
--- a/themes/fishy.zsh-theme
+++ b/themes/fishy.zsh-theme
@@ -14,7 +14,7 @@ PROMPT='%n@%m %{$fg[$user_color]%}$(_fishy_collapsed_wd)%{$reset_color%}%(!.#.>)
PROMPT2='%{$fg[red]%}\ %{$reset_color%}'
local return_status="%{$fg_bold[red]%}%(?..%?)%{$reset_color%}"
-RPROMPT='${return_status}$(git_prompt_info)$(git_prompt_status)%{$reset_color%}'
+RPROMPT="${RPROMPT}"'${return_status}$(git_prompt_info)$(git_prompt_status)%{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX=" "
ZSH_THEME_GIT_PROMPT_SUFFIX=""
diff --git a/themes/frontcube.zsh-theme b/themes/frontcube.zsh-theme
index 539e744f8..f9488d0ac 100644
--- a/themes/frontcube.zsh-theme
+++ b/themes/frontcube.zsh-theme
@@ -1,12 +1,13 @@
-local rvm="%{$fg[green]%}[$(rvm-prompt i v g)]%{$reset_color%}"
PROMPT='
%{$fg_bold[gray]%}%~%{$fg_bold[blue]%}%{$fg_bold[blue]%} % %{$reset_color%}
%{$fg[green]%}➞ %{$reset_color%'
-RPROMPT='$(git_prompt_info) ${rvm}'
+RPROMPT='$(git_prompt_info) $(ruby_prompt_info)'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}[git:"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}] %{$fg[red]%}✖ %{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%}] %{$fg[green]%}✔%{$reset_color%}"
+ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg[green]%}["
+ZSH_THEME_RUBY_PROMPT_SUFFIX="]%{$reset_color%}"
diff --git a/themes/gallifrey.zsh-theme b/themes/gallifrey.zsh-theme
index 768547064..47b057fa3 100644
--- a/themes/gallifrey.zsh-theme
+++ b/themes/gallifrey.zsh-theme
@@ -1,4 +1,4 @@
-# ZSH Theme - Preview: https://github.com/robbyrussell/oh-my-zsh/wiki/Themes#gallifrey
+# ZSH Theme - Preview: https://github.com/ohmyzsh/ohmyzsh/wiki/Themes#gallifrey
return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
host_color="%(!.%{$fg[red]%}.%{$fg[green]%})"
diff --git a/themes/gallois.zsh-theme b/themes/gallois.zsh-theme
index 515325e38..e6c2d8142 100644
--- a/themes/gallois.zsh-theme
+++ b/themes/gallois.zsh-theme
@@ -14,8 +14,8 @@ git_custom_status() {
}
# RVM component of prompt
-ZSH_THEME_RVM_PROMPT_PREFIX="%{$fg[red]%}["
-ZSH_THEME_RVM_PROMPT_SUFFIX="]%{$reset_color%}"
+ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg[red]%}["
+ZSH_THEME_RUBY_PROMPT_SUFFIX="]%{$reset_color%}"
# Combine it all into a final right-side prompt
RPS1='$(git_custom_status)$(ruby_prompt_info) $EPS1'
diff --git a/themes/gnzh.zsh-theme b/themes/gnzh.zsh-theme
index c763ef3c6..1e6c4e93b 100644
--- a/themes/gnzh.zsh-theme
+++ b/themes/gnzh.zsh-theme
@@ -29,21 +29,15 @@ local return_code="%(?..%F{red}%? ↵%f)"
local user_host="${PR_USER}%F{cyan}@${PR_HOST}"
local current_dir="%B%F{blue}%~%f%b"
-local rvm_ruby=''
-if ${HOME}/.rvm/bin/rvm-prompt &> /dev/null; then # detect user-local rvm installation
- rvm_ruby='%F{red}‹$(${HOME}/.rvm/bin/rvm-prompt i v g s)›%f'
-elif which rvm-prompt &> /dev/null; then # detect system-wide rvm installation
- rvm_ruby='%F{red}‹$(rvm-prompt i v g s)›%f'
-elif which rbenv &> /dev/null; then # detect Simple Ruby Version Management
- rvm_ruby='%F{red}‹$(rbenv version | sed -e "s/ (set.*$//")›%f'
-fi
local git_branch='$(git_prompt_info)'
-PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch}
+PROMPT="╭─${user_host} ${current_dir} \$(ruby_prompt_info) ${git_branch}
╰─$PR_PROMPT "
RPROMPT="${return_code}"
ZSH_THEME_GIT_PROMPT_PREFIX="%F{yellow}‹"
ZSH_THEME_GIT_PROMPT_SUFFIX="› %f"
+ZSH_THEME_RUBY_PROMPT_PREFIX="%F{red}‹"
+ZSH_THEME_RUBY_PROMPT_SUFFIX="›%f"
}
diff --git a/themes/itchy.zsh-theme b/themes/itchy.zsh-theme
index e1f2d56e2..41a42e88c 100644
--- a/themes/itchy.zsh-theme
+++ b/themes/itchy.zsh-theme
@@ -7,10 +7,12 @@ local pwd="%{$fg[yellow]%}%~%{$reset_color%}"
PROMPT='${user}${host} ${pwd}
${smiley} '
-RPROMPT='$(rvm-prompt || rbenv version) %{$fg[white]%}$(git_prompt_info)%{$reset_color%}'
+RPROMPT='$(ruby_prompt_info) %{$fg[white]%}$(git_prompt_info)%{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX=""
ZSH_THEME_GIT_PROMPT_SUFFIX=""
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%} ✗%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%} ✔%{$reset_color%}"
+ZSH_THEME_RUBY_PROMPT_PREFIX=""
+ZSH_THEME_RUBY_PROMPT_SUFFIX=""
diff --git a/themes/jaischeema.zsh-theme b/themes/jaischeema.zsh-theme
index da1dd1e5d..50d2bc4a5 100644
--- a/themes/jaischeema.zsh-theme
+++ b/themes/jaischeema.zsh-theme
@@ -1,16 +1,12 @@
# jaischeema.zsh-theme
PROMPT='%{$fg_bold[magenta]%}%m%{$reset_color%} at %{$fg_bold[green]%}%~%{$reset_color%} %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%}% %{$reset_color%}%{$fg[red]%}❯%{$reset_color%} '
+RPROMPT='$(ruby_prompt_info)'
ZSH_THEME_GIT_PROMPT_PREFIX="±(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%}) "
-if which rbenv &> /dev/null; then
- RPROMPT='%{$fg[red]%}$(rbenv version | sed -e "s/ (set.*$//")%{$reset_color%}'
-else
- if which rvm-prompt &> /dev/null; then
- RPROMPT='%{$fg[red]%}$(rvm-prompt)%{$reset_color%}'
- fi
-fi
+ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg[red]%}"
+ZSH_THEME_RUBY_PROMPT_SUFFIX="%{$reset_color%}"
diff --git a/themes/macovsky-ruby.zsh-theme b/themes/macovsky-ruby.zsh-theme
index abda6232c..d3ee200a9 100644..120000
--- a/themes/macovsky-ruby.zsh-theme
+++ b/themes/macovsky-ruby.zsh-theme
@@ -1,15 +1 @@
-# ZSH Theme - Preview: https://i.gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png
-local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
-
-if [ -e ~/.rvm/bin/rvm-prompt ]; then
- PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(~/.rvm/bin/rvm-prompt i v)› %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b '
-else
- if which rbenv &> /dev/null; then
- PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(rbenv version | sed -e "s/ (set.*$//")› %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b '
- fi
-fi
-
-RPS1="${return_code}"
-
-ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹"
-ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}"
+macovsky.zsh-theme \ No newline at end of file
diff --git a/themes/macovsky.zsh-theme b/themes/macovsky.zsh-theme
index d3f7d16b4..f527e5861 100644
--- a/themes/macovsky.zsh-theme
+++ b/themes/macovsky.zsh-theme
@@ -1,14 +1,12 @@
# ZSH Theme - Preview: https://i.gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
-if [ -e ~/.rvm/bin/rvm-prompt ]; then
- PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(~/.rvm/bin/rvm-prompt i v)› %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b '
-else
- if which rbenv &> /dev/null; then
- PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(rbenv version | sed -e "s/ (set.*$//")› %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b '
- fi
-fi
-RPS1="${return_code}"
+PROMPT='%{$fg[green]%}%~%{$reset_color%} $(ruby_prompt_info) $(git_prompt_info)%{$reset_color%}%B$%b '
+RPROMPT="${return_code}"
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹"
ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}"
+
+
+ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg[red]%}‹"
+ZSH_THEME_RUBY_PROMPT_SUFFIX="› %{$reset_color%}"
diff --git a/themes/mira.zsh-theme b/themes/mira.zsh-theme
index e6c952998..a7c60359c 100644
--- a/themes/mira.zsh-theme
+++ b/themes/mira.zsh-theme
@@ -4,22 +4,13 @@ local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}'
local current_dir='%{$terminfo[bold]$fg[blue]%} %~%{$reset_color%}'
-local rvm_ruby=''
-if which rvm-prompt &> /dev/null; then
- rvm_ruby='%{$fg[red]%}‹$(rvm-prompt i v g)›%{$reset_color%}'
-else
- if which rbenv &> /dev/null; then
- rvm_ruby='%{$fg[red]%}‹$(rbenv version | sed -e "s/ (set.*$//")›%{$reset_color%}'
- fi
-fi
+local nvm_node='%{$fg[green]%}‹node-$(nvm_prompt_info)›%{$reset_color%}'
-local nvm_node=''
-nvm_node='%{$fg[green]%}‹node-$(nvm_prompt_info)›%{$reset_color%}'
+local jenv_java='%{$fg[blue]%}‹$(jenv_prompt_info)›%{$reset_color%}'
-local jenv_java=''
-jenv_java='%{$fg[blue]%}‹$(jenv_prompt_info)›%{$reset_color%}'
+local git_branch='$(git_prompt_info)'
-local git_branch='$(git_prompt_info)%{$reset_color%}'
+local rvm_ruby='$(ruby_prompt_info)'
PROMPT="╭─${user_host} ${current_dir} ${nvm_node} ${rvm_ruby} ${jenv_java} ${git_branch}
╰─%B$%b "
@@ -27,3 +18,6 @@ RPS1="${return_code}"
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}("
ZSH_THEME_GIT_PROMPT_SUFFIX=") %{$reset_color%}"
+
+ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg[red]%}‹"
+ZSH_THEME_RUBY_PROMPT_SUFFIX="›%{$reset_color%}"
diff --git a/themes/pure.zsh-theme b/themes/pure.zsh-theme
deleted file mode 100644
index 98c1312af..000000000
--- a/themes/pure.zsh-theme
+++ /dev/null
@@ -1,10 +0,0 @@
-print -P '%F{yellow}'Oh My Zsh pure theme:
-cat <<-EOF
-
- The pure theme has been renamed as 'refined' as per the original author's
- request. Change your ZSH_THEME to 'refined' to avoid seeing this warning.
-
-EOF
-print -P '%f'
-
-source ${0:h:A}/refined.zsh-theme
diff --git a/themes/pygmalion-virtualenv.zsh-theme b/themes/pygmalion-virtualenv.zsh-theme
index ea28e125a..605e3d10c 100644
--- a/themes/pygmalion-virtualenv.zsh-theme
+++ b/themes/pygmalion-virtualenv.zsh-theme
@@ -28,7 +28,8 @@ prompt_setup_pygmalion(){
base_prompt_nocolor=$(echo "$base_prompt" | perl -pe "s/%\{[^}]+\}//g")
post_prompt_nocolor=$(echo "$post_prompt" | perl -pe "s/%\{[^}]+\}//g")
- precmd_functions+=(prompt_pygmalion_precmd)
+ autoload -U add-zsh-hook
+ add-zsh-hook precmd prompt_pygmalion_precmd
}
prompt_pygmalion_precmd(){
@@ -46,5 +47,3 @@ prompt_pygmalion_precmd(){
}
prompt_setup_pygmalion
-
-
diff --git a/themes/pygmalion.zsh-theme b/themes/pygmalion.zsh-theme
index 5f5fe7f9a..cd773e4a4 100644
--- a/themes/pygmalion.zsh-theme
+++ b/themes/pygmalion.zsh-theme
@@ -12,7 +12,8 @@ prompt_setup_pygmalion(){
base_prompt_nocolor=$(echo "$base_prompt" | perl -pe "s/%\{[^}]+\}//g")
post_prompt_nocolor=$(echo "$post_prompt" | perl -pe "s/%\{[^}]+\}//g")
- precmd_functions+=(prompt_pygmalion_precmd)
+ autoload -U add-zsh-hook
+ add-zsh-hook precmd prompt_pygmalion_precmd
}
prompt_pygmalion_precmd(){
@@ -30,5 +31,3 @@ prompt_pygmalion_precmd(){
}
prompt_setup_pygmalion
-
-
diff --git a/themes/refined.zsh-theme b/themes/refined.zsh-theme
index 0e5681cc7..2a4188c9d 100644
--- a/themes/refined.zsh-theme
+++ b/themes/refined.zsh-theme
@@ -72,6 +72,7 @@ preexec() {
precmd() {
vcs_info # Get version control info before we start outputting stuff
print -P "\n$(repo_information) %F{yellow}$(cmd_exec_time)%f"
+ unset cmd_timestamp #Reset cmd exec time.
}
# Define prompts
diff --git a/themes/robbyrussell.zsh-theme b/themes/robbyrussell.zsh-theme
index f9eca6a87..2fd5f2cdc 100644
--- a/themes/robbyrussell.zsh-theme
+++ b/themes/robbyrussell.zsh-theme
@@ -1,5 +1,5 @@
-local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )"
-PROMPT='${ret_status} %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)'
+PROMPT="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )"
+PROMPT+=' %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
diff --git a/themes/simonoff.zsh-theme b/themes/simonoff.zsh-theme
index 63ce4261b..ef91c5ee3 100644
--- a/themes/simonoff.zsh-theme
+++ b/themes/simonoff.zsh-theme
@@ -23,7 +23,7 @@ function precmd {
local promptsize=${#${(%):---(%n@%M:%l)---()}}
local pwdsize=${#${(%):-%~}}
local gitbranch="$(git_prompt_info)"
- local rvmprompt="$(rvm_prompt_info)"
+ local rvmprompt="$(ruby_prompt_info)"
local gitbranchsize=${#${gitbranch:-''}}
local rvmpromptsize=${#${rvmprompt:-''}}
@@ -90,8 +90,8 @@ setprompt () {
ZSH_THEME_GIT_PROMPT_SUFFIX="]"
###
# Modify RVM prompt
- ZSH_THEME_RVM_PROMPT_PREFIX=" ["
- ZSH_THEME_RVM_PROMPT_SUFFIX="]"
+ ZSH_THEME_RUBY_PROMPT_PREFIX=" ["
+ ZSH_THEME_RUBY_PROMPT_SUFFIX="]"
###
diff --git a/themes/sunrise.zsh-theme b/themes/sunrise.zsh-theme
index e3f4019d6..2111576c3 100644
--- a/themes/sunrise.zsh-theme
+++ b/themes/sunrise.zsh-theme
@@ -1,5 +1,5 @@
# Sunrise theme for oh-my-zsh
-# Intended to be used with Solarized: http://ethanschoonover.com/solarized
+# Intended to be used with Solarized: https://ethanschoonover.com/solarized
# Color shortcuts
R=$fg_no_bold[red]
diff --git a/themes/suvash.zsh-theme b/themes/suvash.zsh-theme
index 1680973df..850476cdf 100644
--- a/themes/suvash.zsh-theme
+++ b/themes/suvash.zsh-theme
@@ -8,20 +8,7 @@ function virtualenv_info {
[[ -n "$VIRTUAL_ENV" ]] && echo '('${VIRTUAL_ENV:t}') '
}
-function ruby_prompt {
- if (( $+commands[rvm-prompt] )); then
- print -n $ZSH_THEME_RUBY_PROMPT_PREFIX
- print -n $(~/.rvm/bin/rvm-prompt)
- print -n $ZSH_THEME_RUBY_PROMPT_SUFFIX
- elif (( $+commands[rbenv] )); then
- print -n $ZSH_THEME_RUBY_PROMPT_PREFIX
- print -n $(rbenv version | sed -e "s/ (set.*$//")
- print -n $ZSH_THEME_RUBY_PROMPT_SUFFIX
- fi
- return 0
-}
-
-PROMPT='%F{magenta}%n%f at %F{yellow}%m%f in %B%F{green}%~%f%b$(git_prompt_info)$(ruby_prompt)
+PROMPT='%F{magenta}%n%f at %F{yellow}%m%f in %B%F{green}%~%f%b$(git_prompt_info)$(ruby_prompt_info)
$(virtualenv_info) $(prompt_char) '
ZSH_THEME_GIT_PROMPT_PREFIX=' on %F{magenta}'
diff --git a/themes/wedisagree.zsh-theme b/themes/wedisagree.zsh-theme
index 9bdbce40d..07006ecd9 100644
--- a/themes/wedisagree.zsh-theme
+++ b/themes/wedisagree.zsh-theme
@@ -28,7 +28,7 @@ PROMPT='%{$fg[magenta]%}[%c] %{$reset_color%}'
RPROMPT='${time} %{$fg[magenta]%}$(git_prompt_info)%{$reset_color%}$(git_prompt_status)%{$reset_color%}$(git_prompt_ahead)%{$reset_color%}'
# Add this at the start of RPROMPT to include rvm info showing ruby-version@gemset-name
-# %{$fg[yellow]%}$(~/.rvm/bin/rvm-prompt)%{$reset_color%}
+# $(ruby_prompt_info)
# local time, color coded by last return code
time_enabled="%(?.%{$fg[green]%}.%{$fg[red]%})%*%{$reset_color%}"
@@ -48,6 +48,9 @@ ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%} ➜" # ⓡ ⑄
ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[magenta]%} ♒" # ⓤ ⑊
ZSH_THEME_GIT_PROMPT_AHEAD="%{$fg[blue]%} 𝝙"
+ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg[yellow]%}"
+ZSH_THEME_RUBY_PROMPT_SUFFIX="%{$reset_color%}"
+
# More symbols to choose from:
# ☀ ✹ ☄ ♆ ♀ ♁ ♐ ♇ ♈ ♉ ♚ ♛ ♜ ♝ ♞ ♟ ♠ ♣ ⚢ ⚲ ⚳ ⚴ ⚥ ⚤ ⚦ ⚒ ⚑ ⚐ ♺ ♻ ♼ ☰ ☱ ☲ ☳ ☴ ☵ ☶ ☷
# ✡ ✔ ✖ ✚ ✱ ✤ ✦ ❤ ➜ ➟ ➼ ✂ ✎ ✐ ⨀ ⨁ ⨂ ⨍ ⨎ ⨏ ⨷ ⩚ ⩛ ⩡ ⩱ ⩲ ⩵ ⩶ ⨠
diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh
index 05b31e8d4..c8dedcf77 100644
--- a/tools/check_for_upgrade.sh
+++ b/tools/check_for_upgrade.sh
@@ -34,7 +34,9 @@ if mkdir "$ZSH/log/update.lock" 2>/dev/null; then
. ${ZSH_CACHE_DIR}/.zsh-update
if [[ -z "$LAST_EPOCH" ]]; then
- _update_zsh_update && return 0
+ _update_zsh_update
+ rmdir $ZSH/log/update.lock # TODO: fix later
+ return 0
fi
epoch_diff=$(($(_current_epoch) - $LAST_EPOCH))
diff --git a/tools/install.sh b/tools/install.sh
index e2b33f640..ae248be89 100755
--- a/tools/install.sh
+++ b/tools/install.sh
@@ -1,114 +1,281 @@
+#!/bin/sh
+#
+# This script should be run via curl:
+# sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
+# or wget:
+# sh -c "$(wget -qO- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
+#
+# As an alternative, you can first download the install script and run it afterwards:
+# wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh
+# sh install.sh
+#
+# You can tweak the install behavior by setting variables when running the script. For
+# example, to change the path to the Oh My Zsh repository:
+# ZSH=~/.zsh sh install.sh
+#
+# Respects the following environment variables:
+# ZSH - path to the Oh My Zsh repository folder (default: $HOME/.oh-my-zsh)
+# REPO - name of the GitHub repo to install from (default: ohmyzsh/ohmyzsh)
+# REMOTE - full remote URL of the git repo to install (default: GitHub via HTTPS)
+# BRANCH - branch to check out immediately after install (default: master)
+#
+# Other options:
+# CHSH - 'no' means the installer will not change the default shell (default: yes)
+# RUNZSH - 'no' means the installer will not run zsh after the install (default: yes)
+#
+# You can also pass some arguments to the install script to set some these options:
+# --skip-chsh: has the same behavior as setting CHSH to 'no'
+# --unattended: sets both CHSH and RUNZSH to 'no'
+# For example:
+# sh install.sh --unattended
+#
+set -e
+
+# Default settings
+ZSH=${ZSH:-~/.oh-my-zsh}
+REPO=${REPO:-ohmyzsh/ohmyzsh}
+REMOTE=${REMOTE:-https://github.com/${REPO}.git}
+BRANCH=${BRANCH:-master}
+
+# Other options
+CHSH=${CHSH:-yes}
+RUNZSH=${RUNZSH:-yes}
+
+
+command_exists() {
+ command -v "$@" >/dev/null 2>&1
+}
+
+error() {
+ echo ${RED}"Error: $@"${RESET} >&2
+}
+
+setup_color() {
+ # Only use colors if connected to a terminal
+ if [ -t 1 ]; then
+ RED=$(printf '\033[31m')
+ GREEN=$(printf '\033[32m')
+ YELLOW=$(printf '\033[33m')
+ BLUE=$(printf '\033[34m')
+ BOLD=$(printf '\033[1m')
+ RESET=$(printf '\033[m')
+ else
+ RED=""
+ GREEN=""
+ YELLOW=""
+ BLUE=""
+ BOLD=""
+ RESET=""
+ fi
+}
+
+setup_ohmyzsh() {
+ # Prevent the cloned repository from having insecure permissions. Failing to do
+ # so causes compinit() calls to fail with "command not found: compdef" errors
+ # for users with insecure umasks (e.g., "002", allowing group writability). Note
+ # that this will be ignored under Cygwin by default, as Windows ACLs take
+ # precedence over umasks except for filesystems mounted with option "noacl".
+ umask g-w,o-w
+
+ echo "${BLUE}Cloning Oh My Zsh...${RESET}"
+
+ command_exists git || {
+ error "git is not installed"
+ exit 1
+ }
+
+ if [ "$OSTYPE" = cygwin ] && git --version | grep -q msysgit; then
+ error "Windows/MSYS Git is not supported on Cygwin"
+ error "Make sure the Cygwin git package is installed and is first on the \$PATH"
+ exit 1
+ fi
+
+ git clone -c core.eol=lf -c core.autocrlf=false \
+ -c fsck.zeroPaddedFilemode=ignore \
+ -c fetch.fsck.zeroPaddedFilemode=ignore \
+ -c receive.fsck.zeroPaddedFilemode=ignore \
+ --depth=1 --branch "$BRANCH" "$REMOTE" "$ZSH" || {
+ error "git clone of oh-my-zsh repo failed"
+ exit 1
+ }
+
+ echo
+}
+
+setup_zshrc() {
+ # Keep most recent old .zshrc at .zshrc.pre-oh-my-zsh, and older ones
+ # with datestamp of installation that moved them aside, so we never actually
+ # destroy a user's original zshrc
+ echo "${BLUE}Looking for an existing zsh config...${RESET}"
+
+ # Must use this exact name so uninstall.sh can find it
+ OLD_ZSHRC=~/.zshrc.pre-oh-my-zsh
+ if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then
+ if [ -e "$OLD_ZSHRC" ]; then
+ OLD_OLD_ZSHRC="${OLD_ZSHRC}-$(date +%Y-%m-%d_%H-%M-%S)"
+ if [ -e "$OLD_OLD_ZSHRC" ]; then
+ error "$OLD_OLD_ZSHRC exists. Can't back up ${OLD_ZSHRC}"
+ error "re-run the installer again in a couple of seconds"
+ exit 1
+ fi
+ mv "$OLD_ZSHRC" "${OLD_OLD_ZSHRC}"
+
+ echo "${YELLOW}Found old ~/.zshrc.pre-oh-my-zsh." \
+ "${GREEN}Backing up to ${OLD_OLD_ZSHRC}${RESET}"
+ fi
+ echo "${YELLOW}Found ~/.zshrc.${RESET} ${GREEN}Backing up to ${OLD_ZSHRC}${RESET}"
+ mv ~/.zshrc "$OLD_ZSHRC"
+ fi
+
+ echo "${GREEN}Using the Oh My Zsh template file and adding it to ~/.zshrc.${RESET}"
+
+ cp "$ZSH/templates/zshrc.zsh-template" ~/.zshrc
+ sed "/^export ZSH=/ c\\
+export ZSH=\"$ZSH\"
+" ~/.zshrc > ~/.zshrc-omztemp
+ mv -f ~/.zshrc-omztemp ~/.zshrc
+
+ echo
+}
+
+setup_shell() {
+ # Skip setup if the user wants or stdin is closed (not running interactively).
+ if [ $CHSH = no ]; then
+ return
+ fi
+
+ # If this user's login shell is already "zsh", do not attempt to switch.
+ if [ "$(basename "$SHELL")" = "zsh" ]; then
+ return
+ fi
+
+ # If this platform doesn't provide a "chsh" command, bail out.
+ if ! command_exists chsh; then
+ cat <<-EOF
+ I can't change your shell automatically because this system does not have chsh.
+ ${BLUE}Please manually change your default shell to zsh${RESET}
+ EOF
+ return
+ fi
+
+ echo "${BLUE}Time to change your default shell to zsh:${RESET}"
+
+ # Prompt for user choice on changing the default login shell
+ printf "${YELLOW}Do you want to change your default shell to zsh? [Y/n]${RESET} "
+ read opt
+ case $opt in
+ y*|Y*|"") echo "Changing the shell..." ;;
+ n*|N*) echo "Shell change skipped."; return ;;
+ *) echo "Invalid choice. Shell change skipped."; return ;;
+ esac
+
+ # Check if we're running on Termux
+ case "$PREFIX" in
+ *com.termux*) termux=true; zsh=zsh ;;
+ *) termux=false ;;
+ esac
+
+ if [ "$termux" != true ]; then
+ # Test for the right location of the "shells" file
+ if [ -f /etc/shells ]; then
+ shells_file=/etc/shells
+ elif [ -f /usr/share/defaults/etc/shells ]; then # Solus OS
+ shells_file=/usr/share/defaults/etc/shells
+ else
+ error "could not find /etc/shells file. Change your default shell manually."
+ return
+ fi
+
+ # Get the path to the right zsh binary
+ # 1. Use the most preceding one based on $PATH, then check that it's in the shells file
+ # 2. If that fails, get a zsh path from the shells file, then check it actually exists
+ if ! zsh=$(which zsh) || ! grep -qx "$zsh" "$shells_file"; then
+ if ! zsh=$(grep '^/.*/zsh$' "$shells_file" | tail -1) || [ ! -f "$zsh" ]; then
+ error "no zsh binary found or not present in '$shells_file'"
+ error "change your default shell manually."
+ return
+ fi
+ fi
+ fi
+
+ # We're going to change the default shell, so back up the current one
+ if [ -n "$SHELL" ]; then
+ echo $SHELL > ~/.shell.pre-oh-my-zsh
+ else
+ grep "^$USER:" /etc/passwd | awk -F: '{print $7}' > ~/.shell.pre-oh-my-zsh
+ fi
+
+ # Actually change the default shell to zsh
+ if ! chsh -s "$zsh"; then
+ error "chsh command unsuccessful. Change your default shell manually."
+ else
+ export SHELL="$zsh"
+ echo "${GREEN}Shell successfully changed to '$zsh'.${RESET}"
+ fi
+
+ echo
+}
+
main() {
- # Use colors, but only if connected to a terminal, and that terminal
- # supports them.
- if which tput >/dev/null 2>&1; then
- ncolors=$(tput colors)
- fi
- if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
- RED="$(tput setaf 1)"
- GREEN="$(tput setaf 2)"
- YELLOW="$(tput setaf 3)"
- BLUE="$(tput setaf 4)"
- BOLD="$(tput bold)"
- NORMAL="$(tput sgr0)"
- else
- RED=""
- GREEN=""
- YELLOW=""
- BLUE=""
- BOLD=""
- NORMAL=""
- fi
-
- # Only enable exit-on-error after the non-critical colorization stuff,
- # which may fail on systems lacking tput or terminfo
- set -e
-
- if ! command -v zsh >/dev/null 2>&1; then
- printf "${YELLOW}Zsh is not installed!${NORMAL} Please install zsh first!\n"
- exit
- fi
-
- if [ ! -n "$ZSH" ]; then
- ZSH=~/.oh-my-zsh
- fi
-
- if [ -d "$ZSH" ]; then
- printf "${YELLOW}You already have Oh My Zsh installed.${NORMAL}\n"
- printf "You'll need to remove $ZSH if you want to re-install.\n"
- exit
- fi
-
- # Prevent the cloned repository from having insecure permissions. Failing to do
- # so causes compinit() calls to fail with "command not found: compdef" errors
- # for users with insecure umasks (e.g., "002", allowing group writability). Note
- # that this will be ignored under Cygwin by default, as Windows ACLs take
- # precedence over umasks except for filesystems mounted with option "noacl".
- umask g-w,o-w
-
- printf "${BLUE}Cloning Oh My Zsh...${NORMAL}\n"
- command -v git >/dev/null 2>&1 || {
- echo "Error: git is not installed"
- exit 1
- }
- # The Windows (MSYS) Git is not compatible with normal use on cygwin
- if [ "$OSTYPE" = cygwin ]; then
- if git --version | grep msysgit > /dev/null; then
- echo "Error: Windows/MSYS Git is not supported on Cygwin"
- echo "Error: Make sure the Cygwin git package is installed and is first on the path"
- exit 1
- fi
- fi
- env git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git "$ZSH" || {
- printf "Error: git clone of oh-my-zsh repo failed\n"
- exit 1
- }
-
-
- printf "${BLUE}Looking for an existing zsh config...${NORMAL}\n"
- if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then
- printf "${YELLOW}Found ~/.zshrc.${NORMAL} ${GREEN}Backing up to ~/.zshrc.pre-oh-my-zsh${NORMAL}\n";
- mv ~/.zshrc ~/.zshrc.pre-oh-my-zsh;
- fi
-
- printf "${BLUE}Using the Oh My Zsh template file and adding it to ~/.zshrc${NORMAL}\n"
- cp "$ZSH"/templates/zshrc.zsh-template ~/.zshrc
- sed "/^export ZSH=/ c\\
- export ZSH=\"$ZSH\"
- " ~/.zshrc > ~/.zshrc-omztemp
- mv -f ~/.zshrc-omztemp ~/.zshrc
-
- # If this user's login shell is not already "zsh", attempt to switch.
- TEST_CURRENT_SHELL=$(basename "$SHELL")
- if [ "$TEST_CURRENT_SHELL" != "zsh" ]; then
- # If this platform provides a "chsh" command (not Cygwin), do it, man!
- if hash chsh >/dev/null 2>&1; then
- printf "${BLUE}Time to change your default shell to zsh!${NORMAL}\n"
- chsh -s $(grep /zsh$ /etc/shells | tail -1)
- # Else, suggest the user do so manually.
- else
- printf "I can't change your shell automatically because this system does not have chsh.\n"
- printf "${BLUE}Please manually change your default shell to zsh!${NORMAL}\n"
- fi
- fi
-
- printf "${GREEN}"
- echo ' __ __ '
- echo ' ____ / /_ ____ ___ __ __ ____ _____/ /_ '
- echo ' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '
- echo '/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '
- echo '\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '
- echo ' /____/ ....is now installed!'
- echo ''
- echo ''
- echo 'Please look over the ~/.zshrc file to select plugins, themes, and options.'
- echo ''
- echo 'p.s. Follow us at https://twitter.com/ohmyzsh.'
- echo ''
- echo 'p.p.s. Get stickers, shirts, and coffee mugs at https://shop.planetargon.com/collections/oh-my-zsh.'
- echo ''
- printf "${NORMAL}"
- env zsh -l
+ # Run as unattended if stdin is closed
+ if [ ! -t 0 ]; then
+ RUNZSH=no
+ CHSH=no
+ fi
+
+ # Parse arguments
+ while [ $# -gt 0 ]; do
+ case $1 in
+ --unattended) RUNZSH=no; CHSH=no ;;
+ --skip-chsh) CHSH=no ;;
+ esac
+ shift
+ done
+
+ setup_color
+
+ if ! command_exists zsh; then
+ echo "${YELLOW}Zsh is not installed.${RESET} Please install zsh first."
+ exit 1
+ fi
+
+ if [ -d "$ZSH" ]; then
+ cat <<-EOF
+ ${YELLOW}You already have Oh My Zsh installed.${RESET}
+ You'll need to remove '$ZSH' if you want to reinstall.
+ EOF
+ exit 1
+ fi
+
+ setup_ohmyzsh
+ setup_zshrc
+ setup_shell
+
+ printf "$GREEN"
+ cat <<-'EOF'
+ __ __
+ ____ / /_ ____ ___ __ __ ____ _____/ /_
+ / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \
+ / /_/ / / / / / / / / / / /_/ / / /_(__ ) / / /
+ \____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/
+ /____/ ....is now installed!
+
+
+ Please look over the ~/.zshrc file to select plugins, themes, and options.
+
+ p.s. Follow us on https://twitter.com/ohmyzsh
+
+ p.p.s. Get stickers, shirts, and coffee mugs at https://shop.planetargon.com/collections/oh-my-zsh
+
+ EOF
+ printf "$RESET"
+
+ if [ $RUNZSH = no ]; then
+ echo "${YELLOW}Run zsh to try it out.${RESET}"
+ exit
+ fi
+
+ exec zsh -l
}
-main
+main "$@"
diff --git a/tools/uninstall.sh b/tools/uninstall.sh
index bf2244be8..b327a0163 100644
--- a/tools/uninstall.sh
+++ b/tools/uninstall.sh
@@ -10,25 +10,31 @@ if [ -d ~/.oh-my-zsh ]; then
fi
echo "Looking for original zsh config..."
-if [ -f ~/.zshrc.pre-oh-my-zsh ] || [ -h ~/.zshrc.pre-oh-my-zsh ]; then
- echo "Found ~/.zshrc.pre-oh-my-zsh -- Restoring to ~/.zshrc";
+ZSHRC_ORIG=~/.zshrc.pre-oh-my-zsh
+if [ -e "$ZSHRC_ORIG" ]; then
+ echo "Found $ZSHRC_ORIG -- Restoring to ~/.zshrc"
- if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then
- ZSHRC_SAVE=".zshrc.omz-uninstalled-$(date +%Y%m%d%H%M%S)";
- echo "Found ~/.zshrc -- Renaming to ~/${ZSHRC_SAVE}";
- mv ~/.zshrc ~/"${ZSHRC_SAVE}";
+ if [ -e ~/.zshrc ]; then
+ ZSHRC_SAVE=~/.zshrc.omz-uninstalled-$(date +%Y-%m-%d_%H-%M-%S)
+ echo "Found ~/.zshrc -- Renaming to ${ZSHRC_SAVE}"
+ mv ~/.zshrc "${ZSHRC_SAVE}"
fi
- mv ~/.zshrc.pre-oh-my-zsh ~/.zshrc;
+ mv "$ZSHRC_ORIG" ~/.zshrc
- echo "Your original zsh config was restored. Please restart your session."
-else
- if hash chsh >/dev/null 2>&1; then
- echo "Switching back to bash"
- chsh -s /bin/bash
+ echo "Your original zsh config was restored."
+fi
+
+if hash chsh >/dev/null 2>&1 && [ -f ~/.shell.pre-oh-my-zsh ]; then
+ old_shell=$(cat ~/.shell.pre-oh-my-zsh)
+ echo "Switching your shell back to '$old_shell':"
+ if chsh -s "$old_shell"; then
+ rm -f ~/.shell.pre-oh-my-zsh
else
- echo "You can edit /etc/passwd to switch your default shell back to bash"
+ echo "Could not change default shell. Change it manually by running chsh"
+ echo "or editing the /etc/passwd file."
fi
fi
echo "Thanks for trying out Oh My Zsh. It's been uninstalled."
+echo "Don't forget to restart your terminal!"
diff --git a/tools/upgrade.sh b/tools/upgrade.sh
index d234c7f88..3005e6542 100644
--- a/tools/upgrade.sh
+++ b/tools/upgrade.sh
@@ -20,8 +20,24 @@ else
NORMAL=""
fi
-printf "${BLUE}%s${NORMAL}\n" "Updating Oh My Zsh"
cd "$ZSH"
+
+# Set git-config values known to fix git errors
+# Line endings (#4069)
+git config core.eol lf
+git config core.autocrlf false
+# zeroPaddedFilemode fsck errors (#4963)
+git config fsck.zeroPaddedFilemode ignore
+git config fetch.fsck.zeroPaddedFilemode ignore
+git config receive.fsck.zeroPaddedFilemode ignore
+
+# Update upstream remote to ohmyzsh org
+remote=$(git remote -v | awk '/https:\/\/github\.com\/robbyrussell\/oh-my-zsh\.git/{ print $1; exit }')
+if [ -n "$remote" ]; then
+ git remote set-url "$remote" "https://github.com/ohmyzsh/ohmyzsh.git"
+fi
+
+printf "${BLUE}%s${NORMAL}\n" "Updating Oh My Zsh"
if git pull --rebase --stat origin master
then
printf '%s' "$GREEN"
@@ -33,7 +49,7 @@ then
printf '%s\n' ' /____/ '
printf "${BLUE}%s\n" "Hooray! Oh My Zsh has been updated and/or is at the current version."
printf "${BLUE}${BOLD}%s${NORMAL}\n" "To keep up on the latest news and updates, follow us on twitter: https://twitter.com/ohmyzsh"
- printf "${BLUE}${BOLD}%s${NORMAL}\n" "Get your Oh My Zsh swag at: https://shop.planetargon.com/collections/oh-my-zsh"
+ printf "${BLUE}${BOLD}%s${NORMAL}\n" "Get your Oh My Zsh swag at: https://shop.planetargon.com/collections/oh-my-zsh"
else
printf "${RED}%s${NORMAL}\n" 'There was an error updating. Try again later?'
fi