18ee5dffdc57bb9219ee96b40da006704ac37df1
- Author
- Marc Cornellà <marc.cornella@live.com>
- Committer
- GitHub <noreply@github.com>
- Date
Message
Diff
This diff is truncated to protect this page.
1diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
2index ff55f36be22e94707b5d924df9e8f3ea5674bd14..7c1cb89671b4d544ce6b8b016aaedc31f1c6addc 100644
3--- a/.github/ISSUE_TEMPLATE/bug_report.md
4+++ b/.github/ISSUE_TEMPLATE/bug_report.md
5@@ -1,7 +1,7 @@
6 ---
7 name: Bug report
8-about: Create a report to help us improve
9-labels: 'Type: bug'
10+about: Create a report to help us improve Oh My Zsh
11+labels: 'Type: support'
12
13 ---
14
15@@ -11,29 +11,26 @@ an issue where no sections have been filled will be deleted without comment.
16 -->
17
18 **Describe the bug**
19-<!-- A clear and concise description of what the bug is. -->
20+A clear description of what the bug is.
21
22 **To Reproduce**
23-<!--
24-Steps to reproduce the behavior:
25-1. Enable plugin '...'
26-2. Run command '...', _or_ try to complete command '...', _etc._
27+Steps to reproduce the behavior, for example:
28+1. Enable this plugin '...'
29+2. Run command '...' or try the autocomplete command '...'
30 3. See error
31--->
32
33 **Expected behavior**
34-<!-- A clear and concise description of what you expected to happen. -->
35+A brief description of what should happen.
36
37-**Screenshots or recordings**
38-<!--
39-If applicable, add screenshots or record an asciinema session (https://asciinema.org/)
40-to help explain your problem.
41--->
42+**Screenshots and/or Recordings**
43+If applicable, add screenshots to help explain your problem.
44+You can also record an asciinema session: https://asciinema.org/
45
46-**System:**
47- - OS: [e.g. macOS]
48- - Zsh version [e.g. 5.6]
49+**Desktop (please complete the following information):**
50+ - OS / Distro: [e.g. Arch Linux, macOS]
51+ - Latest ohmyzsh Update?: [e.g. Yes/No]
52+ - ZSH Version: [e.g. 5.6]
53 - Terminal emulator [e.g. iTerm2]
54
55 **Additional context**
56-<!-- Add any other context about the problem here. -->
57+Add any other context about the problem here. This can be themes, plugins, custom configs.
58diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md
59index d9c324a55a92870e431c8ccc41c6978fd3448c5b..346eabaea14e68e373dac0d7498c5dc3860191b1 100644
60--- a/.github/ISSUE_TEMPLATE/feature_request.md
61+++ b/.github/ISSUE_TEMPLATE/feature_request.md
62@@ -11,16 +11,16 @@ an issue where no sections have been filled will be deleted without comment.
63 -->
64
65 **Is your feature request related to a particular plugin or theme? If so, specify it.**
66-<!-- The name of the plugin or theme you'd like us to improve. -->
67+The name of the plugin or theme that you would like us to improve. [...]
68
69 **Is your feature request related to a problem? Please describe.**
70-<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
71+A description of what the problem is. Ex. I'm always frustrated when [...]
72
73 **Describe the solution you'd like**
74-<!-- A clear and concise description of what you want to happen. -->
75+A description of what you want to happen.
76
77 **Describe alternatives you've considered**
78-<!-- A clear and concise description of any alternative solutions or features you've considered. -->
79+A description of any alternative solutions or features you've considered. This can also include other plugins or aliases.
80
81 **Additional context**
82-<!-- Add any other context or screenshots about the feature request here. -->
83+Add any other context or screenshots about the feature request here. Also if you have any PRs related to this issue that are already open that you would like us to look at.
84diff --git a/.github/ISSUE_TEMPLATE/support.md b/.github/ISSUE_TEMPLATE/support.md
85index 3c69a7d5ec2641bd9e2c98c88384382b12bdd9d4..d2638412e08eaa38bb9479b5e733d17c9cac5f78 100644
86--- a/.github/ISSUE_TEMPLATE/support.md
87+++ b/.github/ISSUE_TEMPLATE/support.md
88@@ -5,8 +5,6 @@ labels: 'Type: support'
89
90 ---
91
92-<!--
93 1. Look for similar issues already posted (including closed ones)
94 2. Include as much relevant information as possible
95 3. Try to make sure the issue is due to Oh My Zsh
96--->
97diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
98new file mode 100644
99index 0000000000000000000000000000000000000000..6bcb90efe169ad43ec01ff1b34932d6fab86ca22
100--- /dev/null
101+++ b/.github/PULL_REQUEST_TEMPLATE.md
102@@ -0,0 +1,17 @@
103+## Standards checklist:
104+
105+- [ ] The PR title is descriptive.
106+- [ ] The PR doesn't replicate another PR which is already open.
107+- [ ] I have read the contribution guide and followed all the instructions.
108+- [ ] The code follows the code style guide detailed in the wiki.
109+- [ ] The code is mine or it's from somewhere with an MIT-compatible license.
110+- [ ] The code is efficient, to the best of my ability, and does not waste computer resources.
111+- [ ] The code is stable and I have tested it myself, to the best of my abilities.
112+
113+## Changes:
114+
115+- [...]
116+
117+## Other comments:
118+
119+...
120diff --git a/.github/main.workflow b/.github/main.workflow
121deleted file mode 100644
122index 0dbb0247ab0e6bbaafe84671948aff9e43657229..0000000000000000000000000000000000000000
123--- a/.github/main.workflow
124+++ /dev/null
125@@ -1,17 +0,0 @@
126-workflow "Triage Pull Request" {
127- on = "pull_request"
128- resolves = ["Triage"]
129-}
130-
131-# Only act if there are code changes: if the pull_request
132-# event's action is either 'opened' (new PR) or 'synchronize' (new commits)
133-action "Filter actions" {
134- uses = "actions/bin/filter@0ac6d44"
135- args = "action 'opened|synchronize'"
136-}
137-
138-action "Triage" {
139- needs = ["Filter actions"]
140- uses = "ohmyzsh/github-actions/pull-request-triage@master"
141- secrets = ["GITHUB_TOKEN"]
142-}
143diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
144new file mode 100644
145index 0000000000000000000000000000000000000000..7ab7efdd6edab425c4735cf2b0ccdf21e2513fd8
146--- /dev/null
147+++ b/.github/workflows/main.yml
148@@ -0,0 +1,36 @@
149+name: CI
150+on:
151+ pull_request:
152+ types:
153+ - opened
154+ - synchronize
155+ branches:
156+ - master
157+ push:
158+ branches:
159+ - master
160+
161+jobs:
162+ tests:
163+ name: Run tests
164+ runs-on: ${{ matrix.os }}
165+ strategy:
166+ matrix:
167+ os: [ubuntu-latest, macos-latest]
168+ steps:
169+ - name: Set up git repository
170+ uses: actions/checkout@v2
171+ - name: Install zsh
172+ if: runner.os == 'Linux'
173+ run: sudo apt-get update; sudo apt-get install zsh
174+ - name: Test installer
175+ run: sh ./tools/install.sh
176+ - name: Check syntax
177+ run: |
178+ for file in ./oh-my-zsh.sh \
179+ ./lib/*.zsh \
180+ ./plugins/*/*.plugin.zsh \
181+ ./plugins/*/_* \
182+ ./themes/*.zsh-theme; do
183+ zsh -n "$file" || return 1
184+ done
185diff --git a/.gitignore b/.gitignore
186index 87a79cdae3464823e307182badbf1d1ffc4b5aad..ec24a19bb4c971d4675b24cc477fc818b195d735 100644
187--- a/.gitignore
188+++ b/.gitignore
189@@ -4,3 +4,5 @@ custom/
190 # temp files directories
191 cache/
192 log/
193+*.swp
194+.DS_Store
195diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
196index f575157c21876fc09fb9bfa48297ad6a4ad1f158..be67e93b0a4242e8f96903d6b93bbc8a626afaee 100644
197--- a/CONTRIBUTING.md
198+++ b/CONTRIBUTING.md
199@@ -31,7 +31,7 @@ your problem.
200
201 If you find one, comment on it so we can know there are more people experiencing it.
202
203-If not, look at the [Troubleshooting](https://github.com/robbyrussell/oh-my-zsh/wiki/Troubleshooting)
204+If not, look at the [Troubleshooting](https://github.com/ohmyzsh/ohmyzsh/wiki/Troubleshooting)
205 page for instructions on how to gather data to better debug your problem.
206
207 Then, you can go ahead and create an issue with as much detail as you can provide.
208@@ -62,7 +62,7 @@ maintainers) by mentioning their GitHub handle (starting with `@`) in your messa
209
210 You should be familiar with the basics of
211 [contributing on GitHub](https://help.github.com/articles/using-pull-requests) and have a fork
212-[properly set up](https://github.com/robbyrussell/oh-my-zsh/wiki/Contribution-Technical-Practices).
213+[properly set up](https://github.com/ohmyzsh/ohmyzsh/wiki/Contribution-Technical-Practices).
214
215 You MUST always create PRs with _a dedicated branch_ based on the latest upstream tree.
216
217@@ -85,7 +85,7 @@ maintainers) by mentioning their GitHub handle (starting with `@`) in your messa
218
219 ### You have an addition
220
221-Please [do not](https://github.com/robbyrussell/oh-my-zsh/wiki/Themes#dont-send-us-your-theme-for-now)
222+Please [do not](https://github.com/ohmyzsh/ohmyzsh/wiki/Themes#dont-send-us-your-theme-for-now)
223 send themes for now.
224
225 Please be so kind as to [search](#use-the-search-luke) for any pending, merged or rejected Pull Requests
226@@ -109,7 +109,7 @@ to help you check whether a similar contribution to yours already exists. Please
227 before making any contribution, it avoids duplicates and eases maintenance. Trust me,
228 that works 90% of the time.
229
230-You can also take a look at the [FAQ](https://github.com/robbyrussell/oh-my-zsh/wiki/FAQ)
231+You can also take a look at the [FAQ](https://github.com/ohmyzsh/ohmyzsh/wiki/FAQ)
232 to be sure your contribution has not already come up.
233
234 If all fails, your thing has probably not been reported yet, so you can go ahead
235@@ -121,5 +121,5 @@ and [create an issue](#reporting-issues) or [submit a PR](#submitting-pull-reque
236
237 Very nice!! :)
238
239-Please have a look at the [Volunteer](https://github.com/robbyrussell/oh-my-zsh/wiki/Volunteers)
240+Please have a look at the [Volunteer](https://github.com/ohmyzsh/ohmyzsh/wiki/Volunteers)
241 page for instructions on where to start and more.
242diff --git a/LICENSE.txt b/LICENSE.txt
243index 4d465b1c31fc0c7d9cca130ad273c160c5955ef5..45ba85a37451c641d6f8a898cc5fd57b5628eeab 100644
244--- a/LICENSE.txt
245+++ b/LICENSE.txt
246@@ -1,7 +1,6 @@
247-The MIT License (MIT)
248+MIT License
249
250-Copyright (c) 2009-2019 Robby Russell and contributors
251-See the full list at https://github.com/robbyrussell/oh-my-zsh/contributors
252+Copyright (c) 2009-2020 Robby Russell and contributors (https://github.com/ohmyzsh/ohmyzsh/contributors)
253
254 Permission is hereby granted, free of charge, to any person obtaining a copy
255 of this software and associated documentation files (the "Software"), to deal
256diff --git a/README.md b/README.md
257index 78a5b56bda1f5244d6a156f57d3679d41eb8bcff..187cceb7d255c5e039b8e83f37b2271820295891 100644
258--- a/README.md
259+++ b/README.md
260@@ -12,16 +12,18 @@ Once installed, your terminal shell will become the talk of the town _or your mo
261
262 Finally, you'll begin to get the sort of attention that you have always felt you deserved. ...or maybe you'll use the time that you're saving to start flossing more often. 😬
263
264-To learn more, visit [ohmyz.sh](https://ohmyz.sh) and follow [@ohmyzsh](https://twitter.com/ohmyzsh) on Twitter.
265+To learn more, visit [ohmyz.sh](https://ohmyz.sh), follow [@ohmyzsh](https://twitter.com/ohmyzsh) on Twitter, and/or join us on Discord.
266+
267+[](https://github.com/ohmyzsh/ohmyzsh/actions?query=workflow%3ACI)
268+[](https://twitter.com/intent/follow?screen_name=ohmyzsh)
269+[](https://discord.gg/bpXWhnN)
270
271 ## Getting Started
272
273 ### Prerequisites
274
275-__Disclaimer:__ _Oh My Zsh works best on macOS and Linux._
276-
277-* Unix-like operating system (macOS or Linux)
278-* [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)
279+* A Unix-like operating system: macOS, Linux, BSD. On Windows: WSL is preferred, but cygwin or msys also mostly work.
280+* [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)
281 * `curl` or `wget` should be installed
282 * `git` should be installed
283
284@@ -32,13 +34,13 @@ Oh My Zsh is installed by running one of the following commands in your terminal
285 #### via curl
286
287 ```shell
288-sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
289+sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
290 ```
291
292 #### via wget
293
294 ```shell
295-sh -c "$(wget -O- https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
296+sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
297 ```
298
299 #### Manual inspection
300@@ -48,7 +50,7 @@ that by downloading the install script first, looking through it so everything l
301 then running it:
302
303 ```shell
304-curl -Lo install.sh https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh
305+curl -Lo install.sh https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh
306 sh install.sh
307 ```
308
309@@ -56,7 +58,7 @@ sh install.sh
310
311 ### Plugins
312
313diff --git a/lib/clipboard.zsh b/lib/clipboard.zsh
314index 333f58dd88fbcc80377c3ed8b7e14c868e808493..6102f33246fc115410b9b86a05a15ff9edccb4ee 100644
315--- a/lib/clipboard.zsh
316+++ b/lib/clipboard.zsh
317@@ -54,7 +54,7 @@ function detect-clipboard() {
318 if [[ "${OSTYPE}" == darwin* ]] && (( ${+commands[pbcopy]} )) && (( ${+commands[pbpaste]} )); then
319 function clipcopy() { pbcopy < "${1:-/dev/stdin}"; }
320 function clippaste() { pbpaste; }
321- elif [[ "${OSTYPE}" == cygwin* ]]; then
322+ elif [[ "${OSTYPE}" == (cygwin|msys)* ]]; then
323 function clipcopy() { cat "${1:-/dev/stdin}" > /dev/clipboard; }
324 function clippaste() { cat /dev/clipboard; }
325 elif [ -n "${WAYLAND_DISPLAY:-}" ] && (( ${+commands[wl-copy]} )) && (( ${+commands[wl-paste]} )); then
326diff --git a/lib/completion.zsh b/lib/completion.zsh
327index c7db2eb7b20abde827d46858e03d3b8f87b9957a..c932bc925494da7a2ce74f67daa9c32dd5a31996 100644
328--- a/lib/completion.zsh
329+++ b/lib/completion.zsh
330@@ -71,3 +71,6 @@ if [[ $COMPLETION_WAITING_DOTS = true ]]; then
331 zle -N expand-or-complete-with-dots
332 bindkey "^I" expand-or-complete-with-dots
333 fi
334+
335+# automatically load bash completion functions
336+autoload -Uz bashcompinit && bashcompinit
337diff --git a/lib/functions.zsh b/lib/functions.zsh
338index 9f8736bd7e2967321fd95b561a5480f5c5d42e5e..91e9cf895e1c1e446b1411fe763667bcabd8e4d9 100644
339--- a/lib/functions.zsh
340+++ b/lib/functions.zsh
341@@ -3,11 +3,12 @@ function zsh_stats() {
342 }
343
344 function uninstall_oh_my_zsh() {
345- env ZSH=$ZSH sh $ZSH/tools/uninstall.sh
346+ env ZSH="$ZSH" sh "$ZSH/tools/uninstall.sh"
347 }
348
349 function upgrade_oh_my_zsh() {
350- env ZSH=$ZSH sh $ZSH/tools/upgrade.sh
351+ env ZSH="$ZSH" sh "$ZSH/tools/upgrade.sh"
352+ rm -rf "$ZSH/log/update.lock"
353 }
354
355 function take() {
356@@ -21,7 +22,7 @@ function open_command() {
357 case "$OSTYPE" in
358 darwin*) open_cmd='open' ;;
359 cygwin*) open_cmd='cygstart' ;;
360- linux*) ! [[ $(uname -a) =~ "Microsoft" ]] && open_cmd='xdg-open' || {
361+ linux*) [[ "$(uname -r)" != *icrosoft* ]] && open_cmd='nohup xdg-open' || {
362 open_cmd='cmd.exe /c start ""'
363 [[ -e "$1" ]] && { 1="$(wslpath -w "${1:a}")" || return 1 }
364 } ;;
365@@ -31,12 +32,7 @@ function open_command() {
366 ;;
367 esac
368
369- # don't use nohup on OSX
370- if [[ "$OSTYPE" == darwin* ]]; then
371- ${=open_cmd} "$@" &>/dev/null
372- else
373- nohup ${=open_cmd} "$@" &>/dev/null
374- fi
375+ ${=open_cmd} "$@" &>/dev/null
376 }
377
378 #
379diff --git a/lib/git.zsh b/lib/git.zsh
380index 640561e97563e1aeffde3a9067674213e439a5ac..00cb00b19e81de958c54d6a548be146ac9a7563a 100644
381--- a/lib/git.zsh
382+++ b/lib/git.zsh
383@@ -12,11 +12,21 @@ function git_prompt_info() {
384 function parse_git_dirty() {
385 local STATUS
386 local -a FLAGS
387- FLAGS=('--porcelain' '--ignore-submodules=dirty')
388+ FLAGS=('--porcelain')
389 if [[ "$(command git config --get oh-my-zsh.hide-dirty)" != "1" ]]; then
390 if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" == "true" ]]; then
391 FLAGS+='--untracked-files=no'
392 fi
393+ case "$GIT_STATUS_IGNORE_SUBMODULES" in
394+ git)
395+ # let git decide (this respects per-repo config in .gitmodules)
396+ ;;
397+ *)
398+ # if unset: ignore dirty submodules
399+ # other values are passed to --ignore-submodules
400+ FLAGS+="--ignore-submodules=${GIT_STATUS_IGNORE_SUBMODULES:-dirty}"
401+ ;;
402+ esac
403 STATUS=$(command git status ${FLAGS} 2> /dev/null | tail -n1)
404 fi
405 if [[ -n $STATUS ]]; then
406@@ -189,3 +199,12 @@ function git_current_user_name() {
407 function git_current_user_email() {
408 command git config user.email 2>/dev/null
409 }
410+
411+# Output the name of the root directory of the git repository
412+# Usage example: $(git_repo_name)
413+function git_repo_name() {
414+ local repo_path
415+ if repo_path="$(git rev-parse --show-toplevel 2>/dev/null)" && [[ -n "$repo_path" ]]; then
416+ echo ${repo_path:t}
417+ fi
418+}
419diff --git a/lib/misc.zsh b/lib/misc.zsh
420index 40ffa479da106a4797b47eb77885506c933f3657..61571afc9cdde321bc5d2e686d95e4283cf2ec7c 100644
421--- a/lib/misc.zsh
422+++ b/lib/misc.zsh
423@@ -22,7 +22,7 @@ env_default 'PAGER' 'less'
424 env_default 'LESS' '-R'
425
426 ## super user alias
427-alias _='sudo'
428+alias _='sudo '
429
430 ## more intelligent acking for ubuntu users
431 if which ack-grep &> /dev/null; then
432@@ -31,10 +31,5 @@ else
433 alias afind='ack -il'
434 fi
435
436-# only define LC_CTYPE if undefined
437-if [[ -z "$LC_CTYPE" && -z "$LC_ALL" ]]; then
438- export LC_CTYPE=${LANG%%:*} # pick the first entry from LANG
439-fi
440-
441 # recognize comments
442 setopt interactivecomments
443diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh
444index aa14f3f07fe4a12979cd9352b8a6ee6d917cadc0..f5e367fcbc8a0391f3ed2b3cf28f6fa36fea91b5 100644
445--- a/lib/termsupport.zsh
446+++ b/lib/termsupport.zsh
447@@ -75,8 +75,9 @@ function omz_termsupport_preexec {
448 title '$CMD' '%100>...>$LINE%<<'
449 }
450
451-precmd_functions+=(omz_termsupport_precmd)
452-preexec_functions+=(omz_termsupport_preexec)
453+autoload -U add-zsh-hook
454+add-zsh-hook precmd omz_termsupport_precmd
455+add-zsh-hook preexec omz_termsupport_preexec
456
457
458 # Keep Apple Terminal.app's current working directory updated
459@@ -99,7 +100,7 @@ if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then
460 }
461
462 # Use a precmd hook instead of a chpwd hook to avoid contaminating output
463- precmd_functions+=(update_terminalapp_cwd)
464+ add-zsh-hook precmd update_terminalapp_cwd
465 # Run once to get initial cwd set
466 update_terminalapp_cwd
467 fi
468diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh
469index 6b2662d5e8fdde23ad91d0557c43baff1206a5c1..30259372cd9f828a9308f3bd4a013afa85c95574 100644
470--- a/oh-my-zsh.sh
471+++ b/oh-my-zsh.sh
472@@ -32,8 +32,8 @@ fi
473 is_plugin() {
474 local base_dir=$1
475 local name=$2
476- test -f $base_dir/plugins/$name/$name.plugin.zsh \
477- || test -f $base_dir/plugins/$name/_$name
478+ builtin test -f $base_dir/plugins/$name/$name.plugin.zsh \
479+ || builtin test -f $base_dir/plugins/$name/_$name
480 }
481
482 # Add all defined plugins to fpath. This must be done
483@@ -97,25 +97,12 @@ done
484 unset config_file
485
486 # Load the theme
487-if [[ "$ZSH_THEME" == "random" ]]; then
488- if [[ "${(t)ZSH_THEME_RANDOM_CANDIDATES}" = "array" ]] && [[ "${#ZSH_THEME_RANDOM_CANDIDATES[@]}" -gt 0 ]]; then
489- themes=($ZSH/themes/${^ZSH_THEME_RANDOM_CANDIDATES}.zsh-theme)
490+if [ ! "$ZSH_THEME" = "" ]; then
491+ if [ -f "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme" ]; then
492+ source "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme"
493+ elif [ -f "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme" ]; then
494+ source "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme"
495 else
496- themes=($ZSH/themes/*zsh-theme)
497- fi
498- N=${#themes[@]}
499- ((N=(RANDOM%N)+1))
500- RANDOM_THEME=${themes[$N]}
501- source "$RANDOM_THEME"
502- echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..."
503-else
504- if [ ! "$ZSH_THEME" = "" ]; then
505- if [ -f "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme" ]; then
506- source "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme"
507- elif [ -f "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme" ]; then
508- source "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme"
509- else
510- source "$ZSH/themes/$ZSH_THEME.zsh-theme"
511- fi
512+ source "$ZSH/themes/$ZSH_THEME.zsh-theme"
513 fi
514 fi
515diff --git a/plugins/alias-finder/README.md b/plugins/alias-finder/README.md
516new file mode 100644
517index 0000000000000000000000000000000000000000..409f4b6536210d74caa3efee77ffc5a930da728b
518--- /dev/null
519+++ b/plugins/alias-finder/README.md
520@@ -0,0 +1,46 @@
521+# alias-finder plugin
522+
523+This plugin searches the defined aliases and outputs any that match the command inputted. This makes learning new aliases easier.
524+
525+To use it, add `alias-finder` to the `plugins` array of your zshrc file:
526+```
527+plugins=(... alias-finder)
528+```
529+
530+## Usage
531+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.
532+
533+## Options
534+
535+- Use `--longer` or `-l` to allow the aliases to be longer than the input (match aliases if they contain the input).
536+- Use `--exact` or `-e` to avoid matching aliases that are shorter than the input.
537+
538+## Examples
539+```
540+$ alias-finder "git pull"
541+gl='git pull'
542+g=git
543+```
544+```
545+$ alias-finder "web_search google oh my zsh"
546+google='web_search google'
547+```
548+```
549+$ alias-finder "git commit -v"
550+gc="git commit -v"
551+g=git
552+```
553+```
554+$ alias-finder -e "git commit -v"
555+gc='git commit -v'
556+```
557+```
558+$ alias-finder -l "git commit -v"
559+gc='git commit -v'
560+'gc!'='git commit -v --amend'
561+gca='git commit -v -a'
562+'gca!'='git commit -v -a --amend'
563+'gcan!'='git commit -v -a --no-edit --amend'
564+'gcans!'='git commit -v -a -s --no-edit --amend'
565+'gcn!'='git commit -v --no-edit --amend'
566+```
567diff --git a/plugins/alias-finder/alias-finder.plugin.zsh b/plugins/alias-finder/alias-finder.plugin.zsh
568new file mode 100644
569index 0000000000000000000000000000000000000000..caee9b5a3bc43b2092cd6a7ab73e086dc664a8ed
570--- /dev/null
571+++ b/plugins/alias-finder/alias-finder.plugin.zsh
572@@ -0,0 +1,47 @@
573+alias-finder() {
574+ local cmd="" exact="" longer="" wordStart="" wordEnd="" multiWordEnd=""
575+ for i in $@; do
576+ case $i in
577+ -e|--exact) exact=true;;
578+ -l|--longer) longer=true;;
579+ *)
580+ if [[ -z $cmd ]]; then
581+ cmd=$i
582+ else
583+ cmd="$cmd $i"
584+ fi
585+ ;;
586+ esac
587+ done
588+ cmd=$(sed 's/[].\|$(){}?+*^[]/\\&/g' <<< $cmd) # adds escaping for grep
589+ if (( $(wc -l <<< $cmd) == 1 )); then
590+ while [[ $cmd != "" ]]; do
591+ if [[ $longer = true ]]; then
592+ wordStart="'{0,1}"
593+ else
594+ wordEnd="$"
595+ multiWordEnd="'$"
596+ fi
597+ if [[ $cmd == *" "* ]]; then
598+ local finder="'$cmd$multiWordEnd"
599+ else
600+ local finder=$wordStart$cmd$wordEnd
601+ fi
602+ alias | grep -E "=$finder"
603+ if [[ $exact = true || $longer = true ]]; then
604+ break
605+ else
606+ cmd=$(sed -E 's/ {0,1}[^ ]*$//' <<< $cmd) # removes last word
607+ fi
608+ done
609+ fi
610+}
611+
612+preexec_alias-finder() {
613+ if [[ $ZSH_ALIAS_FINDER_AUTOMATIC = true ]]; then
614+ alias-finder $1
615+ fi
616+}
617+
618+autoload -U add-zsh-hook
619+add-zsh-hook preexec preexec_alias-finder
620diff --git a/plugins/arcanist/README.md b/plugins/arcanist/README.md
621index 4bb8c809098a6fe94b3bc475ea12e611da7189bc..9c15f09b56fe395e96b47b0ded645d10c1d4705d 100644
622--- a/plugins/arcanist/README.md
623+++ b/plugins/arcanist/README.md
624@@ -1,5 +1,29 @@
625 ## arcanist
626
627-**Maintainer:** [@emzar](https://github.com/emzar)
628+This plugin adds many useful aliases for [arcanist](https://github.com/phacility/arcanist).
629
630-This plugin adds many useful aliases.
631+To use it, add `arcanist` to the plugins array of your zshrc file:
632+
633+```zsh
634+plugins=(... arcanist)
635+```
636+
637+## Aliases
638+
639+| Alias | Command |
640+|---------|------------------------------------|
641+| ara | `arc amend` |
642+| arb | `arc branch` |
643+| arco | `arc cover` |
644+| arci | `arc commit` |
645+| ard | `arc diff` |
646+| ardc | `arc diff --create` |
647+| ardnu | `arc diff --nounit` |
648+| ardnupc | `arc diff --nounit --plan-changes` |
649+| ardpc | `arc diff --plan-changes` |
650+| are | `arc export` |
651+| arh | `arc help` |
652+| arl | `arc land` |
653+| arli | `arc lint` |
654+| arls | `arc list` |
655+| arpa | `arc patch` |
656diff --git a/plugins/arcanist/arcanist.plugin.zsh b/plugins/arcanist/arcanist.plugin.zsh
657index 3f4eb07f4cd9fb85a20db410747cc2773a7f030a..8918bffdd6c27fe523e03c8a5d2d69afa61cf297 100644
658--- a/plugins/arcanist/arcanist.plugin.zsh
659+++ b/plugins/arcanist/arcanist.plugin.zsh
660@@ -9,6 +9,7 @@ alias arco='arc cover'
661 alias arci='arc commit'
662
663 alias ard='arc diff'
664+alias ardc='arc diff --create'
665 alias ardnu='arc diff --nounit'
666 alias ardnupc='arc diff --nounit --plan-changes'
667 alias ardpc='arc diff --plan-changes'
668diff --git a/plugins/autoenv/README.md b/plugins/autoenv/README.md
669new file mode 100644
670index 0000000000000000000000000000000000000000..de3881774f3f3f4d292a5950600d4a2a73132491
671--- /dev/null
672+++ b/plugins/autoenv/README.md
673@@ -0,0 +1,14 @@
674+# Autoenv plugin
675+
676+This plugin loads the [Autoenv](https://github.com/inishchith/autoenv).
677+
678+To use it, add `autoenv` to the plugins array in your zshrc file:
679+
680+```zsh
681+plugins=(... autoenv)
682+```
683+## Requirements
684+
685+In order to make this work, you will need to have the autoenv installed.
686+
687+More info on the usage and install: https://github.com/inishchith/autoenv
688diff --git a/plugins/autojump/autojump.plugin.zsh b/plugins/autojump/autojump.plugin.zsh
689index 13c1d00ed5f0f46d01b5250dfa001ddf6239567b..d80c88822155d0dc8fcc68c1c0ee269f18e664e4 100644
690--- a/plugins/autojump/autojump.plugin.zsh
691+++ b/plugins/autojump/autojump.plugin.zsh
692@@ -1,8 +1,3 @@
693-(( $+commands[autojump] )) || {
694- echo '[oh-my-zsh] Please install autojump first (https://github.com/wting/autojump)'
695- return
696-}
697-
698 declare -a autojump_paths
699 autojump_paths=(
700 $HOME/.autojump/etc/profile.d/autojump.zsh # manual installation
701diff --git a/plugins/aws/aws.plugin.zsh b/plugins/aws/aws.plugin.zsh
702index 231ac5ad26dcfb9f861a48c03349b4cda536155a..567311372ea71fe00ef81933e32a64e338698cff 100644
703--- a/plugins/aws/aws.plugin.zsh
704+++ b/plugins/aws/aws.plugin.zsh
705@@ -10,7 +10,8 @@ function asp() {
706 return
707 fi
708
709- local available_profiles=($(aws_profiles))
710+ local -a available_profiles
711+ available_profiles=($(aws_profiles))
712 if [[ -z "${available_profiles[(r)$1]}" ]]; then
713 echo "${fg[red]}Profile '$1' not found in '${AWS_CONFIG_FILE:-$HOME/.aws/config}'" >&2
714 echo "Available profiles: ${(j:, :)available_profiles:-no profiles found}${reset_color}" >&2
715diff --git a/plugins/battery/battery.plugin.zsh b/plugins/battery/battery.plugin.zsh
716index 8f398cfb34214953a1934c884da0d217cd995126..4c4d0d4fccac89546436d5374fded863305330c5 100644
717--- a/plugins/battery/battery.plugin.zsh
718+++ b/plugins/battery/battery.plugin.zsh
719@@ -7,23 +7,25 @@
720 # Email: neuralsandwich@gmail.com #
721 # Modified to add support for Apple Mac #
722 ###########################################
723+# Author: J (927589452) #
724+# Modified to add support for FreeBSD #
725+###########################################
726
727-if [[ "$OSTYPE" = darwin* ]] ; then
728+if [[ "$OSTYPE" = darwin* ]]; then
729
730- function battery_pct() {
731- local smart_battery_status="$(ioreg -rc "AppleSmartBattery")"
732- typeset -F maxcapacity=$(echo $smart_battery_status | grep '^.*"MaxCapacity"\ =\ ' | sed -e 's/^.*"MaxCapacity"\ =\ //')
733- typeset -F currentcapacity=$(echo $smart_battery_status | grep '^.*"CurrentCapacity"\ =\ ' | sed -e 's/^.*CurrentCapacity"\ =\ //')
734- integer i=$(((currentcapacity/maxcapacity) * 100))
735- echo $i
736+ function battery_is_charging() {
737+ ioreg -rc AppleSmartBattery | command grep -q '^.*"ExternalConnected"\ =\ Yes'
738 }
739
740- function plugged_in() {
741- [ $(ioreg -rc AppleSmartBattery | grep -c '^.*"ExternalConnected"\ =\ Yes') -eq 1 ]
742+ function battery_pct() {
743+ local battery_status="$(ioreg -rc AppleSmartBattery)"
744+ local -i capacity=$(sed -n -e '/MaxCapacity/s/^.*"MaxCapacity"\ =\ //p' <<< $battery_status)
745+ local -i current=$(sed -n -e '/CurrentCapacity/s/^.*"CurrentCapacity"\ =\ //p' <<< $battery_status)
746+ echo $(( current * 100 / capacity ))
747 }
748
749 function battery_pct_remaining() {
750- if plugged_in ; then
751+ if battery_is_charging; then
752 echo "External Power"
753 else
754 battery_pct
755@@ -32,9 +34,9 @@ if [[ "$OSTYPE" = darwin* ]] ; then
756
757 function battery_time_remaining() {
758 local smart_battery_status="$(ioreg -rc "AppleSmartBattery")"
759- if [[ $(echo $smart_battery_status | grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]] ; then
760- timeremaining=$(echo $smart_battery_status | grep '^.*"AvgTimeToEmpty"\ =\ ' | sed -e 's/^.*"AvgTimeToEmpty"\ =\ //')
761- if [ $timeremaining -gt 720 ] ; then
762+ if [[ $(echo $smart_battery_status | command grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]]; then
763+ timeremaining=$(echo $smart_battery_status | command grep '^.*"AvgTimeToEmpty"\ =\ ' | sed -e 's/^.*"AvgTimeToEmpty"\ =\ //')
764+ if [ $timeremaining -gt 720 ]; then
765 echo "::"
766 else
767 echo "~$((timeremaining / 60)):$((timeremaining % 60))"
768@@ -45,39 +47,36 @@ if [[ "$OSTYPE" = darwin* ]] ; then
769 }
770
771 function battery_pct_prompt () {
772- if [[ $(ioreg -rc AppleSmartBattery | grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]] ; then
773- b=$(battery_pct_remaining)
774- if [ $b -gt 50 ] ; then
775+ local battery_pct color
776+ if ioreg -rc AppleSmartBattery | command grep -q '^.*"ExternalConnected"\ =\ No'; then
777+ battery_pct=$(battery_pct_remaining)
778+ if [[ $battery_pct -gt 50 ]]; then
779 color='green'
780- elif [ $b -gt 20 ] ; then
781+ elif [[ $battery_pct -gt 20 ]]; then
782 color='yellow'
783 else
784 color='red'
785 fi
786- echo "%{$fg[$color]%}[$(battery_pct_remaining)%%]%{$reset_color%}"
787+ echo "%{$fg[$color]%}[${battery_pct}%%]%{$reset_color%}"
788 else
789 echo "∞"
790 fi
791 }
792
793- function battery_is_charging() {
794- [[ $(ioreg -rc "AppleSmartBattery"| grep '^.*"IsCharging"\ =\ ' | sed -e 's/^.*"IsCharging"\ =\ //') == "Yes" ]]
795- }
796-
797-elif [[ "$OSTYPE" = linux* ]] ; then
798+elif [[ "$OSTYPE" = freebsd* ]]; then
799
800 function battery_is_charging() {
801- ! [[ $(acpi 2>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]]
802+ [[ $(sysctl -n hw.acpi.battery.state) -eq 2 ]]
803 }
804
805 function battery_pct() {
806- if (( $+commands[acpi] )) ; then
807- echo "$(acpi 2>/dev/null | cut -f2 -d ',' | tr -cd '[:digit:]')"
808+ if (( $+commands[sysctl] )); then
809+ sysctl -n hw.acpi.battery.life
810 fi
811 }
812
813 function battery_pct_remaining() {
814- if [ ! $(battery_is_charging) ] ; then
815+ if ! battery_is_charging; then
816 battery_pct
817 else
818 echo "External Power"
819diff --git a/plugins/bundler/README.md b/plugins/bundler/README.md
820index dc2f170087ec2c69128e81e8816664e317645a47..9f211b02f9093f9e36f1a8edaa8e1d8ecdec1ae6 100644
821--- a/plugins/bundler/README.md
822+++ b/plugins/bundler/README.md
823@@ -2,7 +2,7 @@
824
825 - adds completion for basic bundler commands
826 - adds short aliases for common bundler commands
827- - `be` aliased to `bundle exec`.
828+ - `be` aliased to `bundle exec`.
829 It also supports aliases (if `rs` is `rails server`, `be rs` will bundle-exec `rails server`).
830 - `bl` aliased to `bundle list`
831 - `bp` aliased to `bundle package`
832@@ -15,7 +15,7 @@
833 - calls `bundle exec <gem executable>` otherwise
834
835 Common gems wrapped by default (by name of the executable):
836diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh
837index 668e15d2f98a48f94ea2f098a136f3c7c5379df8..665cb5e435320da86ce9f32caf7c73a48379e695 100644
838--- a/plugins/bundler/bundler.plugin.zsh
839+++ b/plugins/bundler/bundler.plugin.zsh
840@@ -27,6 +27,7 @@ bundled_commands=(
841 rainbows
842 rake
843 rspec
844+ rubocop
845 shotgun
846 sidekiq
847 spec
848@@ -81,7 +82,7 @@ _bundler-installed() {
849 _within-bundled-project() {
850 local check_dir="$PWD"
851 while [ "$check_dir" != "/" ]; do
852- [ -f "$check_dir/Gemfile" ] && return
853+ [ -f "$check_dir/Gemfile" -o -f "$check_dir/gems.rb" ] && return
854 check_dir="$(dirname $check_dir)"
855 done
856 false
857@@ -94,7 +95,7 @@ _binstubbed() {
858 _run-with-bundler() {
859 if _bundler-installed && _within-bundled-project; then
860 if _binstubbed $1; then
861- ./bin/$@
862+ ./bin/${^^@}
863 else
864 bundle exec $@
865 fi
866diff --git a/plugins/bwana/README.md b/plugins/bwana/README.md
867deleted file mode 100644
868index dd4fe9f9c78b9600d5a6472f99bc72aa206ce296..0000000000000000000000000000000000000000
869--- a/plugins/bwana/README.md
870+++ /dev/null
871@@ -1,12 +0,0 @@
872-# Bwana
873-
874-This plugin provides a function to open `man` pages directly with [Bwana](https://www.bruji.com/bwana/).
875-
876-To use it add bwana to the plugins array in your zshrc file.
877-
878-```bash
879-plugins=(... bwana)
880-```
881-
882-The `bwana` function opens the man page of the passed argument in the Bwana app.
883-For example: `bwana ln` opens the man page for `ln` in Bwana.
884diff --git a/plugins/bwana/bwana.plugin.zsh b/plugins/bwana/bwana.plugin.zsh
885deleted file mode 100644
886index 71c9eb18d7111fe40808f18ae7297931c6aaf26f..0000000000000000000000000000000000000000
887--- a/plugins/bwana/bwana.plugin.zsh
888+++ /dev/null
889@@ -1,13 +0,0 @@
890-#
891-# Requires https://www.bruji.com/bwana/
892-#
893-if [[ -e /Applications/Bwana.app ]] ||
894- ( system_profiler -detailLevel mini SPApplicationsDataType | grep -q Bwana )
895-then
896- function bwana() {
897- open "man:$1"
898- }
899-else
900- echo "Bwana lets you read man files in Safari through a man: URI scheme"
901- echo "To use it within Zsh, install it from https://www.bruji.com/bwana/"
902-fi
903diff --git a/plugins/cakephp3/README.md b/plugins/cakephp3/README.md
904new file mode 100644
905index 0000000000000000000000000000000000000000..7e8f6640dd7ebab23eedf9a06956379dfe7df148
906--- /dev/null
907+++ b/plugins/cakephp3/README.md
908@@ -0,0 +1,16 @@
909+# cakephp3 plugin
910+
911+The plugin adds aliases and autocompletion for [cakephp3](https://book.cakephp.org/3.0/en/index.html).
912+
913+To use it, add `cakephp3` to the plugins array of your zshrc file:
914+```
915+plugins=(... cakephp3)
916+```
917+
918+## Aliases
919+
920+| Alias | Command |
921+|-----------|-------------------------------|
922+| c3 | `bin/cake` |
923+| c3cache | `bin/cake orm_cache clear` |
924+| c3migrate | `bin/cake migrations migrate` |
925diff --git a/plugins/cargo/_cargo b/plugins/cargo/_cargo
926index 395c517cd37e5a3e2e82d8b6db627b3a48ba9c85..12694901ed0464572c0a6d553a561ddcc88f1a9b 100644
927--- a/plugins/cargo/_cargo
928+++ b/plugins/cargo/_cargo
929@@ -2,489 +2,367 @@
930
931 autoload -U regexp-replace
932
933-zstyle -T ':completion:*:*:cargo:*' tag-order && \
934- zstyle ':completion:*:*:cargo:*' tag-order 'common-commands'
935-
936 _cargo() {
937-local context state state_descr line
938-typeset -A opt_args
939-
940-# leading items in parentheses are an exclusion list for the arguments following that arg
941-# See: http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Completion-Functions
942-# - => exclude all other options
943-# 1 => exclude positional arg 1
944-# * => exclude all other args
945-# +blah => exclude +blah
946-_arguments \
947- '(- 1 *)'{-h,--help}'[show help message]' \
948- '(- 1 *)--list[list installed commands]' \
949- '(- 1 *)'{-V,--version}'[show version information]' \
950- {-v,--verbose}'[use verbose output]' \
951- --color'[colorization option]' \
952- '(+beta +nightly)+stable[use the stable toolchain]' \
953- '(+stable +nightly)+beta[use the beta toolchain]' \
954- '(+stable +beta)+nightly[use the nightly toolchain]' \
955- '1: :->command' \
956- '*:: :->args'
957-
958-case $state in
959- command)
960- _alternative 'common-commands:common:_cargo_cmds' 'all-commands:all:_cargo_all_cmds'
961- ;;
962-
963- args)
964- case $words[1] in
965- bench)
966- _arguments \
967- '--features=[space separated feature list]' \
968- '--all-features[enable all available features]' \
969- '(-h, --help)'{-h,--help}'[show help message]' \
970- '(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \
971- "${command_scope_spec[@]}" \
972- '--manifest-path=[path to manifest]: :_files -/' \
973- '--no-default-features[do not build the default features]' \
974- '--no-run[compile but do not run]' \
975- '(-p,--package)'{-p=,--package=}'[package to run benchmarks for]:packages:_get_package_names' \
976- '--target=[target triple]' \
977- '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
978- '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
979- '--color=:colorization option:(auto always never)' \
980- ;;
981-
982- build)
983- _arguments \
984- '--features=[space separated feature list]' \
985- '--all-features[enable all available features]' \
986- '(-h, --help)'{-h,--help}'[show help message]' \
987- '(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \
988- "${command_scope_spec[@]}" \
989- '--manifest-path=[path to manifest]: :_files -/' \
990- '--no-default-features[do not build the default features]' \
991- '(-p,--package)'{-p=,--package=}'[package to build]:packages:_get_package_names' \
992- '--release=[build in release mode]' \
993- '--target=[target triple]' \
994- '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
995- '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
996- '--color=:colorization option:(auto always never)' \
997- ;;
998-
999- check)
1000- _arguments \
1001- '--features=[space separated feature list]' \
1002- '--all-features[enable all available features]' \
1003- '(-h, --help)'{-h,--help}'[show help message]' \
1004- '(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \
1005- "${command_scope_spec[@]}" \
1006- '--manifest-path=[path to manifest]: :_files -/' \
1007- '--no-default-features[do not check the default features]' \
1008- '(-p,--package)'{-p=,--package=}'[package to check]:packages:_get_package_names' \
1009- '--release=[check in release mode]' \
1010- '--target=[target triple]' \
1011- '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
1012- '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
1013- '--color=:colorization option:(auto always never)' \
1014- ;;
1015-
1016- clean)
1017- _arguments \
1018- '(-h, --help)'{-h,--help}'[show help message]' \
1019- '--manifest-path=[path to manifest]: :_files -/' \
1020- '(-p,--package)'{-p=,--package=}'[package to clean]:packages:_get_package_names' \
1021- '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
1022- '--release[whether or not to clean release artifacts]' \
1023- '--target=[target triple(default:all)]' \
1024- '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
1025- '--color=:colorization option:(auto always never)' \
1026- ;;
1027-
1028- doc)
1029diff --git a/plugins/catimg/README.md b/plugins/catimg/README.md
1030index 2fc28a1c606fcd21423523afec6efb7bfdbf8690..42b59a62c3db3ac955471aff6203dee3da2d9487 100644
1031--- a/plugins/catimg/README.md
1032+++ b/plugins/catimg/README.md
1033@@ -17,10 +17,10 @@ Plugin for displaying images on the terminal using the the `catimg.sh` script pr
1034 )
1035 ```
1036
1037-2. Reload the source file or restart your Terminal session:
1038+2. Restart the shell or restart your Terminal session:
1039
1040 ```console
1041- $ source ~/.zshrc
1042+ $ exec zsh
1043 $
1044 ```
1045
1046diff --git a/plugins/chruby/README.md b/plugins/chruby/README.md
1047new file mode 100644
1048index 0000000000000000000000000000000000000000..d373006a526c8449f6261d0713cecb90f5f3e2be
1049--- /dev/null
1050+++ b/plugins/chruby/README.md
1051@@ -0,0 +1,20 @@
1052+# chruby plugin
1053+
1054+This plugin loads [chruby](https://github.com/postmodern/chruby), a tool that changes the
1055+current Ruby version, and completion and a prompt function to display the Ruby version.
1056+Supports brew and manual installation of chruby.
1057+
1058+To use it, add `chruby` to the plugins array in your zshrc file:
1059+```zsh
1060+plugins=(... chruby)
1061+```
1062+
1063+## Usage
1064+
1065+If you'd prefer to specify an explicit path to load chruby from
1066+you can set variables like so:
1067+
1068+```
1069+zstyle :omz:plugins:chruby path /local/path/to/chruby.sh
1070+zstyle :omz:plugins:chruby auto /local/path/to/auto.sh
1071+```
1072diff --git a/plugins/cloudapp/README.md b/plugins/cloudapp/README.md
1073new file mode 100644
1074index 0000000000000000000000000000000000000000..6c7f9bc6cea6b2a9ce0d6066caf1fa7364cd95a2
1075--- /dev/null
1076+++ b/plugins/cloudapp/README.md
1077@@ -0,0 +1,24 @@
1078+# CloudApp plugin
1079+
1080+[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.
1081+
1082+To use it, add `cloudapp` to the plugins array of your `~/.zshrc` file:
1083+
1084+```
1085+plugins=(... cloudapp)
1086+```
1087+
1088+## Requirements
1089+
1090+1. [Aaron Russell's `cloudapp_api` gem](https://github.com/aaronrussell/cloudapp_api#installation)
1091+
1092+2. That you set your CloudApp credentials in `~/.cloudapp` as a simple text file like below:
1093+ ```
1094+ email
1095+ password
1096+ ```
1097+
1098+## Usage
1099+
1100+- `cloudapp <filename>`: uploads `<filename>` to your CloudApp account, and if you're using
1101+ macOS, copies the URL to your clipboard.
1102diff --git a/plugins/codeclimate/README.md b/plugins/codeclimate/README.md
1103new file mode 100644
1104index 0000000000000000000000000000000000000000..0d712ac63d2f9be75d00746ba153dcc553c7c343
1105--- /dev/null
1106+++ b/plugins/codeclimate/README.md
1107@@ -0,0 +1,8 @@
1108+# codeclimate plugin
1109+
1110+This plugin adds autocompletion for the [`codeclimate` CLI](https://github.com/codeclimate/codeclimate).
1111+
1112+To use it, add `codeclimate` to the plugins array in your zshrc file:
1113+```zsh
1114+plugins=(... codeclimate)
1115+```
1116diff --git a/plugins/colemak/README.md b/plugins/colemak/README.md
1117new file mode 100644
1118index 0000000000000000000000000000000000000000..4da4bc126cd3a7baf4c7199e14528209884c74d4
1119--- /dev/null
1120+++ b/plugins/colemak/README.md
1121@@ -0,0 +1,48 @@
1122+# Colemak plugin
1123+
1124+This plugin remaps keys in `zsh`'s [`vi`-style navigation mode](http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Keymaps)
1125+for a [Colemak](https://colemak.com/) keyboard layout, to match the QWERTY position:
1126+
1127+
1128+
1129+To use it, add it to the plugins array in your `~/.zshrc` file:
1130+
1131+```
1132+plugins=(... colemak)
1133+```
1134+
1135+You will also need to enable `vi` mode, so add another line to `~/.zshrc`:
1136+```
1137+bindkey -v
1138+```
1139+
1140+Restart your shell and hit the `<ESC>` key to activate `vicmd` (navigation) mode,
1141+and start navigating `zsh` with your new keybindings!
1142+
1143+## Key bindings for vicmd
1144+
1145+| Old | New | Binding | Description |
1146+|------------|------------|---------------------------|----------------------------------------------------|
1147+| `CTRL`+`j` | `CTRL`+`n` | accept-line | Insert new line |
1148+| `j` | `n` | down-line-or-history | Move one line down or command history forwards |
1149+| `k` | `e` | up-line-or-history | Move one line up or command history backwards |
1150+| `l` | `i` | vi-forward-char | Move one character to the right |
1151+| `n` | `k` | vi-repeat-search | Repeat command search forwards |
1152+| `N` | `K` | vi-rev-repeat-search | Repeat command search backwards |
1153+| `i` | `u` | vi-insert | Enter insert mode |
1154+| `I` | `U` | vi-insert-bol | Move to first non-blank char and enter insert mode |
1155+| `<none>` | `l` | vi-undo-change | Undo change |
1156+| `J` | `N` | vi-join | Join the current line with the next one |
1157+| `e` | `j` | vi-forward-word-end | Move to the end of the next word |
1158+| `E` | `J` | vi-forward-blank-word-end | Move to end of the current or next word |
1159+
1160+## Key bindings for less
1161+
1162+| Keyboard shortcut | `less` key binding |
1163+|-------------------|--------------------|
1164+| `n` | forw-line |
1165+| `e` | back-line |
1166+| `k` | repeat-search |
1167+| `ESC`+`k` | repeat-search-all |
1168+| `K` | reverse-search |
1169+| `ESC`+`K` | reverse-search-all |
1170diff --git a/plugins/colored-man-pages/README.md b/plugins/colored-man-pages/README.md
1171new file mode 100644
1172index 0000000000000000000000000000000000000000..d9f6acb2a0fa1dcf8495f40ce0e6c612c3b294ba
1173--- /dev/null
1174+++ b/plugins/colored-man-pages/README.md
1175@@ -0,0 +1,15 @@
1176+# Colored man pages plugin
1177+
1178+This plugin adds colors to man pages.
1179+
1180+To use it, add `colored-man-pages` to the plugins array in your zshrc file:
1181+
1182+```zsh
1183+plugins=(... colored-man-pages)
1184+```
1185+
1186+You can also try to color other pages by prefixing the respective command with `colored`:
1187+
1188+```zsh
1189+colored git help clone
1190+```
1191diff --git a/plugins/colored-man-pages/colored-man-pages.plugin.zsh b/plugins/colored-man-pages/colored-man-pages.plugin.zsh
1192index 1bea536e021c5495e710a164a385b57ee87961c1..f74105d409d14eae55812b9a19497c90b9558d4d 100644
1193--- a/plugins/colored-man-pages/colored-man-pages.plugin.zsh
1194+++ b/plugins/colored-man-pages/colored-man-pages.plugin.zsh
1195@@ -16,8 +16,8 @@ EOF
1196 fi
1197 fi
1198
1199-function man() {
1200- env \
1201+function colored() {
1202+ command env \
1203 LESS_TERMCAP_mb=$(printf "\e[1;31m") \
1204 LESS_TERMCAP_md=$(printf "\e[1;31m") \
1205 LESS_TERMCAP_me=$(printf "\e[0m") \
1206@@ -28,5 +28,9 @@ function man() {
1207 PAGER="${commands[less]:-$PAGER}" \
1208 _NROFF_U=1 \
1209 PATH="$HOME/bin:$PATH" \
1210- man "$@"
1211+ "$@"
1212+}
1213+
1214+function man() {
1215+ colored man "$@"
1216 }
1217diff --git a/plugins/colorize/README.md b/plugins/colorize/README.md
1218index d1f878e6219cb3d4ef26254c93f5d779bcafc163..ee4ab80360b188577d6c9f7dc6594098d4ed9cbe 100644
1219--- a/plugins/colorize/README.md
1220+++ b/plugins/colorize/README.md
1221@@ -6,30 +6,43 @@ Colorize will highlight the content based on the filename extension. If it can't
1222 method for a given extension, it will try to find one by looking at the file contents. If no highlight method
1223 is found it will just cat the file normally, without syntax highlighting.
1224
1225-To use it, add colorize to the plugins array of your zshrc file:
1226+## Setup
1227+
1228+To use it, add colorize to the plugins array of your `~/.zshrc` file:
1229 ```
1230 plugins=(... colorize)
1231 ```
1232
1233-## Styles
1234+## Configuration
1235
1236-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:
1237+### Requirements
1238
1239-`ZSH_COLORIZE_STYLE="colorful"`
1240+This plugin requires that at least one of the following tools is installed:
1241
1242-## Usage
1243+* [Chroma](https://github.com/alecthomas/chroma)
1244+* [Pygments](https://pygments.org/download/)
1245+
1246+### Colorize tool
1247
1248-* `ccat <file> [files]`: colorize the contents of the file (or files, if more than one are provided).
1249- If no arguments are passed it will colorize the standard input or stdin.
1250+Colorize supports `pygmentize` and `chroma` as syntax highlighter. By default colorize uses `pygmentize` unless it's not installed and `chroma` is. This can be overridden by the `ZSH_COLORIZE_TOOL` environment variable:
1251+
1252+```
1253+ZSH_COLORIZE_TOOL=chroma
1254+```
1255
1256-* `cless <file> [files]`: colorize the contents of the file (or files, if more than one are provided) and
1257- open less. If no arguments are passed it will colorize the standard input or stdin.
1258+### Styles
1259
1260-Note that `cless` will behave as less when provided more than one file: you have to navigate files with
1261-the commands `:n` for next and `:p` for previous. The downside is that less options are not supported.
1262-But you can circumvent this by either using the LESS environment variable, or by running `ccat file1 file2|less --opts`.
1263-In the latter form, the file contents will be concatenated and presented by less as a single file.
1264+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:
1265+
1266+```
1267+ZSH_COLORIZE_STYLE="colorful"
1268+```
1269+
1270+## Usage
1271
1272-## Requirements
1273+* `ccat <file> [files]`: colorize the contents of the file (or files, if more than one are provided).
1274+ If no files are passed it will colorize the standard input.
1275
1276-You have to install Pygments first: [pygments.org](http://pygments.org/download/)
1277+* `cless [less-options] <file> [files]`: colorize the contents of the file (or files, if more than one are provided) and open less.
1278+ If no files are passed it will colorize the standard input.
1279+ The LESSOPEN and LESSCLOSE will be overwritten for this to work, but only in a local scope.
1280diff --git a/plugins/colorize/colorize.plugin.zsh b/plugins/colorize/colorize.plugin.zsh
1281index 565ba5a36e4525eb8fb91898f99ecfc2eea791fd..6ed9739fadba3e9cf611b9e1611101f3f4e042f3 100644
1282--- a/plugins/colorize/colorize.plugin.zsh
1283+++ b/plugins/colorize/colorize.plugin.zsh
1284@@ -1,57 +1,113 @@
1285-# easier alias to use the plugin
1286-alias ccat='colorize_via_pygmentize'
1287-alias cless='colorize_via_pygmentize_less'
1288+# Easier alias to use the plugin
1289+alias ccat="colorize_cat"
1290+alias cless="colorize_less"
1291
1292-colorize_via_pygmentize() {
1293- if ! (( $+commands[pygmentize] )); then
1294- echo "package 'Pygments' is not installed!"
1295+# '$0:A' gets the absolute path of this file
1296+ZSH_COLORIZE_PLUGIN_PATH=$0:A
1297+
1298+colorize_check_requirements() {
1299+ local available_tools=("chroma" "pygmentize")
1300+
1301+ if [ -z "$ZSH_COLORIZE_TOOL" ]; then
1302+ if (( $+commands[pygmentize] )); then
1303+ ZSH_COLORIZE_TOOL="pygmentize"
1304+ elif (( $+commands[chroma] )); then
1305+ ZSH_COLORIZE_TOOL="chroma"
1306+ else
1307+ echo "Neither 'pygments' nor 'chroma' is installed!" >&2
1308+ return 1
1309+ fi
1310+ fi
1311+
1312+ if [[ ${available_tools[(Ie)$ZSH_COLORIZE_TOOL]} -eq 0 ]]; then
1313+ echo "ZSH_COLORIZE_TOOL '$ZSH_COLORIZE_TOOL' not recognized. Available options are 'pygmentize' and 'chroma'." >&2
1314+ return 1
1315+ elif (( $+commands["$ZSH_COLORIZE_TOOL"] )); then
1316+ echo "Package '$ZSH_COLORIZE_TOOL' is not installed!" >&2
1317+ return 1
1318+ fi
1319+}
1320+
1321+colorize_cat() {
1322+ if ! colorize_check_requirements; then
1323 return 1
1324 fi
1325
1326- # If the environment varianle ZSH_COLORIZE_STYLE
1327+ # If the environment variable ZSH_COLORIZE_STYLE
1328 # is set, use that theme instead. Otherwise,
1329 # use the default.
1330- if [ -z $ZSH_COLORIZE_STYLE ]; then
1331- ZSH_COLORIZE_STYLE="default"
1332+ if [ -z "$ZSH_COLORIZE_STYLE" ]; then
1333+ # Both pygmentize & chroma support 'emacs'
1334+ ZSH_COLORIZE_STYLE="emacs"
1335 fi
1336
1337- # pygmentize stdin if no arguments passed
1338+ # Use stdin if no arguments have been passed.
1339 if [ $# -eq 0 ]; then
1340- pygmentize -O style="$ZSH_COLORIZE_STYLE" -g
1341+ if [[ "$ZSH_COLORIZE_TOOL" == "pygmentize" ]]; then
1342+ pygmentize -O style="$ZSH_COLORIZE_STYLE" -g
1343+ else
1344+ chroma --style="$ZSH_COLORIZE_STYLE"
1345+ fi
1346 return $?
1347 fi
1348
1349- # guess lexer from file extension, or
1350- # guess it from file contents if unsuccessful
1351-
1352+ # Guess lexer from file extension, or guess it from file contents if unsuccessful.
1353 local FNAME lexer
1354- for FNAME in "$@"
1355- do
1356- lexer=$(pygmentize -N "$FNAME")
1357- if [[ $lexer != text ]]; then
1358- pygmentize -O style="$ZSH_COLORIZE_STYLE" -l "$lexer" "$FNAME"
1359+ for FNAME in "$@"; do
1360+ if [[ "$ZSH_COLORIZE_TOOL" == "pygmentize" ]]; then
1361+ lexer=$(pygmentize -N "$FNAME")
1362+ if [[ $lexer != text ]]; then
1363+ pygmentize -O style="$ZSH_COLORIZE_STYLE" -l "$lexer" "$FNAME"
1364+ else
1365+ pygmentize -O style="$ZSH_COLORIZE_STYLE" -g "$FNAME"
1366+ fi
1367 else
1368- pygmentize -O style="$ZSH_COLORIZE_STYLE" -g "$FNAME"
1369+ chroma --style="$ZSH_COLORIZE_STYLE" "$FNAME"
1370 fi
1371 done
1372 }
1373
1374-colorize_via_pygmentize_less() (
1375- # this function is a subshell so tmp_files can be shared to cleanup function
1376- declare -a tmp_files
1377+# The less option 'F - Forward forever; like "tail -f".' will not work in this implementation
1378+# caused by the lack of the ability to follow the file within pygmentize.
1379+colorize_less() {
1380+ if ! colorize_check_requirements; then
1381+ return 1
1382+ fi
1383
1384diff --git a/plugins/common-aliases/README.md b/plugins/common-aliases/README.md
1385new file mode 100644
1386index 0000000000000000000000000000000000000000..d198a29ac97e980af91fbf0950ffcd3a7e2bc75b
1387--- /dev/null
1388+++ b/plugins/common-aliases/README.md
1389@@ -0,0 +1,121 @@
1390+# Common Aliases Plugin
1391+
1392+This plugin creates helpful shortcut aliases for many commonly used commands.
1393+
1394+To use it add `common-aliases` to the plugins array in your zshrc file:
1395+
1396+```zsh
1397+plugins=(... common-aliases)
1398+```
1399+
1400+## Aliases
1401+
1402+### ls command
1403+
1404+| Alias | Command | Description |
1405+|-------|---------------|--------------------------------------------------------------------------------|
1406+| l | `ls -lFh` | List files as a long list, show size, type, human-readable |
1407+| la | `ls -lAFh` | List almost all files as a long list show size, type, human-readable |
1408+| lr | `ls -tRFh` | List files recursively sorted by date, show type, human-readable |
1409+| lt | `ls -ltFh` | List files as a long list sorted by date, show type, human-readable |
1410+| ll | `ls -l` | List files as a long list |
1411+| ldot | `ls -ld .*` | List dot files as a long list |
1412+| lS | `ls -1FSsh` | List files showing only size and name sorted by size |
1413+| lart | `ls -1Fcart` | List all files sorted in reverse of create/modification time (oldest first) |
1414+| lrt | `ls -1Fcrt` | List files sorted in reverse of create/modification time(oldest first) |
1415+
1416+### File handling
1417+
1418+| Alias | Command | Description |
1419+|-------|-----------------------|------------------------------------------------------------------------------------|
1420+| rm | `rm -i` | Remove a file |
1421+| cp | `cp -i` | Copy a file |
1422+| mv | `mv -i` | Move a file |
1423+| zshrc | `${=EDITOR} ~/.zshrc` | Quickly access the ~/.zshrc file |
1424+| dud | `du -d 1 -h` | Display the size of files at depth 1 in current location in human-readable form |
1425+| duf | `du -sh` | Display the size of files in current location in human-readable form |
1426+| t | `tail -f` | Shorthand for tail which outputs the last part of a file |
1427+
1428+### find and grep
1429+
1430+| Alias | Command | Description |
1431+|-------|-----------------------------------------------------|-----------------------------------------|
1432+| fd | `find . -type d -name` | Find a directory with the given name |
1433+| ff | `find . -type f -name` | Find a file with the given name |
1434+| grep | `grep --color` | Searches for a query string |
1435+| sgrep | `grep -R -n -H -C 5 --exclude-dir={.git,.svn,CVS}` | Useful for searching within files |
1436+
1437+### Other Aliases
1438+
1439+| Alias | Command | Description |
1440+|-----------|---------------------|-------------------------------------------------------------|
1441+| h | `history` | Lists all recently used commands |
1442+| hgrep | `fc -El 0 \| grep` | Searches for a word in the list of previously used commands |
1443+| help | `man` | Opens up the man page for a command |
1444+| p | `ps -f` | Displays currently executing processes |
1445+| sortnr | `sort -n -r` | Used to sort the lines of a text file |
1446+| unexport | `unset` | Used to unset an environment variable |
1447+
1448+## Global aliases
1449+
1450+These aliases are expanded in any position in the command line, meaning you can use them even at the
1451+end of the command you've typed. Examples:
1452+
1453+Quickly pipe to less:
1454+```zsh
1455+$ ls -l /var/log L
1456+# will run
1457+$ ls -l /var/log | less
1458+```
1459+Silences stderr output:
1460+```zsh
1461+$ find . -type f NE
1462+# will run
1463+$ find . -type f 2>/dev/null
1464+```
1465+
1466+| Alias | Command | Description |
1467+|-------|-----------------------------|-------------------------------------------------------------|
1468+| H | `\| head` | Pipes output to head which outputs the first part of a file |
1469+| T | `\| tail` | Pipes output to tail which outputs the last part of a file |
1470+| G | `\| grep` | Pipes output to grep to search for some word |
1471+| L | `\| less` | Pipes output to less, useful for paging |
1472+| M | `\| most` | Pipes output to more, useful for paging |
1473+| LL | `2>&1 \| less` | Writes stderr to stdout and passes it to less |
1474+| CA | `2>&1 \| cat -A` | Writes stderr to stdout and passes it to cat |
1475+| NE | `2 > /dev/null` | Silences stderr |
1476+| NUL | `> /dev/null 2>&1` | Silences both stdout and stderr |
1477+| P | `2>&1\| pygmentize -l pytb` | Writes stderr to stdout and passes it to pygmentize |
1478+
1479+## File extension aliases
1480+
1481+These are special aliases that are triggered when a file name is passed as the command. For example,
1482+if the pdf file extension is aliased to `acroread` (a popular Linux pdf reader), when running `file.pdf`
1483+that file will be open with `acroread`.
1484+
1485+### Reading Docs
1486+
1487+| Alias | Command | Description |
1488+|-------|-------------|-------------------------------------|
1489diff --git a/plugins/common-aliases/common-aliases.plugin.zsh b/plugins/common-aliases/common-aliases.plugin.zsh
1490index 785a09c63dc0456462f600c90e06b1d57bf70fd0..ce1995c03f24c261f637831bad4c77e7dac3ace4 100644
1491--- a/plugins/common-aliases/common-aliases.plugin.zsh
1492+++ b/plugins/common-aliases/common-aliases.plugin.zsh
1493@@ -50,6 +50,7 @@ alias mv='mv -i'
1494
1495 # zsh is able to auto-do some kungfoo
1496 # depends on the SUFFIX :)
1497+autoload -Uz is-at-least
1498 if is-at-least 4.2.0; then
1499 # open browser on urls
1500 if [[ -n "$BROWSER" ]]; then
1501diff --git a/plugins/compleat/README.md b/plugins/compleat/README.md
1502new file mode 100644
1503index 0000000000000000000000000000000000000000..630c91503428066bdae9752848f6460322dceedd
1504--- /dev/null
1505+++ b/plugins/compleat/README.md
1506@@ -0,0 +1,8 @@
1507+# compleat plugin
1508+
1509+This plugin looks for [compleat](https://github.com/mbrubeck/compleat) and loads its completion.
1510+
1511+To use it, add compleat to the plugins array in your zshrc file:
1512+```
1513+plugins=(... compleat)
1514+```
1515diff --git a/plugins/copybuffer/copybuffer.plugin.zsh b/plugins/copybuffer/copybuffer.plugin.zsh
1516index cc205d40f844c7be1df62132094b91d46ac05ba7..483ed5a5fe59e070dd88e378f2813583caadc536 100644
1517--- a/plugins/copybuffer/copybuffer.plugin.zsh
1518+++ b/plugins/copybuffer/copybuffer.plugin.zsh
1519@@ -1,9 +1,9 @@
1520 # copy the active line from the command line buffer
1521-# onto the system clipboard (requires clipcopy plugin)
1522+# onto the system clipboard
1523
1524 copybuffer () {
1525 if which clipcopy &>/dev/null; then
1526- echo $BUFFER | clipcopy
1527+ printf "%s" "$BUFFER" | clipcopy
1528 else
1529 echo "clipcopy function not found. Please make sure you have Oh My Zsh installed correctly."
1530 fi
1531diff --git a/plugins/dash/README.md b/plugins/dash/README.md
1532new file mode 100644
1533index 0000000000000000000000000000000000000000..0ca3e4e44d7a51fd7a1b174cbb265ee111b85018
1534--- /dev/null
1535+++ b/plugins/dash/README.md
1536@@ -0,0 +1,28 @@
1537+# Dash plugin
1538+
1539+This plugin adds command line functionality for [Dash](https://kapeli.com/dash),
1540+an API Documentation Browser for macOS. This plugin requires Dash to be installed
1541+to work.
1542+
1543+To use it, add `dash` to the plugins array in your zshrc file:
1544+
1545+```zsh
1546+plugins=(... dash)
1547+```
1548+
1549+## Usage
1550+
1551+- Open and switch to the dash application.
1552+```
1553+dash
1554+```
1555+
1556+- Query for something in dash app: `dash query`
1557+```
1558+dash golang
1559+```
1560+
1561+- You can optionally provide a keyword: `dash [keyword:]query`
1562+```
1563+dash python:tuple
1564+```
1565diff --git a/plugins/dash/dash.plugin.zsh b/plugins/dash/dash.plugin.zsh
1566index b00d4877ec446218eb70cdd72203e0aac1ef9378..ace2e33c1d6f723409c98c87882c2a0d913895b5 100644
1567--- a/plugins/dash/dash.plugin.zsh
1568+++ b/plugins/dash/dash.plugin.zsh
1569@@ -35,36 +35,30 @@ _dash() {
1570 if [[ "$locator" == "platform" ]]; then
1571 # Since these are the only special cases right now, let's not do the
1572 # expensive processing unless we have to
1573- if [[ "$keyword" == "python" || "$keyword" == "java" || \
1574- "$keyword" == "qt" || "$keyword" == "cocs2d" ]]; then
1575+ if [[ "$keyword" = (python|java|qt|cocos2d) ]]; then
1576 docsetName=`echo $doc | grep -Eo "docsetName = .*?;" | sed -e "s/docsetName = \(.*\);/\1/" -e "s/[\":]//g"`
1577- if [[ "$keyword" == "python" ]]; then
1578- if [[ "$docsetName" == "Python 2" ]]; then
1579- keyword="python2"
1580- elif [[ "$docsetName" == "Python 3" ]]; then
1581- keyword="python3"
1582- fi
1583- elif [[ "$keyword" == "java" ]]; then
1584- if [[ "$docsetName" == "Java SE7" ]]; then
1585- keyword="java7"
1586- elif [[ "$docsetName" == "Java SE6" ]]; then
1587- keyword="java6"
1588- elif [[ "$docsetName" == "Java SE8" ]]; then
1589- keyword="java8"
1590- fi
1591- elif [[ "$keyword" == "qt" ]]; then
1592- if [[ "$docsetName" == "Qt 5" ]]; then
1593- keyword="qt5"
1594- elif [[ "$docsetName" == "Qt 4" ]]; then
1595- keyword="qt4"
1596- elif [[ "$docsetName" == "Qt" ]]; then
1597- keyword="qt4"
1598- fi
1599- elif [[ "$keyword" == "cocos2d" ]]; then
1600- if [[ "$docsetName" == "Cocos3D" ]]; then
1601- keyword="cocos3d"
1602- fi
1603- fi
1604+ case "$keyword" in
1605+ python)
1606+ case "$docsetName" in
1607+ "Python 2") keyword="python2" ;;
1608+ "Python 3") keyword="python3" ;;
1609+ esac ;;
1610+ java)
1611+ case "$docsetName" in
1612+ "Java SE7") keyword="java7" ;;
1613+ "Java SE6") keyword="java6" ;;
1614+ "Java SE8") keyword="java8" ;;
1615+ esac ;;
1616+ qt)
1617+ case "$docsetName" in
1618+ "Qt 5") keyword="qt5" ;;
1619+ "Qt 4"|Qt) keyword="qt4" ;;
1620+ esac ;;
1621+ cocos2d)
1622+ case "$docsetName" in
1623+ Cocos3D) keyword="cocos3d" ;;
1624+ esac ;;
1625+ esac
1626 fi
1627 fi
1628
1629diff --git a/plugins/debian/debian.plugin.zsh b/plugins/debian/debian.plugin.zsh
1630index be4062ebff5568a3327f9c752026cf99174a0622..68c6df1aec688a5e60a22e729ff93fc03655bc6e 100644
1631--- a/plugins/debian/debian.plugin.zsh
1632+++ b/plugins/debian/debian.plugin.zsh
1633@@ -72,7 +72,7 @@ if [[ $use_sudo -eq 1 ]]; then
1634 # commands using su #########
1635 else
1636 alias aac="su -ls '$apt_pref autoclean' root"
1637- abd() {
1638+ function abd() {
1639 cmd="su -lc '$apt_pref build-dep $@' root"
1640 print "$cmd"
1641 eval "$cmd"
1642@@ -83,17 +83,17 @@ else
1643 alias adu="su -lc '$apt_pref update && aptitude dist-upgrade' root"
1644 alias afu="su -lc '$apt-file update'"
1645 alias au="su -lc '$apt_pref $apt_upgr' root"
1646- ai() {
1647+ function ai() {
1648 cmd="su -lc 'aptitude -P install $@' root"
1649 print "$cmd"
1650 eval "$cmd"
1651 }
1652- ap() {
1653+ function ap() {
1654 cmd="su -lc '$apt_pref -P purge $@' root"
1655 print "$cmd"
1656 eval "$cmd"
1657 }
1658- ar() {
1659+ function ar() {
1660 cmd="su -lc '$apt_pref -P remove $@' root"
1661 print "$cmd"
1662 eval "$cmd"
1663@@ -114,7 +114,7 @@ fi
1664 # Registers a compdef for $1 that calls $apt_pref with the commands $2
1665 # To do that it creates a new completion function called _apt_pref_$2
1666 #
1667-apt_pref_compdef() {
1668+function apt_pref_compdef() {
1669 local f fb
1670 f="_apt_pref_${2}"
1671
1672@@ -151,7 +151,7 @@ alias mydeb='time dpkg-buildpackage -rfakeroot -us -uc'
1673
1674 # Functions #################################################################
1675 # create a simple script that can be used to 'duplicate' a system
1676-apt-copy() {
1677+function apt-copy() {
1678 print '#!/bin/sh'"\n" > apt-copy.sh
1679
1680 cmd='$apt_pref install'
1681@@ -173,7 +173,7 @@ apt-copy() {
1682 # apt-history rollback
1683 # apt-history list
1684 # Based On: https://linuxcommando.blogspot.com/2008/08/how-to-show-apt-log-history.html
1685-apt-history () {
1686+function apt-history() {
1687 case "$1" in
1688 install)
1689 zgrep --no-filename 'install ' $(ls -rt /var/log/dpkg*)
1690@@ -202,7 +202,7 @@ apt-history () {
1691 }
1692
1693 # Kernel-package building shortcut
1694-kerndeb () {
1695+function kerndeb() {
1696 # temporarily unset MAKEFLAGS ( '-j3' will fail )
1697 MAKEFLAGS=$( print - $MAKEFLAGS | perl -pe 's/-j\s*[\d]+//g' )
1698 print '$MAKEFLAGS set to '"'$MAKEFLAGS'"
1699@@ -216,10 +216,9 @@ kerndeb () {
1700 }
1701
1702 # List packages by size
1703-function apt-list-packages {
1704+function apt-list-packages() {
1705 dpkg-query -W --showformat='${Installed-Size} ${Package} ${Status}\n' | \
1706 grep -v deinstall | \
1707 sort -n | \
1708 awk '{print $1" "$2}'
1709 }
1710-
1711diff --git a/plugins/dircycle/README.md b/plugins/dircycle/README.md
1712index 3ac162f05e88febbc6627a7ce6e8373eb7100fa9..3c9b3a96f6533e821f688ade77c9715168103380 100644
1713--- a/plugins/dircycle/README.md
1714+++ b/plugins/dircycle/README.md
1715@@ -15,10 +15,10 @@ This plugin enables directory navigation similar to using back and forward on br
1716 )
1717 ```
1718
1719-2. Reload the source file or restart your Terminal session:
1720+2. Restart the shell or restart your Terminal session:
1721
1722 ```console
1723- $ source ~/.zshrc
1724+ $ exec zsh
1725 $
1726 ```
1727
1728diff --git a/plugins/dirhistory/dirhistory.plugin.zsh b/plugins/dirhistory/dirhistory.plugin.zsh
1729index 239915e4821fec0264ef8bffb256f1c87c77ae0b..35c43d76ad7f06f273dbad3e4490c12b19a294af 100644
1730--- a/plugins/dirhistory/dirhistory.plugin.zsh
1731+++ b/plugins/dirhistory/dirhistory.plugin.zsh
1732@@ -53,7 +53,8 @@ function push_future() {
1733 }
1734
1735 # Called by zsh when directory changes
1736-chpwd_functions+=(chpwd_dirhistory)
1737+autoload -U add-zsh-hook
1738+add-zsh-hook chpwd chpwd_dirhistory
1739 function chpwd_dirhistory() {
1740 push_past $PWD
1741 # If DIRHISTORY_CD is not set...
1742diff --git a/plugins/dirpersist/dirpersist.plugin.zsh b/plugins/dirpersist/dirpersist.plugin.zsh
1743index 616e2c3c658710d47073cfdd88aa43aea3782675..daadc3850b35b8e0731e8d69dba4232de587ac90 100644
1744--- a/plugins/dirpersist/dirpersist.plugin.zsh
1745+++ b/plugins/dirpersist/dirpersist.plugin.zsh
1746@@ -11,7 +11,8 @@ if [[ -f ${dirstack_file} ]] && [[ ${#dirstack[*]} -eq 0 ]] ; then
1747 [[ -d $dirstack[1] ]] && cd $dirstack[1] && cd $OLDPWD
1748 fi
1749
1750-chpwd_functions+=(chpwd_dirpersist)
1751+autoload -U add-zsh-hook
1752+add-zsh-hook chpwd chpwd_dirpersist
1753 chpwd_dirpersist() {
1754 if (( $DIRSTACKSIZE <= 0 )) || [[ -z $dirstack_file ]]; then return; fi
1755 local -ax my_stack