cad48e38bfbfa6e3e0096caddf330d6fc8f1ffb9
- 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/.editorconfig b/.editorconfig
2new file mode 100644
3index 0000000000000000000000000000000000000000..aa18e0e5cde98f57ffe1ea57610902d37993ae2d
4--- /dev/null
5+++ b/.editorconfig
6@@ -0,0 +1,10 @@
7+root = true
8+
9+[*]
10+end_of_line = lf
11+insert_final_newline = true
12+charset = utf-8
13+
14+[*.sh]
15+indent_size = 4
16+indent_style = tab
17diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
18new file mode 100644
19index 0000000000000000000000000000000000000000..076c35544409154ae2ed945d92bf7f009e43c774
20--- /dev/null
21+++ b/.github/ISSUE_TEMPLATE/bug_report.md
22@@ -0,0 +1,38 @@
23+---
24+name: Bug report
25+about: Create a report to help us improve
26+
27+---
28+
29+<!--
30+Fill this out before posting. You can delete irrelevant sections, but
31+an issue where no sections have been filled will be deleted without comment.
32+-->
33+
34+**Describe the bug**
35+<!-- A clear and concise description of what the bug is. -->
36+
37+**To Reproduce**
38+<!--
39+Steps to reproduce the behavior:
40+1. Enable plugin '...'
41+2. Run command '...', _or_ try to complete command '...', _etc._
42+3. See error
43+-->
44+
45+**Expected behavior**
46+<!-- A clear and concise description of what you expected to happen. -->
47+
48+**Screenshots or recordings**
49+<!--
50+If applicable, add screenshots or record an asciinema session (https://asciinema.org/)
51+to help explain your problem.
52+-->
53+
54+**System:**
55+ - OS: [e.g. macOS]
56+ - Zsh version [e.g. 5.6]
57+ - Terminal emulator [e.g. iTerm2]
58+
59+**Additional context**
60+<!-- Add any other context about the problem here. -->
61diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md
62new file mode 100644
63index 0000000000000000000000000000000000000000..d9c324a55a92870e431c8ccc41c6978fd3448c5b
64--- /dev/null
65+++ b/.github/ISSUE_TEMPLATE/feature_request.md
66@@ -0,0 +1,26 @@
67+---
68+name: Feature request
69+about: Suggest a feature for Oh My Zsh
70+labels: 'Type: feature'
71+
72+---
73+
74+<!--
75+Fill this out before posting. You can delete irrelevant sections, but
76+an issue where no sections have been filled will be deleted without comment.
77+-->
78+
79+**Is your feature request related to a particular plugin or theme? If so, specify it.**
80+<!-- The name of the plugin or theme you'd like us to improve. -->
81+
82+**Is your feature request related to a problem? Please describe.**
83+<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
84+
85+**Describe the solution you'd like**
86+<!-- A clear and concise description of what you want to happen. -->
87+
88+**Describe alternatives you've considered**
89+<!-- A clear and concise description of any alternative solutions or features you've considered. -->
90+
91+**Additional context**
92+<!-- Add any other context or screenshots about the feature request here. -->
93diff --git a/.github/ISSUE_TEMPLATE/support.md b/.github/ISSUE_TEMPLATE/support.md
94new file mode 100644
95index 0000000000000000000000000000000000000000..3c69a7d5ec2641bd9e2c98c88384382b12bdd9d4
96--- /dev/null
97+++ b/.github/ISSUE_TEMPLATE/support.md
98@@ -0,0 +1,12 @@
99+---
100+name: Support
101+about: Request support for any problem you're having with Oh My Zsh
102+labels: 'Type: support'
103+
104+---
105+
106+<!--
107+1. Look for similar issues already posted (including closed ones)
108+2. Include as much relevant information as possible
109+3. Try to make sure the issue is due to Oh My Zsh
110+-->
111diff --git a/.gitignore b/.gitignore
112index b2022081ae8fcdeb51e08b113e98853fc5d5d3ae..87a79cdae3464823e307182badbf1d1ffc4b5aad 100644
113--- a/.gitignore
114+++ b/.gitignore
115@@ -1,7 +1,5 @@
116 # custom files
117 custom/
118-!custom/plugins/example
119-!custom/example.zsh
120
121 # temp files directories
122 cache/
123diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
124new file mode 100644
125index 0000000000000000000000000000000000000000..20ad1cceecd280fe6a2bbeca64c3b448d1dce776
126--- /dev/null
127+++ b/CODE_OF_CONDUCT.md
128@@ -0,0 +1,76 @@
129+# Contributor Covenant Code of Conduct
130+
131+## Our Pledge
132+
133+In the interest of fostering an open and welcoming environment, we as
134+contributors and maintainers pledge to making participation in our project and
135+our community a harassment-free experience for everyone, regardless of age, body
136+size, disability, ethnicity, sex characteristics, gender identity and expression,
137+level of experience, education, socio-economic status, nationality, personal
138+appearance, race, religion, or sexual identity and orientation.
139+
140+## Our Standards
141+
142+Examples of behavior that contributes to creating a positive environment
143+include:
144+
145+* Using welcoming and inclusive language
146+* Being respectful of differing viewpoints and experiences
147+* Gracefully accepting constructive criticism
148+* Focusing on what is best for the community
149+* Showing empathy towards other community members
150+
151+Examples of unacceptable behavior by participants include:
152+
153+* The use of sexualized language or imagery and unwelcome sexual attention or
154+ advances
155+* Trolling, insulting/derogatory comments, and personal or political attacks
156+* Public or private harassment
157+* Publishing others' private information, such as a physical or electronic
158+ address, without explicit permission
159+* Other conduct which could reasonably be considered inappropriate in a
160+ professional setting
161+
162+## Our Responsibilities
163+
164+Project maintainers are responsible for clarifying the standards of acceptable
165+behavior and are expected to take appropriate and fair corrective action in
166+response to any instances of unacceptable behavior.
167+
168+Project maintainers have the right and responsibility to remove, edit, or
169+reject comments, commits, code, wiki edits, issues, and other contributions
170+that are not aligned to this Code of Conduct, or to ban temporarily or
171+permanently any contributor for other behaviors that they deem inappropriate,
172+threatening, offensive, or harmful.
173+
174+## Scope
175+
176+This Code of Conduct applies within all project spaces, and it also applies when
177+an individual is representing the project or its community in public spaces.
178+Examples of representing a project or community include using an official
179+project e-mail address, posting via an official social media account, or acting
180+as an appointed representative at an online or offline event. Representation of
181+a project may be further defined and clarified by project maintainers.
182+
183+## Enforcement
184+
185+Instances of abusive, harassing, or otherwise unacceptable behavior may be
186+reported by contacting the project team at ohmyzsh@planetargon.com. All
187+complaints will be reviewed and investigated and will result in a response that
188+is deemed necessary and appropriate to the circumstances. The project team is
189+obligated to maintain confidentiality with regard to the reporter of an incident.
190+Further details of specific enforcement policies may be posted separately.
191+
192+Project maintainers who do not follow or enforce the Code of Conduct in good
193+faith may face temporary or permanent repercussions as determined by other
194+members of the project's leadership.
195+
196+## Attribution
197+
198+This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
199+available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
200+
201+[homepage]: https://www.contributor-covenant.org
202+
203+For answers to common questions about this code of conduct, see
204+https://www.contributor-covenant.org/faq
205diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
206new file mode 100644
207index 0000000000000000000000000000000000000000..f575157c21876fc09fb9bfa48297ad6a4ad1f158
208--- /dev/null
209+++ b/CONTRIBUTING.md
210@@ -0,0 +1,125 @@
211+# CONTRIBUTING GUIDELINES
212+
213+Oh-My-Zsh is a community-driven project. Contribution is welcome, encouraged, and appreciated.
214+It is also essential for the development of the project.
215+
216+First, please take a moment to review our [code of conduct](CODE_OF_CONDUCT.md).
217+
218+These guidelines are an attempt at better addressing the huge amount of pending
219+issues and pull requests. Please read them closely.
220+
221+Foremost, be so kind as to [search](#use-the-search-luke). This ensures any contribution
222+you would make is not already covered.
223+
224+* [Issues](#reporting-issues)
225+ * [You have a problem](#you-have-a-problem)
226+ * [You have a suggestion](#you-have-a-suggestion)
227+* [Pull Requests](#submitting-pull-requests)
228+ * [Getting started](#getting-started)
229+ * [You have a solution](#you-have-a-solution)
230+ * [You have an addition](#you-have-an-addition)
231+* [Information sources (_aka_ search)](#use-the-search-luke)
232+
233+**BONUS:** [Volunteering](#you-have-spare-time-to-volunteer)
234+
235+## Reporting Issues
236+
237+### You have a problem
238+
239+Please be so kind as to [search](#use-the-search-luke) for any open issue already covering
240+your problem.
241+
242+If you find one, comment on it so we can know there are more people experiencing it.
243+
244+If not, look at the [Troubleshooting](https://github.com/robbyrussell/oh-my-zsh/wiki/Troubleshooting)
245+page for instructions on how to gather data to better debug your problem.
246+
247+Then, you can go ahead and create an issue with as much detail as you can provide.
248+It should include the data gathered as indicated above, along with:
249+
250+1. How to reproduce the problem
251+2. What the correct behavior should be
252+3. What the actual behavior is
253+
254+Please copy to anyone relevant (_eg_ plugin maintainers) by mentioning their GitHub handle
255+(starting with `@`) in your message.
256+
257+We will do our very best to help you.
258+
259+### You have a suggestion
260+
261+Please be so kind as to [search](#use-the-search-luke) for any open issue already covering
262+your suggestion.
263+
264+If you find one, comment on it so we can know there are more people supporting it.
265+
266+If not, you can go ahead and create an issue. Please copy to anyone relevant (_eg_ plugin
267+maintainers) by mentioning their GitHub handle (starting with `@`) in your message.
268+
269+## Submitting Pull Requests
270+
271+### Getting started
272+
273+You should be familiar with the basics of
274+[contributing on GitHub](https://help.github.com/articles/using-pull-requests) and have a fork
275+[properly set up](https://github.com/robbyrussell/oh-my-zsh/wiki/Contribution-Technical-Practices).
276+
277+You MUST always create PRs with _a dedicated branch_ based on the latest upstream tree.
278+
279+If you create your own PR, please make sure you do it right. Also be so kind as to reference
280+any issue that would be solved in the PR description body,
281+[for instance](https://help.github.com/articles/closing-issues-via-commit-messages/)
282+_"Fixes #XXXX"_ for issue number XXXX.
283+
284+### You have a solution
285+
286+Please be so kind as to [search](#use-the-search-luke) for any open issue already covering
287+your [problem](#you-have-a-problem), and any pending/merged/rejected PR covering your solution.
288+
289+If the solution is already reported, try it out and +1 the pull request if the
290+solution works ok. On the other hand, if you think your solution is better, post
291+it with a reference to the other one so we can have both solutions to compare.
292+
293+If not, then go ahead and submit a PR. Please copy to anyone relevant (e.g. plugin
294+maintainers) by mentioning their GitHub handle (starting with `@`) in your message.
295+
296+### You have an addition
297+
298+Please [do not](https://github.com/robbyrussell/oh-my-zsh/wiki/Themes#dont-send-us-your-theme-for-now)
299+send themes for now.
300+
301+Please be so kind as to [search](#use-the-search-luke) for any pending, merged or rejected Pull Requests
302+covering or related to what you want to add.
303+
304+If you find one, try it out and work with the author on a common solution.
305+
306+If not, then go ahead and submit a PR. Please copy to anyone relevant (_eg_ plugin
307+maintainers) by mentioning their GitHub handle (starting with `@`) in your message.
308+
309+For any extensive change, _eg_ a new plugin, you will have to find testers to +1 your PR.
310diff --git a/LICENSE.txt b/LICENSE.txt
311index 42f607f5d0015d99a4554b62ba67647e62b511f3..4d465b1c31fc0c7d9cca130ad273c160c5955ef5 100644
312--- a/LICENSE.txt
313+++ b/LICENSE.txt
314@@ -1,6 +1,6 @@
315 The MIT License (MIT)
316
317-Copyright (c) 2009-2016 Robby Russell and contributors
318+Copyright (c) 2009-2019 Robby Russell and contributors
319 See the full list at https://github.com/robbyrussell/oh-my-zsh/contributors
320
321 Permission is hereby granted, free of charge, to any person obtaining a copy
322diff --git a/README.md b/README.md
323index aab1af9fd47a92404f45f432c8adafc1042029e4..2f23febf5bfdbd210a6f4adbfcdca648be797d29 100644
324--- a/README.md
325+++ b/README.md
326@@ -2,20 +2,24 @@
327 <img src="https://s3.amazonaws.com/ohmyzsh/oh-my-zsh-logo.png" alt="Oh My Zsh">
328 </p>
329
330-Oh My Zsh is an open source, community-driven framework for managing your [zsh](http://www.zsh.org/) configuration. That sounds boring. Let's try this again.
331+Oh My Zsh is an open source, community-driven framework for managing your [zsh](https://www.zsh.org/) configuration.
332
333diff --git a/custom/themes/example.zsh-theme b/custom/themes/example.zsh-theme
334new file mode 100644
335index 0000000000000000000000000000000000000000..ef8f1c630b7c39783a3f65ff17678cfba81c932d
336--- /dev/null
337+++ b/custom/themes/example.zsh-theme
338@@ -0,0 +1,4 @@
339+# Put your custom themes in this folder.
340+# Example:
341+
342+PROMPT="%{$fg[red]%}%n%{$reset_color%}@%{$fg[blue]%}%m %{$fg[yellow]%}%~ %{$reset_color%}%% "
343diff --git a/lib/clipboard.zsh b/lib/clipboard.zsh
344index b663800a4d09bb9918d5f33d3188c81d58ea8882..2c93d1bb5c3a2af2cca739b96e46c6dbb38d6dd3 100644
345--- a/lib/clipboard.zsh
346+++ b/lib/clipboard.zsh
347@@ -31,13 +31,13 @@ function clipcopy() {
348 cat $file > /dev/clipboard
349 fi
350 else
351- if which xclip &>/dev/null; then
352+ if (( $+commands[xclip] )); then
353 if [[ -z $file ]]; then
354 xclip -in -selection clipboard
355 else
356 xclip -in -selection clipboard $file
357 fi
358- elif which xsel &>/dev/null; then
359+ elif (( $+commands[xsel] )); then
360 if [[ -z $file ]]; then
361 xsel --clipboard --input
362 else
363@@ -74,9 +74,9 @@ function clippaste() {
364 elif [[ $OSTYPE == cygwin* ]]; then
365 cat /dev/clipboard
366 else
367- if which xclip &>/dev/null; then
368+ if (( $+commands[xclip] )); then
369 xclip -out -selection clipboard
370- elif which xsel &>/dev/null; then
371+ elif (( $+commands[xsel] )); then
372 xsel --clipboard --output
373 else
374 print "clipcopy: Platform $OSTYPE not supported or xclip/xsel not installed" >&2
375diff --git a/lib/compfix.zsh b/lib/compfix.zsh
376index 208aaadb1ebad0e25ebdef29192da815be8136bd..b09b283f2785967468ece63506b4d6d34df60283 100644
377--- a/lib/compfix.zsh
378+++ b/lib/compfix.zsh
379@@ -2,10 +2,6 @@
380 # insecure ownership or permissions) by:
381 #
382 # * Human-readably notifying the user of these insecurities.
383-# * Moving away all existing completion caches to a temporary directory. Since
384-# any of these caches may have been generated from insecure directories, they
385-# are all suspect now. Failing to do so typically causes subsequent compinit()
386-# calls to fail with "command not found: compdef" errors. (That's bad.)
387 function handle_completion_insecurities() {
388 # List of the absolute paths of all unique insecure directories, split on
389 # newline from compaudit()'s output resembling:
390@@ -22,39 +18,27 @@ function handle_completion_insecurities() {
391 insecure_dirs=( ${(f@):-"$(compaudit 2>/dev/null)"} )
392
393 # If no such directories exist, get us out of here.
394- if (( ! ${#insecure_dirs} )); then
395- print "[oh-my-zsh] No insecure completion-dependent directories detected."
396- return
397- fi
398+ [[ -z "${insecure_dirs}" ]] && return
399
400 # List ownership and permissions of all insecure directories.
401 print "[oh-my-zsh] Insecure completion-dependent directories detected:"
402 ls -ld "${(@)insecure_dirs}"
403- print "[oh-my-zsh] For safety, completions will be disabled until you manually fix all"
404- print "[oh-my-zsh] insecure directory permissions and ownership and restart oh-my-zsh."
405- print "[oh-my-zsh] See the above list for directories with group or other writability.\n"
406
407- # Locally enable the "NULL_GLOB" option, thus removing unmatched filename
408- # globs from argument lists *AND* printing no warning when doing so. Failing
409- # to do so prints an unreadable warning if no completion caches exist below.
410- setopt local_options null_glob
411+ cat <<EOD
412
413- # List of the absolute paths of all unique existing completion caches.
414- local -aU zcompdump_files
415- zcompdump_files=( "${ZSH_COMPDUMP}"(.) "${ZDOTDIR:-${HOME}}"/.zcompdump* )
416+[oh-my-zsh] For safety, we will not load completions from these directories until
417+[oh-my-zsh] you fix their permissions and ownership and restart zsh.
418+[oh-my-zsh] See the above list for directories with group or other writability.
419
420- # Move such caches to a temporary directory.
421- if (( ${#zcompdump_files} )); then
422- # Absolute path of the directory to which such files will be moved.
423- local ZSH_ZCOMPDUMP_BAD_DIR="${ZSH_CACHE_DIR}/zcompdump-bad"
424+[oh-my-zsh] To fix your permissions you can do so by disabling
425+[oh-my-zsh] the write permission of "group" and "others" and making sure that the
426+[oh-my-zsh] owner of these directories is either root or your current user.
427+[oh-my-zsh] The following command may help:
428+[oh-my-zsh] compaudit | xargs chmod g-w,o-w
429
430- # List such files first.
431- print "[oh-my-zsh] Insecure completion caches also detected:"
432- ls -l "${(@)zcompdump_files}"
433+[oh-my-zsh] If the above didn't help or you want to skip the verification of
434+[oh-my-zsh] insecure directories you can set the variable ZSH_DISABLE_COMPFIX to
435+[oh-my-zsh] "true" before oh-my-zsh is sourced in your zshrc file.
436
437- # For safety, move rather than permanently remove such files.
438- print "[oh-my-zsh] Moving to \"${ZSH_ZCOMPDUMP_BAD_DIR}/\"...\n"
439- mkdir -p "${ZSH_ZCOMPDUMP_BAD_DIR}"
440- mv "${(@)zcompdump_files}" "${ZSH_ZCOMPDUMP_BAD_DIR}/"
441- fi
442+EOD
443 }
444diff --git a/lib/completion.zsh b/lib/completion.zsh
445index bbd02165659dec1032d8f6ef98f0c276e6ab9677..c7db2eb7b20abde827d46858e03d3b8f87b9957a 100644
446--- a/lib/completion.zsh
447+++ b/lib/completion.zsh
448@@ -5,7 +5,7 @@ WORDCHARS=''
449
450 unsetopt menu_complete # do not autoselect the first completion entry
451 unsetopt flowcontrol
452-setopt auto_menu # show completion menu on succesive tab press
453+setopt auto_menu # show completion menu on successive tab press
454 setopt complete_in_word
455 setopt always_to_end
456
457@@ -25,6 +25,9 @@ else
458 fi
459 unset CASE_SENSITIVE HYPHEN_INSENSITIVE
460
461+# Complete . and .. special directories
462+zstyle ':completion:*' special-dirs true
463+
464 zstyle ':completion:*' list-colors ''
465 zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
466
467diff --git a/lib/correction.zsh b/lib/correction.zsh
468index 3e1415a0ba840c1298e583c66c87eb2d6bb5f9ae..c635236b5b06f31d523849a0756f06b9aed65704 100644
469--- a/lib/correction.zsh
470+++ b/lib/correction.zsh
471@@ -1,4 +1,5 @@
472 if [[ "$ENABLE_CORRECTION" == "true" ]]; then
473+ alias cp='nocorrect cp'
474 alias ebuild='nocorrect ebuild'
475 alias gist='nocorrect gist'
476 alias heroku='nocorrect heroku'
477diff --git a/lib/directories.zsh b/lib/directories.zsh
478index a50a692c8abaff1a94afff1c6ecf1c14e0cd8197..cf87bd7e4f7028d29746c9b806738eeba1d29065 100644
479--- a/lib/directories.zsh
480+++ b/lib/directories.zsh
481@@ -21,14 +21,18 @@ alias 9='cd -9'
482
483 alias md='mkdir -p'
484 alias rd=rmdir
485-alias d='dirs -v | head -10'
486+
487+function d () {
488+ if [[ -n $1 ]]; then
489+ dirs "$@"
490+ else
491+ dirs -v | head -10
492+ fi
493+}
494+compdef _dirs d
495
496 # List directory contents
497 alias lsa='ls -lah'
498 alias l='ls -lah'
499 alias ll='ls -lh'
500 alias la='ls -lAh'
501-
502-# Push and pop directories on directory stack
503-alias pu='pushd'
504-alias po='popd'
505diff --git a/lib/functions.zsh b/lib/functions.zsh
506index 9f11318d2c06ca78ca2d72cd54291102e4cf364c..61dfa478009beb5832cc06986b50be7554832440 100644
507--- a/lib/functions.zsh
508+++ b/lib/functions.zsh
509@@ -11,33 +11,27 @@ function upgrade_oh_my_zsh() {
510 }
511
512 function take() {
513- mkdir -p $1
514- cd $1
515+ mkdir -p $@ && cd ${@:$#}
516 }
517
518 function open_command() {
519- emulate -L zsh
520- setopt shwordsplit
521-
522 local open_cmd
523
524 # define the open command
525 case "$OSTYPE" in
526 darwin*) open_cmd='open' ;;
527 cygwin*) open_cmd='cygstart' ;;
528- linux*) open_cmd='xdg-open' ;;
529+ linux*) [[ "$(uname -r)" != *icrosoft* ]] && open_cmd='nohup xdg-open' || {
530+ open_cmd='cmd.exe /c start ""'
531+ [[ -e "$1" ]] && { 1="$(wslpath -w "${1:a}")" || return 1 }
532+ } ;;
533 msys*) open_cmd='start ""' ;;
534 *) echo "Platform $OSTYPE not supported"
535 return 1
536 ;;
537 esac
538
539- # don't use nohup on OSX
540- if [[ "$OSTYPE" == darwin* ]]; then
541- $open_cmd "$@" &>/dev/null
542- else
543- nohup $open_cmd "$@" &>/dev/null
544- fi
545+ ${=open_cmd} "$@" &>/dev/null
546 }
547
548 #
549@@ -52,8 +46,7 @@ function open_command() {
550 # 1 if it does not exist
551 #
552 function alias_value() {
553- alias "$1" | sed "s/^$1='\(.*\)'$/\1/"
554- test $(alias "$1")
555+ (( $+aliases[$1] )) && echo $aliases[$1]
556 }
557
558 #
559@@ -81,12 +74,12 @@ function try_alias_value() {
560 # 0 if the variable exists, 3 if it was set
561 #
562 function default() {
563- test `typeset +m "$1"` && return 0
564+ (( $+parameters[$1] )) && return 0
565 typeset -g "$1"="$2" && return 3
566 }
567
568 #
569-# Set enviroment variable "$1" to default value "$2" if "$1" is not yet defined.
570+# Set environment variable "$1" to default value "$2" if "$1" is not yet defined.
571 #
572 # Arguments:
573 # 1. name - The env variable to set
574@@ -95,8 +88,8 @@ function default() {
575 # 0 if the env variable exists, 3 if it was set
576 #
577 function env_default() {
578- env | grep -q "^$1=" && return 0
579- export "$1=$2" && return 3
580+ (( ${${(@f):-$(typeset +xg)}[(I)$1]} )) && return 0
581+ export "$1=$2" && return 3
582 }
583
584
585diff --git a/lib/git.zsh b/lib/git.zsh
586index f7eccb81d933ca2a59a98824e5eb561bcc94312e..640561e97563e1aeffde3a9067674213e439a5ac 100644
587--- a/lib/git.zsh
588+++ b/lib/git.zsh
589@@ -10,13 +10,10 @@ function git_prompt_info() {
590
591 # Checks if working tree is dirty
592 function parse_git_dirty() {
593- local STATUS=''
594- local FLAGS
595- FLAGS=('--porcelain')
596+ local STATUS
597+ local -a FLAGS
598+ FLAGS=('--porcelain' '--ignore-submodules=dirty')
599 if [[ "$(command git config --get oh-my-zsh.hide-dirty)" != "1" ]]; then
600- if [[ $POST_1_7_2_GIT -gt 0 ]]; then
601- FLAGS+='--ignore-submodules=dirty'
602- fi
603 if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" == "true" ]]; then
604 FLAGS+='--untracked-files=no'
605 fi
606@@ -77,8 +74,8 @@ function git_current_branch() {
607 # Gets the number of commits ahead from remote
608 function git_commits_ahead() {
609 if command git rev-parse --git-dir &>/dev/null; then
610- local commits="$(git rev-list --count @{upstream}..HEAD)"
611- if [[ "$commits" != 0 ]]; then
612+ local commits="$(git rev-list --count @{upstream}..HEAD 2>/dev/null)"
613+ if [[ -n "$commits" && "$commits" != 0 ]]; then
614 echo "$ZSH_THEME_GIT_COMMITS_AHEAD_PREFIX$commits$ZSH_THEME_GIT_COMMITS_AHEAD_SUFFIX"
615 fi
616 fi
617@@ -87,8 +84,8 @@ function git_commits_ahead() {
618 # Gets the number of commits behind remote
619 function git_commits_behind() {
620 if command git rev-parse --git-dir &>/dev/null; then
621- local commits="$(git rev-list --count HEAD..@{upstream})"
622- if [[ "$commits" != 0 ]]; then
623+ local commits="$(git rev-list --count HEAD..@{upstream} 2>/dev/null)"
624+ if [[ -n "$commits" && "$commits" != 0 ]]; then
625 echo "$ZSH_THEME_GIT_COMMITS_BEHIND_PREFIX$commits$ZSH_THEME_GIT_COMMITS_BEHIND_SUFFIX"
626 fi
627 fi
628@@ -141,11 +138,15 @@ function git_prompt_status() {
629 STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS"
630 elif $(echo "$INDEX" | grep '^M ' &> /dev/null); then
631 STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS"
632+ elif $(echo "$INDEX" | grep '^MM ' &> /dev/null); then
633+ STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS"
634 fi
635 if $(echo "$INDEX" | grep '^ M ' &> /dev/null); then
636 STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS"
637 elif $(echo "$INDEX" | grep '^AM ' &> /dev/null); then
638 STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS"
639+ elif $(echo "$INDEX" | grep '^MM ' &> /dev/null); then
640+ STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS"
641 elif $(echo "$INDEX" | grep '^ T ' &> /dev/null); then
642 STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS"
643 fi
644@@ -177,28 +178,6 @@ function git_prompt_status() {
645 echo $STATUS
646 }
647
648-# Compares the provided version of git to the version installed and on path
649-# Outputs -1, 0, or 1 if the installed version is less than, equal to, or
650-# greater than the input version, respectively.
651-function git_compare_version() {
652- local INPUT_GIT_VERSION INSTALLED_GIT_VERSION
653- INPUT_GIT_VERSION=(${(s/./)1})
654- INSTALLED_GIT_VERSION=($(command git --version 2>/dev/null))
655- INSTALLED_GIT_VERSION=(${(s/./)INSTALLED_GIT_VERSION[3]})
656-
657- for i in {1..3}; do
658- if [[ $INSTALLED_GIT_VERSION[$i] -gt $INPUT_GIT_VERSION[$i] ]]; then
659- echo 1
660- return 0
661- fi
662- if [[ $INSTALLED_GIT_VERSION[$i] -lt $INPUT_GIT_VERSION[$i] ]]; then
663- echo -1
664- return 0
665- fi
666- done
667- echo 0
668-}
669-
670 # Outputs the name of the current user
671 # Usage example: $(git_current_user_name)
672 function git_current_user_name() {
673@@ -210,8 +189,3 @@ function git_current_user_name() {
674 function git_current_user_email() {
675 command git config user.email 2>/dev/null
676 }
677-
678-# This is unlikely to change so make it all statically assigned
679-POST_1_7_2_GIT=$(git_compare_version "1.7.2")
680-# Clean up the namespace slightly by removing the checker function
681-unfunction git_compare_version
682diff --git a/lib/history.zsh b/lib/history.zsh
683index 5de71c2d3e0fdd0296cc8d46da9fbd1724fd7a00..52e45bf4ca7776c3415110f8678ccd2dbe451071 100644
684--- a/lib/history.zsh
685+++ b/lib/history.zsh
686@@ -1,24 +1,40 @@
687-## Command history configuration
688-if [ -z "$HISTFILE" ]; then
689- HISTFILE=$HOME/.zsh_history
690-fi
691+## History wrapper
692+function omz_history {
693+ local clear list
694+ zparseopts -E c=clear l=list
695
696-HISTSIZE=10000
697-SAVEHIST=10000
698+ if [[ -n "$clear" ]]; then
699+ # if -c provided, clobber the history file
700+ echo -n >| "$HISTFILE"
701+ echo >&2 History file deleted. Reload the session to see its effects.
702+ elif [[ -n "$list" ]]; then
703+ # if -l provided, run as if calling `fc' directly
704+ builtin fc "$@"
705+ else
706+ # unless a number is provided, show all history events (starting from 1)
707+ [[ ${@[-1]-} = *[0-9]* ]] && builtin fc -l "$@" || builtin fc -l "$@" 1
708+ fi
709+}
710
711-# Show history
712-case $HIST_STAMPS in
713- "mm/dd/yyyy") alias history='fc -fl 1' ;;
714- "dd.mm.yyyy") alias history='fc -El 1' ;;
715- "yyyy-mm-dd") alias history='fc -il 1' ;;
716- *) alias history='fc -l 1' ;;
717+# Timestamp format
718+case ${HIST_STAMPS-} in
719+ "mm/dd/yyyy") alias history='omz_history -f' ;;
720+ "dd.mm.yyyy") alias history='omz_history -E' ;;
721+ "yyyy-mm-dd") alias history='omz_history -i' ;;
722+ "") alias history='omz_history' ;;
723+ *) alias history="omz_history -t '$HIST_STAMPS'" ;;
724 esac
725
726-setopt append_history
727-setopt extended_history
728-setopt hist_expire_dups_first
729-setopt hist_ignore_dups # ignore duplication command history list
730-setopt hist_ignore_space
731-setopt hist_verify
732-setopt inc_append_history
733-setopt share_history # share command history data
734+## History file configuration
735+[ -z "$HISTFILE" ] && HISTFILE="$HOME/.zsh_history"
736+HISTSIZE=50000
737+SAVEHIST=10000
738+
739+## History command configuration
740+setopt extended_history # record timestamp of command in HISTFILE
741+setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE
742+setopt hist_ignore_dups # ignore duplicated commands history list
743+setopt hist_ignore_space # ignore commands that start with space
744+setopt hist_verify # show command with history expansion to user before running it
745+setopt inc_append_history # add commands to HISTFILE in order of execution
746+setopt share_history # share command history data
747diff --git a/lib/misc.zsh b/lib/misc.zsh
748index c81dab4139c2aa84f7baa3044b07f0fb6958f79e..61571afc9cdde321bc5d2e686d95e4283cf2ec7c 100644
749--- a/lib/misc.zsh
750+++ b/lib/misc.zsh
751@@ -1,7 +1,7 @@
752-## Load smart urls if available
753-# bracketed-paste-magic is known buggy in zsh 5.1.1 (only), so skip it there; see #4434
754 autoload -Uz is-at-least
755-if [[ $ZSH_VERSION != 5.1.1 ]]; then
756+
757+# *-magic is known buggy in some versions; disable if so
758+if [[ $DISABLE_MAGIC_FUNCTIONS != true ]]; then
759 for d in $fpath; do
760 if [[ -e "$d/url-quote-magic" ]]; then
761 if is-at-least 5.1; then
762@@ -18,13 +18,11 @@ fi
763 ## jobs
764 setopt long_list_jobs
765
766-## pager
767-export PAGER="less"
768-export LESS="-R"
769+env_default 'PAGER' 'less'
770+env_default 'LESS' '-R'
771
772 ## super user alias
773-alias _='sudo'
774-alias please='sudo'
775+alias _='sudo '
776
777 ## more intelligent acking for ubuntu users
778 if which ack-grep &> /dev/null; then
779@@ -33,10 +31,5 @@ else
780 alias afind='ack -il'
781 fi
782
783-# only define LC_CTYPE if undefined
784-if [[ -z "$LC_CTYPE" && -z "$LC_ALL" ]]; then
785- export LC_CTYPE=${LANG%%:*} # pick the first entry from LANG
786-fi
787-
788 # recognize comments
789 setopt interactivecomments
790diff --git a/lib/prompt_info_functions.zsh b/lib/prompt_info_functions.zsh
791index 335c02a3d03867efa8674d778189d82a377896c6..5069c4b21751257d07cbdbf574ad5e37bd9ca1c0 100644
792--- a/lib/prompt_info_functions.zsh
793+++ b/lib/prompt_info_functions.zsh
794@@ -10,9 +10,15 @@
795 # Dummy implementations that return false to prevent command_not_found
796 # errors with themes, that implement these functions
797 # Real implementations will be used when the respective plugins are loaded
798-function chruby_prompt_info hg_prompt_info pyenv_prompt_info \
799- rbenv_prompt_info svn_prompt_info vi_mode_prompt_info \
800- virtualenv_prompt_info {
801+function chruby_prompt_info \
802+ rbenv_prompt_info \
803+ hg_prompt_info \
804+ pyenv_prompt_info \
805+ svn_prompt_info \
806+ vi_mode_prompt_info \
807+ virtualenv_prompt_info \
808+ jenv_prompt_info \
809+{
810 return 1
811 }
812
813@@ -22,10 +28,13 @@ function rvm_prompt_info() {
814 [ -f $HOME/.rvm/bin/rvm-prompt ] || return 1
815 local rvm_prompt
816 rvm_prompt=$($HOME/.rvm/bin/rvm-prompt ${=ZSH_THEME_RVM_PROMPT_OPTIONS} 2>/dev/null)
817- [[ "${rvm_prompt}x" == "x" ]] && return 1
818- echo "${ZSH_THEME_RVM_PROMPT_PREFIX:=(}${rvm_prompt}${ZSH_THEME_RVM_PROMPT_SUFFIX:=)}"
819+ [[ -z "${rvm_prompt}" ]] && return 1
820+ echo "${ZSH_THEME_RUBY_PROMPT_PREFIX}${rvm_prompt}${ZSH_THEME_RUBY_PROMPT_SUFFIX}"
821 }
822
823+ZSH_THEME_RVM_PROMPT_OPTIONS="i v g"
824+
825+
826 # use this to enable users to see their ruby version, no matter which
827 # version management system they use
828 function ruby_prompt_info() {
829diff --git a/lib/spectrum.zsh b/lib/spectrum.zsh
830index 87092d8ae8b036c6105314b0669fe7accf2f671b..312ab22482176acf25bedd74276f6ce2f6048384 100644
831--- a/lib/spectrum.zsh
832+++ b/lib/spectrum.zsh
833@@ -1,7 +1,7 @@
834 #! /bin/zsh
835 # A script to make using 256 colors in zsh less painful.
836 # P.C. Shyamshankar <sykora@lucentbeing.com>
837-# Copied from http://github.com/sykora/etc/blob/master/zsh/functions/spectrum/
838+# Copied from https://github.com/sykora/etc/blob/master/zsh/functions/spectrum/
839
840 typeset -AHg FX FG BG
841
842diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh
843index 871ab28dfa82f8c63d43538c64c18409b393c78b..aa14f3f07fe4a12979cd9352b8a6ee6d917cadc0 100644
844--- a/lib/termsupport.zsh
845+++ b/lib/termsupport.zsh
846@@ -21,7 +21,7 @@ function title {
847 print -Pn "\e]2;$2:q\a" # set window name
848 print -Pn "\e]1;$1:q\a" # set tab name
849 ;;
850- screen*)
851+ screen*|tmux*)
852 print -Pn "\ek$1:q\e\\" # set screen hardstatus
853 ;;
854 *)
855@@ -80,7 +80,7 @@ preexec_functions+=(omz_termsupport_preexec)
856
857
858 # Keep Apple Terminal.app's current working directory updated
859-# Based on this answer: http://superuser.com/a/315029
860+# Based on this answer: https://superuser.com/a/315029
861 # With extra fixes to handle multibyte chars and non-UTF-8 locales
862
863 if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then
864diff --git a/lib/theme-and-appearance.zsh b/lib/theme-and-appearance.zsh
865index 5c5bb0e6d3a3586ba89208bab51256d56b01e448..5016d86caadc92ce3192400926bc1df7c0c7a773 100644
866--- a/lib/theme-and-appearance.zsh
867+++ b/lib/theme-and-appearance.zsh
868@@ -1,45 +1,54 @@
869 # ls colors
870 autoload -U colors && colors
871-export LSCOLORS="Gxfxcxdxbxegedabagacad"
872
873 # Enable ls colors
874-if [ "$DISABLE_LS_COLORS" != "true" ]
875-then
876- # Find the option for using colors in ls, depending on the version: Linux or BSD
877- if [[ "$(uname -s)" == "NetBSD" ]]; then
878+export LSCOLORS="Gxfxcxdxbxegedabagacad"
879+
880+# TODO organise this chaotic logic
881+
882+if [[ "$DISABLE_LS_COLORS" != "true" ]]; then
883+ # Find the option for using colors in ls, depending on the version
884+ if [[ "$OSTYPE" == netbsd* ]]; then
885 # On NetBSD, test if "gls" (GNU ls) is installed (this one supports colors);
886 # otherwise, leave ls as is, because NetBSD's ls doesn't support -G
887- gls --color -d . &>/dev/null 2>&1 && alias ls='gls --color=tty'
888- elif [[ "$(uname -s)" == "OpenBSD" ]]; then
889+ gls --color -d . &>/dev/null && alias ls='gls --color=tty'
890+ elif [[ "$OSTYPE" == openbsd* ]]; then
891 # On OpenBSD, "gls" (ls from GNU coreutils) and "colorls" (ls from base,
892 # with color and multibyte support) are available from ports. "colorls"
893 # will be installed on purpose and can't be pulled in by installing
894 # coreutils, so prefer it to "gls".
895- gls --color -d . &>/dev/null 2>&1 && alias ls='gls --color=tty'
896- colorls -G -d . &>/dev/null 2>&1 && alias ls='colorls -G'
897+ gls --color -d . &>/dev/null && alias ls='gls --color=tty'
898+ colorls -G -d . &>/dev/null && alias ls='colorls -G'
899+ elif [[ "$OSTYPE" == (darwin|freebsd)* ]]; then
900+ # this is a good alias, it works by default just using $LSCOLORS
901+ ls -G . &>/dev/null && alias ls='ls -G'
902+
903+ # only use coreutils ls if there is a dircolors customization present ($LS_COLORS or .dircolors file)
904+ # otherwise, gls will use the default color scheme which is ugly af
905+ [[ -n "$LS_COLORS" || -f "$HOME/.dircolors" ]] && gls --color -d . &>/dev/null && alias ls='gls --color=tty'
906 else
907- ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty' || alias ls='ls -G'
908+ # For GNU ls, we use the default ls color theme. They can later be overwritten by themes.
909+ if [[ -z "$LS_COLORS" ]]; then
910+ (( $+commands[dircolors] )) && eval "$(dircolors -b)"
911+ fi
912+
913+ ls --color -d . &>/dev/null && alias ls='ls --color=tty' || { ls -G . &>/dev/null && alias ls='ls -G' }
914+
915+ # Take advantage of $LS_COLORS for completion as well.
916+ zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
917 fi
918 fi
919
920 setopt auto_cd
921 setopt multios
922+setopt prompt_subst
923
924-if [[ x$WINDOW != x ]]
925-then
926- SCREEN_NO="%B$WINDOW%b "
927-else
928- SCREEN_NO=""
929-fi
930-
931-# Apply theming defaults
932-PS1="%n@%m:%~%# "
933+[[ -n "$WINDOW" ]] && SCREEN_NO="%B$WINDOW%b " || SCREEN_NO=""
934
935 # git theming default: Variables for theming the git info prompt
936 ZSH_THEME_GIT_PROMPT_PREFIX="git:(" # Prefix at the very beginning of the prompt, before the branch name
937 ZSH_THEME_GIT_PROMPT_SUFFIX=")" # At the very end of the prompt
938 ZSH_THEME_GIT_PROMPT_DIRTY="*" # Text to display if the branch is dirty
939 ZSH_THEME_GIT_PROMPT_CLEAN="" # Text to display if the branch is clean
940-
941-# Setup the prompt with pretty colors
942-setopt prompt_subst
943+ZSH_THEME_RUBY_PROMPT_PREFIX="("
944+ZSH_THEME_RUBY_PROMPT_SUFFIX=")"
945diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh
946index ed258f0ea694758bccd8760fa73a85c1b9ecfe63..6b2662d5e8fdde23ad91d0557c43baff1206a5c1 100644
947--- a/oh-my-zsh.sh
948+++ b/oh-my-zsh.sh
949@@ -1,6 +1,17 @@
950+# Set ZSH_CACHE_DIR to the path where cache files should be created
951+# or else we will use the default cache/
952+if [[ -z "$ZSH_CACHE_DIR" ]]; then
953+ ZSH_CACHE_DIR="$ZSH/cache"
954+fi
955+
956+# Migrate .zsh-update file to $ZSH_CACHE_DIR
957+if [ -f ~/.zsh-update ] && [ ! -f ${ZSH_CACHE_DIR}/.zsh-update ]; then
958+ mv ~/.zsh-update ${ZSH_CACHE_DIR}/.zsh-update
959+fi
960+
961 # Check for updates on initial load...
962 if [ "$DISABLE_AUTO_UPDATE" != "true" ]; then
963- env ZSH=$ZSH DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh -f $ZSH/tools/check_for_upgrade.sh
964+ env ZSH=$ZSH ZSH_CACHE_DIR=$ZSH_CACHE_DIR DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh -f $ZSH/tools/check_for_upgrade.sh
965 fi
966
967 # Initializes Oh My Zsh
968@@ -11,29 +22,12 @@ fpath=($ZSH/functions $ZSH/completions $fpath)
969 # Load all stock functions (from $fpath files) called below.
970 autoload -U compaudit compinit
971
972-: ${ZSH_DISABLE_COMPFIX:=true}
973-
974 # Set ZSH_CUSTOM to the path where your custom config files
975 # and plugins exists, or else we will use the default custom/
976 if [[ -z "$ZSH_CUSTOM" ]]; then
977 ZSH_CUSTOM="$ZSH/custom"
978 fi
979
980-# Set ZSH_CACHE_DIR to the path where cache files should be created
981-# or else we will use the default cache/
982-if [[ -z "$ZSH_CACHE_DIR" ]]; then
983- ZSH_CACHE_DIR="$ZSH/cache"
984-fi
985-
986-
987-# Load all of the config files in ~/oh-my-zsh that end in .zsh
988-# TIP: Add files you don't want in git to .gitignore
989-for config_file ($ZSH/lib/*.zsh); do
990- custom_config_file="${ZSH_CUSTOM}/lib/${config_file:t}"
991- [ -f "${custom_config_file}" ] && config_file=${custom_config_file}
992- source $config_file
993-done
994-
995
996 is_plugin() {
997 local base_dir=$1
998@@ -41,6 +35,7 @@ is_plugin() {
999 test -f $base_dir/plugins/$name/$name.plugin.zsh \
1000 || test -f $base_dir/plugins/$name/_$name
1001 }
1002+
1003 # Add all defined plugins to fpath. This must be done
1004 # before running compinit.
1005 for plugin ($plugins); do
1006@@ -48,12 +43,14 @@ for plugin ($plugins); do
1007 fpath=($ZSH_CUSTOM/plugins/$plugin $fpath)
1008 elif is_plugin $ZSH $plugin; then
1009 fpath=($ZSH/plugins/$plugin $fpath)
1010+ else
1011+ echo "[oh-my-zsh] plugin '$plugin' not found"
1012 fi
1013 done
1014
1015 # Figure out the SHORT hostname
1016 if [[ "$OSTYPE" = darwin* ]]; then
1017- # OS X's $HOST changes with dhcp, etc. Use ComputerName if possible.
1018+ # macOS's $HOST changes with dhcp, etc. Use ComputerName if possible.
1019 SHORT_HOST=$(scutil --get ComputerName 2>/dev/null) || SHORT_HOST=${HOST/.*/}
1020 else
1021 SHORT_HOST=${HOST/.*/}
1022@@ -65,18 +62,25 @@ if [ -z "$ZSH_COMPDUMP" ]; then
1023 fi
1024
1025 if [[ $ZSH_DISABLE_COMPFIX != true ]]; then
1026- # If completion insecurities exist, warn the user without enabling completions.
1027- if ! compaudit &>/dev/null; then
1028- # This function resides in the "lib/compfix.zsh" script sourced above.
1029- handle_completion_insecurities
1030- # Else, enable and cache completions to the desired file.
1031- else
1032- compinit -d "${ZSH_COMPDUMP}"
1033- fi
1034+ source $ZSH/lib/compfix.zsh
1035+ # If completion insecurities exist, warn the user
1036+ handle_completion_insecurities
1037+ # Load only from secure directories
1038+ compinit -i -C -d "${ZSH_COMPDUMP}"
1039 else
1040- compinit -i -d "${ZSH_COMPDUMP}"
1041+ # If the user wants it, load from all found directories
1042+ compinit -u -C -d "${ZSH_COMPDUMP}"
1043 fi
1044
1045+
1046+# Load all of the config files in ~/oh-my-zsh that end in .zsh
1047+# TIP: Add files you don't want in git to .gitignore
1048+for config_file ($ZSH/lib/*.zsh); do
1049diff --git a/plugins/adb/README.md b/plugins/adb/README.md
1050index 075beec0e3733e06035f7e982a9aef58b5438f1b..83dcc728808eb0b7a38190b6c18aecdbb69e178f 100644
1051--- a/plugins/adb/README.md
1052+++ b/plugins/adb/README.md
1053@@ -1,7 +1,7 @@
1054 # adb autocomplete plugin
1055
1056 * Adds autocomplete options for all adb commands.
1057-
1058+* Add autocomplete for `adb -s`
1059
1060 ## Requirements
1061
1062diff --git a/plugins/adb/_adb b/plugins/adb/_adb
1063index f30f3247f1ecbb884b260f83e6507e94fcab7203..78c4577462cfea022527095f380ca39f0363b934 100644
1064--- a/plugins/adb/_adb
1065+++ b/plugins/adb/_adb
1066@@ -13,9 +13,13 @@ _1st_arguments=(
1067 'disconnect:disconnect from a TCP/IP device. Port 5555 is default.'
1068 'emu:run emulator console command'
1069 'forward:forward socket connections'
1070+'get-devpath:print the device path'
1071+'get-serialno:print the serial number of the device'
1072+'get-state:print the current state of the device: offline | bootloader | device'
1073 'help:show the help message'
1074 'install:push this package file to the device and install it'
1075 'jdwp:list PIDs of processes hosting a JDWP transport'
1076+'keygen:generate adb public/private key'
1077 'kill-server:kill the server if it is running'
1078 'logcat:view device log'
1079 'pull:copy file/dir from device'
1080@@ -30,6 +34,7 @@ _1st_arguments=(
1081 'start-server:ensure that there is a server running'
1082 'tcpip:restart host adb in tcpip mode'
1083 'uninstall:remove this app package from the device'
1084+'usb:restart the adbd daemon listing on USB'
1085 'version:show version num'
1086 'wait-for-device:block until device is online'
1087 )
1088@@ -38,8 +43,22 @@ local expl
1089 local -a pkgs installed_pkgs
1090
1091 _arguments \
1092+ '-s[devices]:specify device:->specify_device' \
1093 '*:: :->subcmds' && return 0
1094
1095+case "$state" in
1096+ specify_device)
1097+ _values -C 'devices' ${$(adb devices -l|awk 'NR>1&& $1 \
1098+ {sub(/ +/," ",$0); \
1099+ gsub(":","\\:",$1); \
1100+ for(i=1;i<=NF;i++) {
1101+ if($i ~ /model:/) { split($i,m,":") } \
1102+ else if($i ~ /product:/) { split($i,p,":") } } \
1103+ printf "%s[%s(%s)] ",$1, p[2], m[2]}'):-""}
1104+ return
1105+ ;;
1106+esac
1107+
1108 if (( CURRENT == 1 )); then
1109 _describe -t commands "adb subcommand" _1st_arguments
1110 return
1111diff --git a/plugins/alias-finder/README.md b/plugins/alias-finder/README.md
1112new file mode 100644
1113index 0000000000000000000000000000000000000000..409f4b6536210d74caa3efee77ffc5a930da728b
1114--- /dev/null
1115+++ b/plugins/alias-finder/README.md
1116@@ -0,0 +1,46 @@
1117+# alias-finder plugin
1118+
1119+This plugin searches the defined aliases and outputs any that match the command inputted. This makes learning new aliases easier.
1120+
1121+To use it, add `alias-finder` to the `plugins` array of your zshrc file:
1122+```
1123+plugins=(... alias-finder)
1124+```
1125+
1126+## Usage
1127+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.
1128+
1129+## Options
1130+
1131+- Use `--longer` or `-l` to allow the aliases to be longer than the input (match aliases if they contain the input).
1132+- Use `--exact` or `-e` to avoid matching aliases that are shorter than the input.
1133+
1134+## Examples
1135+```
1136+$ alias-finder "git pull"
1137+gl='git pull'
1138+g=git
1139+```
1140+```
1141+$ alias-finder "web_search google oh my zsh"
1142+google='web_search google'
1143+```
1144+```
1145+$ alias-finder "git commit -v"
1146+gc="git commit -v"
1147+g=git
1148+```
1149+```
1150+$ alias-finder -e "git commit -v"
1151+gc='git commit -v'
1152+```
1153+```
1154+$ alias-finder -l "git commit -v"
1155+gc='git commit -v'
1156+'gc!'='git commit -v --amend'
1157+gca='git commit -v -a'
1158+'gca!'='git commit -v -a --amend'
1159+'gcan!'='git commit -v -a --no-edit --amend'
1160+'gcans!'='git commit -v -a -s --no-edit --amend'
1161+'gcn!'='git commit -v --no-edit --amend'
1162+```
1163diff --git a/plugins/alias-finder/alias-finder.plugin.zsh b/plugins/alias-finder/alias-finder.plugin.zsh
1164new file mode 100644
1165index 0000000000000000000000000000000000000000..2bfaad597e26e4f1dd0d95eb745887c45844fd6e
1166--- /dev/null
1167+++ b/plugins/alias-finder/alias-finder.plugin.zsh
1168@@ -0,0 +1,46 @@
1169+alias-finder() {
1170+ local cmd="" exact="" longer="" wordStart="" wordEnd="" multiWordEnd=""
1171+ for i in $@; do
1172+ case $i in
1173+ -e|--exact) exact=true;;
1174+ -l|--longer) longer=true;;
1175+ *)
1176+ if [[ -z $cmd ]]; then
1177+ cmd=$i
1178+ else
1179+ cmd="$cmd $i"
1180+ fi
1181+ ;;
1182+ esac
1183+ done
1184+ cmd=$(sed 's/[].\|$(){}?+*^[]/\\&/g' <<< $cmd) # adds escaping for grep
1185+ if [[ $(wc -l <<< $cmd) == 1 ]]; then
1186+ while [[ $cmd != "" ]]; do
1187+ if [[ $longer = true ]]; then
1188+ wordStart="'{0,1}"
1189+ else
1190+ wordEnd="$"
1191+ multiWordEnd="'$"
1192+ fi
1193+ if [[ $cmd == *" "* ]]; then
1194+ local finder="'$cmd$multiWordEnd"
1195+ else
1196+ local finder=$wordStart$cmd$wordEnd
1197+ fi
1198+ alias | grep -E "=$finder"
1199+ if [[ $exact = true || $longer = true ]]; then
1200+ break
1201+ else
1202+ cmd=$(sed -E 's/ {0,1}[^ ]*$//' <<< $cmd) # removes last word
1203+ fi
1204+ done
1205+ fi
1206+}
1207+
1208+preexec_alias-finder() {
1209+ if [[ $ZSH_ALIAS_FINDER_AUTOMATIC = true ]]; then
1210+ alias-finder $1
1211+ fi
1212+}
1213+
1214+preexec_functions+=(preexec_alias-finder)
1215diff --git a/plugins/ansible/README.md b/plugins/ansible/README.md
1216new file mode 100644
1217index 0000000000000000000000000000000000000000..e0e6a19bb293fcec6b2e1e40570ce251434cfb6d
1218--- /dev/null
1219+++ b/plugins/ansible/README.md
1220@@ -0,0 +1,34 @@
1221+# ansible plugin
1222+
1223+## Introduction
1224+
1225+The `ansible plugin` adds several aliases for useful [ansible](https://docs.ansible.com/ansible/latest/index.html) commands and [aliases](#aliases).
1226+
1227+To use it, add `ansible` to the plugins array of your zshrc file:
1228+
1229+```
1230+plugins=(... ansible)
1231+```
1232+
1233+## Aliases
1234+
1235+| Command | Description |
1236+|:-------------------------------------------|:--------------------------------------------------------------------|
1237+| `ansible-version` / `aver` | Show the version on ansible installed in this host |
1238+| `ansible-role-init <role name>` / `arinit` | Creates the Ansible Role as per Ansible Galaxy standard |
1239+| `a` | command `ansible` |
1240+| `aconf` | command `ansible-config` |
1241+| `acon` | command `ansible-console` |
1242+| `ainv` | command `ansible-inventory` |
1243+| `aplaybook` | command `ansible-playbook` |
1244+| `ainv` | command `ansible-inventory` |
1245+| `adoc` | command `ansible-doc` |
1246+| `agal` | command `ansible-galaxy` |
1247+| `apull` | command `ansible-pull` |
1248+| `aval` | command `ansible-vault` |
1249+
1250+## Maintainer
1251+
1252+### [Deepankumar](https://github.com/deepan10)
1253+
1254+[https://github.com/deepan10/oh-my-zsh/tree/features/ansible-plugin](https://github.com/deepan10/oh-my-zsh/tree/features/ansible-plugin)
1255diff --git a/plugins/ansible/ansible.plugin.zsh b/plugins/ansible/ansible.plugin.zsh
1256new file mode 100644
1257index 0000000000000000000000000000000000000000..f68ff23a540f11902aeaf9c5b8515875ad85093f
1258--- /dev/null
1259+++ b/plugins/ansible/ansible.plugin.zsh
1260@@ -0,0 +1,28 @@
1261+# Functions
1262+function ansible-version(){
1263+ ansible --version
1264+}
1265+
1266+function ansible-role-init(){
1267+ if ! [ -z $1] ; then
1268+ echo "Ansible Role : $1 Creating...."
1269+ ansible-galaxy init $1
1270+ tree $1
1271+ else
1272+ echo "Usage : ansible-role-init <role name>"
1273+ echo "Example : ansible-role-init role1"
1274+ fi
1275+}
1276+
1277+# Alias
1278+alias a='ansible '
1279+alias aconf='ansible-config '
1280+alias acon='ansible-console '
1281+alias aver='ansible-version'
1282+alias arinit='ansible-role-init'
1283+alias aplaybook='ansible-playbook '
1284+alias ainv='ansible-inventory '
1285+alias adoc='ansible-doc '
1286+alias agal='ansible-galaxy '
1287+alias apull='ansible-pull '
1288+alias aval='ansible-vault'
1289diff --git a/plugins/ant/README.md b/plugins/ant/README.md
1290new file mode 100644
1291index 0000000000000000000000000000000000000000..5f88984ac30a7607358d2fa12578d6a1e244d7eb
1292--- /dev/null
1293+++ b/plugins/ant/README.md
1294@@ -0,0 +1,12 @@
1295+# Ant
1296+
1297+This plugin provides completion for [Ant](https://ant.apache.org/).
1298+
1299+To use it add ant to the plugins array in your zshrc file.
1300+
1301+```bash
1302+plugins=(... ant)
1303+```
1304+
1305+It caches ant targets in a file named `.ant_targets`, you might want to add that to
1306+your `.gitignore` file.
1307diff --git a/plugins/archlinux/README.md b/plugins/archlinux/README.md
1308index 785538a564e9a7eab20f391eb49741d51a48ad7d..ff2b6a4c40c78ca291770fba751c73bc311812fc 100644
1309--- a/plugins/archlinux/README.md
1310+++ b/plugins/archlinux/README.md
1311@@ -2,6 +2,51 @@
1312
1313 ## Features
1314
1315+#### YAY
1316+
1317+| Alias | Command | Description |
1318+|---------|------------------------------------|---------------------------------------------------------------------|
1319+| yaconf | yay -Pg | Print current configuration |
1320+| yain | yay -S | Install packages from the repositories |
1321+| yains | yay -U | Install a package from a local file |
1322+| yainsd | yay -S --asdeps | Install packages as dependencies of another package |
1323+| yaloc | yay -Qi | Display information about a package in the local database |
1324+| yalocs | yay -Qs | Search for packages in the local database |
1325+| yalst | yay -Qe | List installed packages including from AUR (tagged as "local") |
1326+| yamir | yay -Syy | Force refresh of all package lists after updating mirrorlist |
1327+| yaorph | yay -Qtd | Remove orphans using yay |
1328+| yare | yay -R | Remove packages, keeping its settings and dependencies |
1329+| yarem | yay -Rns | Remove packages, including its settings and unneeded dependencies |
1330+| yarep | yay -Si | Display information about a package in the repositories |
1331+| yareps | yay -Ss | Search for packages in the repositories |
1332+| yaupg | yay -Syu | Sync with repositories before upgrading packages |
1333+| yasu | yay -Syu --no-confirm | Same as `yaupg`, but without confirmation |
1334+
1335+#### TRIZEN
1336+
1337+| Alias | Command | Description |
1338+|---------|------------------------------------|---------------------------------------------------------------------|
1339+| trconf | trizen -C | Fix all configuration files with vimdiff |
1340+| trin | trizen -S | Install packages from the repositories |
1341+| trins | trizen -U | Install a package from a local file |
1342+| trinsd | trizen -S --asdeps | Install packages as dependencies of another package |
1343+| trloc | trizen -Qi | Display information about a package in the local database |
1344+| trlocs | trizen -Qs | Search for packages in the local database |
1345+| trlst | trizen -Qe | List installed packages including from AUR (tagged as "local") |
1346+| trmir | trizen -Syy | Force refresh of all package lists after updating mirrorlist |
1347+| trorph | trizen -Qtd | Remove orphans using yaourt |
1348+| trre | trizen -R | Remove packages, keeping its settings and dependencies |
1349+| trrem | trizen -Rns | Remove packages, including its settings and unneeded dependencies |
1350+| trrep | trizen -Si | Display information about a package in the repositories |
1351+| trreps | trizen -Ss | Search for packages in the repositories |
1352+| trupd | trizen -Sy && sudo abs && sudo aur | Update and refresh local package, ABS and AUR databases |
1353+| trupd | trizen -Sy && sudo abs | Update and refresh the local package and ABS databases |
1354+| trupd | trizen -Sy && sudo aur | Update and refresh the local package and AUR databases |
1355+| trupd | trizen -Sy | Update and refresh the local package database |
1356+| trupg | trizen -Syua | Sync with repositories before upgrading all packages (from AUR too) |
1357+| trsu | trizen -Syua --no-confirm | Same as `trupg`, but without confirmation |
1358+| upgrade | trizen -Syu | Sync with repositories before upgrading packages |
1359+
1360 #### YAOURT
1361
1362 | Alias | Command | Description |
1363@@ -27,6 +72,30 @@
1364 | yasu | yaourt -Syua --no-confirm | Same as `yaupg`, but without confirmation |
1365 | upgrade | yaourt -Syu | Sync with repositories before upgrading packages |
1366
1367+#### PACAUR
1368+
1369+| Alias | Command | Description |
1370+|---------|------------------------------------|---------------------------------------------------------------------|
1371+| pain | pacaur -S | Install packages from the repositories |
1372+| pains | pacaur -U | Install a package from a local file |
1373+| painsd | pacaur -S --asdeps | Install packages as dependencies of another package |
1374+| paloc | pacaur -Qi | Display information about a package in the local database |
1375+| palocs | pacaur -Qs | Search for packages in the local database |
1376+| palst | pacaur -Qe | List installed packages including from AUR (tagged as "local") |
1377+| pamir | pacaur -Syy | Force refresh of all package lists after updating mirrorlist |
1378+| paorph | pacaur -Qtd | Remove orphans using pacaur |
1379+| pare | pacaur -R | Remove packages, keeping its settings and dependencies |
1380+| parem | pacaur -Rns | Remove packages, including its settings and unneeded dependencies |
1381+| parep | pacaur -Si | Display information about a package in the repositories |
1382+| pareps | pacaur -Ss | Search for packages in the repositories |
1383+| paupd | pacaur -Sy && sudo abs && sudo aur | Update and refresh local package, ABS and AUR databases |
1384+| paupd | pacaur -Sy && sudo abs | Update and refresh the local package and ABS databases |
1385+| paupd | pacaur -Sy && sudo aur | Update and refresh the local package and AUR databases |
1386+| paupd | pacaur -Sy | Update and refresh the local package database |
1387+| paupg | pacaur -Syua | Sync with repositories before upgrading all packages (from AUR too) |
1388+| pasu | pacaur -Syua --no-confirm | Same as `paupg`, but without confirmation |
1389+| upgrade | pacaur -Syu | Sync with repositories before upgrading packages |
1390+
1391 #### PACMAN
1392
1393 | Alias | Command | Description |
1394@@ -49,6 +118,10 @@
1395 | pacupd | sudo pacman -Sy | Update and refresh the local package database |
1396 | pacupg | sudo pacman -Syu | Sync with repositories before upgrading packages |
1397 | upgrade | sudo pacman -Syu | Sync with repositories before upgrading packages |
1398+| pacfileupg | sudo pacman -Fy | Download fresh package databases from the server |
1399+| pacfiles | pacman -Fs | Search package file names for matching strings |
1400+| pacls | pacman -Ql | List files in a package |
1401+| pacown | pacman -Qo | Show which package owns a file |
1402
1403 | Function | Description |
1404 |----------------|------------------------------------------------------|
1405@@ -56,6 +129,7 @@
1406 | paclist | List all installed packages with a short description |
1407 | pacmanallkeys | Get all keys for developers and trusted users |
1408 | pacmansignkeys | Locally trust all keys passed as parameters |
1409+| pacweb | Open the website of an ArchLinux package |
1410
1411diff --git a/plugins/archlinux/archlinux.plugin.zsh b/plugins/archlinux/archlinux.plugin.zsh
1412index 1637e8561d9a803503dc60265dce6711698f24f4..e0101c7eb57daf3a9abad44612d8d9ab9ad8dd3e 100644
1413--- a/plugins/archlinux/archlinux.plugin.zsh
1414+++ b/plugins/archlinux/archlinux.plugin.zsh
1415@@ -1,12 +1,33 @@
1416-if ! (( $+commands[yaourt] )); then
1417- upgrade() {
1418- sudo pacman -Syu
1419- }
1420-else
1421- upgrade () {
1422- yaourt -Syu
1423- }
1424+if (( $+commands[trizen] )); then
1425+ alias trconf='trizen -C'
1426+ alias trupg='trizen -Syua'
1427+ alias trsu='trizen -Syua --noconfirm'
1428+ alias trin='trizen -S'
1429+ alias trins='trizen -U'
1430+ alias trre='trizen -R'
1431+ alias trrem='trizen -Rns'
1432+ alias trrep='trizen -Si'
1433+ alias trreps='trizen -Ss'
1434+ alias trloc='trizen -Qi'
1435+ alias trlocs='trizen -Qs'
1436+ alias trlst='trizen -Qe'
1437+ alias trorph='trizen -Qtd'
1438+ alias trinsd='trizen -S --asdeps'
1439+ alias trmir='trizen -Syy'
1440+
1441+
1442+ if (( $+commands[abs] && $+commands[aur] )); then
1443+ alias trupd='trizen -Sy && sudo abs && sudo aur'
1444+ elif (( $+commands[abs] )); then
1445+ alias trupd='trizen -Sy && sudo abs'
1446+ elif (( $+commands[aur] )); then
1447+ alias trupd='trizen -Sy && sudo aur'
1448+ else
1449+ alias trupd='trizen -Sy'
1450+ fi
1451+fi
1452
1453+if (( $+commands[yaourt] )); then
1454 alias yaconf='yaourt -C'
1455 alias yaupg='yaourt -Syua'
1456 alias yasu='yaourt -Syua --noconfirm'
1457@@ -35,6 +56,84 @@ else
1458 fi
1459 fi
1460
1461+if (( $+commands[yay] )); then
1462+ alias yaconf='yay -Pg'
1463+ alias yaupg='yay -Syu'
1464+ alias yasu='yay -Syu --noconfirm'
1465+ alias yain='yay -S'
1466+ alias yains='yay -U'
1467+ alias yare='yay -R'
1468+ alias yarem='yay -Rns'
1469+ alias yarep='yay -Si'
1470+ alias yareps='yay -Ss'
1471+ alias yaloc='yay -Qi'
1472+ alias yalocs='yay -Qs'
1473+ alias yalst='yay -Qe'
1474+ alias yaorph='yay -Qtd'
1475+ alias yainsd='yay -S --asdeps'
1476+ alias yamir='yay -Syy'
1477+
1478+
1479+ if (( $+commands[abs] && $+commands[aur] )); then
1480+ alias yaupd='yay -Sy && sudo abs && sudo aur'
1481+ elif (( $+commands[abs] )); then
1482+ alias yaupd='yay -Sy && sudo abs'
1483+ elif (( $+commands[aur] )); then
1484+ alias yaupd='yay -Sy && sudo aur'
1485+ else
1486+ alias yaupd='yay -Sy'
1487+ fi
1488+fi
1489+
1490+if (( $+commands[pacaur] )); then
1491+ alias paupg='pacaur -Syu'
1492+ alias pasu='pacaur -Syu --noconfirm'
1493+ alias pain='pacaur -S'
1494+ alias pains='pacaur -U'
1495+ alias pare='pacaur -R'
1496+ alias parem='pacaur -Rns'
1497+ alias parep='pacaur -Si'
1498+ alias pareps='pacaur -Ss'
1499+ alias paloc='pacaur -Qi'
1500+ alias palocs='pacaur -Qs'
1501+ alias palst='pacaur -Qe'
1502+ alias paorph='pacaur -Qtd'
1503+ alias painsd='pacaur -S --asdeps'
1504+ alias pamir='pacaur -Syy'
1505+
1506+ if (( $+commands[abs] && $+commands[aur] )); then
1507+ alias paupd='pacaur -Sy && sudo abs && sudo aur'
1508+ elif (( $+commands[abs] )); then
1509+ alias paupd='pacaur -Sy && sudo abs'
1510+ elif (( $+commands[aur] )); then
1511+ alias paupd='pacaur -Sy && sudo aur'
1512+ else
1513+ alias paupd='pacaur -Sy'
1514+ fi
1515diff --git a/plugins/asdf/asdf.plugin.zsh b/plugins/asdf/asdf.plugin.zsh
1516index 8736d2ff8363cc77227ea70ec121e94b7612b7ee..38b2255383ef00ad7dd8ea0396b1c669fc229451 100644
1517--- a/plugins/asdf/asdf.plugin.zsh
1518+++ b/plugins/asdf/asdf.plugin.zsh
1519@@ -1,7 +1,19 @@
1520-# Find where asdf should be installed.
1521+# Find where asdf should be installed
1522 ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}"
1523+ASDF_COMPLETIONS="$ASDF_DIR/completions"
1524
1525-# Load asdf, if found.
1526-if [ -f $ASDF_DIR/asdf.sh ]; then
1527- . $ASDF_DIR/asdf.sh
1528+# If not found, check for Homebrew package
1529+if [[ ! -f "$ASDF_DIR/asdf.sh" ]] && (( $+commands[brew] )); then
1530+ ASDF_DIR="$(brew --prefix asdf)"
1531+ ASDF_COMPLETIONS="$ASDF_DIR/etc/bash_completion.d"
1532+fi
1533+
1534+# Load command
1535+if [[ -f "$ASDF_DIR/asdf.sh" ]]; then
1536+ . "$ASDF_DIR/asdf.sh"
1537+
1538+ # Load completions
1539+ if [[ -f "$ASDF_COMPLETIONS/asdf.bash" ]]; then
1540+ . "$ASDF_COMPLETIONS/asdf.bash"
1541+ fi
1542 fi
1543diff --git a/plugins/autoenv/README.md b/plugins/autoenv/README.md
1544new file mode 100644
1545index 0000000000000000000000000000000000000000..de3881774f3f3f4d292a5950600d4a2a73132491
1546--- /dev/null
1547+++ b/plugins/autoenv/README.md
1548@@ -0,0 +1,14 @@
1549+# Autoenv plugin
1550+
1551+This plugin loads the [Autoenv](https://github.com/inishchith/autoenv).
1552+
1553+To use it, add `autoenv` to the plugins array in your zshrc file:
1554+
1555+```zsh
1556+plugins=(... autoenv)
1557+```
1558+## Requirements
1559+
1560+In order to make this work, you will need to have the autoenv installed.
1561+
1562+More info on the usage and install: https://github.com/inishchith/autoenv
1563diff --git a/plugins/autoenv/autoenv.plugin.zsh b/plugins/autoenv/autoenv.plugin.zsh
1564index ea2e56dd6149d748ae65791fd2618921e6c7cf19..3c1b0fafce8d6471886c1324a52859576e0c4623 100644
1565--- a/plugins/autoenv/autoenv.plugin.zsh
1566+++ b/plugins/autoenv/autoenv.plugin.zsh
1567@@ -1,7 +1,7 @@
1568 # Activates autoenv or reports its failure
1569 () {
1570 if ! type autoenv_init >/dev/null; then
1571- for d (~/.autoenv /usr/local/opt/autoenv); do
1572+ for d (~/.autoenv ~/.local/bin /usr/local/opt/autoenv /usr/local/bin); do
1573 if [[ -e $d/activate.sh ]]; then
1574 autoenv_dir=$d
1575 break
1576diff --git a/plugins/autojump/README.md b/plugins/autojump/README.md
1577new file mode 100644
1578index 0000000000000000000000000000000000000000..18ff793cdc45dae57752bb63c2b2a35372f3d57b
1579--- /dev/null
1580+++ b/plugins/autojump/README.md
1581@@ -0,0 +1,11 @@
1582+# Autojump plugin
1583+
1584+This plugin loads the [autojump navigation tool](https://github.com/wting/autojump).
1585+
1586+To use it, add `autojump` to the plugins array in your zshrc file:
1587+
1588+```zsh
1589+plugins=(... autojump)
1590+```
1591+
1592+More info on the usage: https://github.com/wting/autojump
1593diff --git a/plugins/autojump/autojump.plugin.zsh b/plugins/autojump/autojump.plugin.zsh
1594index c05c699e106b56ec04278d4cd84d7a4176fd9c35..d80c88822155d0dc8fcc68c1c0ee269f18e664e4 100644
1595--- a/plugins/autojump/autojump.plugin.zsh
1596+++ b/plugins/autojump/autojump.plugin.zsh
1597@@ -1,21 +1,34 @@
1598-if [ $commands[autojump] ]; then # check if autojump is installed
1599- if [ -f $HOME/.autojump/etc/profile.d/autojump.zsh ]; then # manual user-local installation
1600- . $HOME/.autojump/etc/profile.d/autojump.zsh
1601- elif [ -f $HOME/.autojump/share/autojump/autojump.zsh ]; then # another manual user-local installation
1602- . $HOME/.autojump/share/autojump/autojump.zsh
1603- elif [ -f $HOME/.nix-profile/etc/profile.d/autojump.zsh ]; then # nix installation
1604- . $HOME/.nix-profile/etc/profile.d/autojump.zsh
1605- elif [ -f /usr/share/autojump/autojump.zsh ]; then # debian and ubuntu package
1606- . /usr/share/autojump/autojump.zsh
1607- elif [ -f /etc/profile.d/autojump.zsh ]; then # manual installation
1608- . /etc/profile.d/autojump.zsh
1609- elif [ -f /etc/profile.d/autojump.sh ]; then # gentoo installation
1610- . /etc/profile.d/autojump.sh
1611- elif [ -f /usr/local/share/autojump/autojump.zsh ]; then # freebsd installation
1612- . /usr/local/share/autojump/autojump.zsh
1613- elif [ -f /opt/local/etc/profile.d/autojump.zsh ]; then # mac os x with ports
1614- . /opt/local/etc/profile.d/autojump.zsh
1615- elif [ $commands[brew] -a -f `brew --prefix`/etc/autojump.sh ]; then # mac os x with brew
1616- . `brew --prefix`/etc/autojump.sh
1617+declare -a autojump_paths
1618+autojump_paths=(
1619+ $HOME/.autojump/etc/profile.d/autojump.zsh # manual installation
1620+ $HOME/.autojump/share/autojump/autojump.zsh # manual installation
1621+ $HOME/.nix-profile/etc/profile.d/autojump.sh # NixOS installation
1622+ /run/current-system/sw/share/autojump/autojump.zsh # NixOS installation
1623+ /usr/share/autojump/autojump.zsh # Debian and Ubuntu package
1624+ /etc/profile.d/autojump.zsh # manual installation
1625+ /etc/profile.d/autojump.sh # Gentoo installation
1626+ /usr/local/share/autojump/autojump.zsh # FreeBSD installation
1627+ /opt/local/etc/profile.d/autojump.sh # macOS with MacPorts
1628+ /usr/local/etc/profile.d/autojump.sh # macOS with Homebrew (default)
1629+)
1630+
1631+for file in $autojump_paths; do
1632+ if [[ -f "$file" ]]; then
1633+ source "$file"
1634+ found=1
1635+ break
1636+ fi
1637+done
1638+
1639+# if no path found, try Homebrew
1640+if (( ! found && $+commands[brew] )); then
1641+ file=$(brew --prefix)/etc/profile.d/autojump.sh
1642+ if [[ -f "$file" ]]; then
1643+ source "$file"
1644+ found=1
1645 fi
1646 fi
1647+
1648+(( ! found )) && echo '[oh-my-zsh] autojump script not found'
1649+
1650+unset autojump_paths file found
1651diff --git a/plugins/autopep8/README.md b/plugins/autopep8/README.md
1652new file mode 100644
1653index 0000000000000000000000000000000000000000..02bbb9af4860d67bc09f4c33f221970708e06913
1654--- /dev/null
1655+++ b/plugins/autopep8/README.md
1656@@ -0,0 +1,8 @@
1657+# autopep8 plugin
1658+
1659+This plugin adds completion for [autopep8](https://pypi.org/project/autopep8/), a tool that automatically formats Python code to conform to the [PEP 8](http://www.python.org/dev/peps/pep-0008/) style guide.
1660+
1661+To use it, add autopep8 to the plugins array of your zshrc file:
1662+```
1663+plugins=(... autopep8)
1664+```
1665diff --git a/plugins/autopep8/autopep8.plugin.zsh b/plugins/autopep8/autopep8.plugin.zsh
1666deleted file mode 100644
1667index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000
1668--- a/plugins/autopep8/autopep8.plugin.zsh
1669+++ /dev/null
1670diff --git a/plugins/aws/README.md b/plugins/aws/README.md
1671new file mode 100644
1672index 0000000000000000000000000000000000000000..57c3b54acddf726fb7c7790f1855ac5403a21a85
1673--- /dev/null
1674+++ b/plugins/aws/README.md
1675@@ -0,0 +1,38 @@
1676+# aws
1677+
1678+This plugin provides completion support for [awscli](https://docs.aws.amazon.com/cli/latest/reference/index.html)
1679+and a few utilities to manage AWS profiles and display them in the prompt.
1680+
1681+To use it, add `aws` to the plugins array in your zshrc file.
1682+
1683+```zsh
1684+plugins=(... aws)
1685+```
1686+
1687+## Plugin commands
1688+
1689+* `asp [<profile>]`: sets `$AWS_PROFILE` and `$AWS_DEFAULT_PROFILE` (legacy) to `<profile>`.
1690+ It also sets `$AWS_EB_PROFILE` to `<profile>` for the Elastic Beanstalk CLI.
1691+ Run `asp` without arguments to clear the profile.
1692+
1693+* `agp`: gets the current value of `$AWS_PROFILE`.
1694+
1695+* `aws_change_access_key`: changes the AWS access key of a profile.
1696+
1697+* `aws_profiles`: lists the available profiles in the `$AWS_CONFIG_FILE` (default: `~/.aws/config`).
1698+ Used to provide completion for the `asp` function.
1699+
1700+## Plugin options
1701+
1702+* Set `SHOW_AWS_PROMPT=false` in your zshrc file if you want to prevent the plugin from modifying your RPROMPT.
1703+ Some themes might overwrite the value of RPROMPT instead of appending to it, so they'll need to be fixed to
1704+ see the AWS profile prompt.
1705+
1706+## Theme
1707+
1708+The plugin creates an `aws_prompt_info` function that you can use in your theme, which displays
1709+the current `$AWS_PROFILE`. It uses two variables to control how that is shown:
1710+
1711+- ZSH_THEME_AWS_PREFIX: sets the prefix of the AWS_PROFILE. Defaults to `<aws:`.
1712+
1713+- ZSH_THEME_AWS_SUFFIX: sets the suffix of the AWS_PROFILE. Defaults to `>`.
1714diff --git a/plugins/aws/aws.plugin.zsh b/plugins/aws/aws.plugin.zsh
1715index d31052f8300082f0d7ed5a47e59a2cf1454288d0..231ac5ad26dcfb9f861a48c03349b4cda536155a 100644
1716--- a/plugins/aws/aws.plugin.zsh
1717+++ b/plugins/aws/aws.plugin.zsh
1718@@ -1,37 +1,96 @@
1719-_homebrew-installed() {
1720- type brew &> /dev/null
1721+function agp() {
1722+ echo $AWS_PROFILE
1723 }
1724
1725-_awscli-homebrew-installed() {
1726- brew list awscli &> /dev/null
1727+# AWS profile selection
1728+function asp() {
1729+ if [[ -z "$1" ]]; then
1730+ unset AWS_DEFAULT_PROFILE AWS_PROFILE AWS_EB_PROFILE
1731+ echo AWS profile cleared.
1732+ return
1733+ fi
1734+
1735+ local available_profiles=($(aws_profiles))
1736+ if [[ -z "${available_profiles[(r)$1]}" ]]; then
1737+ echo "${fg[red]}Profile '$1' not found in '${AWS_CONFIG_FILE:-$HOME/.aws/config}'" >&2
1738+ echo "Available profiles: ${(j:, :)available_profiles:-no profiles found}${reset_color}" >&2
1739+ return 1
1740+ fi
1741+
1742+ export AWS_DEFAULT_PROFILE=$1
1743+ export AWS_PROFILE=$1
1744+ export AWS_EB_PROFILE=$1
1745 }
1746
1747-export AWS_HOME=~/.aws
1748+function aws_change_access_key() {
1749+ if [[ -z "$1" ]]; then
1750+ echo "usage: $0 <profile>"
1751+ return 1
1752+ fi
1753
1754-function agp {
1755- echo $AWS_DEFAULT_PROFILE
1756+ echo Insert the credentials when asked.
1757+ asp "$1" || return 1
1758+ aws iam create-access-key
1759+ aws configure --profile "$1"
1760+
1761+ echo You can now safely delete the old access key running \`aws iam delete-access-key --access-key-id ID\`
1762+ echo Your current keys are:
1763+ aws iam list-access-keys
1764 }
1765
1766-function asp {
1767- local rprompt=${RPROMPT/<aws:$(agp)>/}
1768+function aws_profiles() {
1769+ [[ -r "${AWS_CONFIG_FILE:-$HOME/.aws/config}" ]] || return 1
1770+ grep '\[profile' "${AWS_CONFIG_FILE:-$HOME/.aws/config}"|sed -e 's/.*profile \([a-zA-Z0-9_\.-]*\).*/\1/'
1771+}
1772
1773- export AWS_DEFAULT_PROFILE=$1
1774- export AWS_PROFILE=$1
1775+function _aws_profiles() {
1776+ reply=($(aws_profiles))
1777+}
1778+compctl -K _aws_profiles asp aws_change_access_key
1779
1780- export RPROMPT="<aws:$AWS_DEFAULT_PROFILE>$rprompt"
1781+# AWS prompt
1782+function aws_prompt_info() {
1783+ [[ -z $AWS_PROFILE ]] && return
1784+ echo "${ZSH_THEME_AWS_PREFIX:=<aws:}${AWS_PROFILE}${ZSH_THEME_AWS_SUFFIX:=>}"
1785 }
1786
1787-function aws_profiles {
1788- reply=($(grep profile $AWS_HOME/config|sed -e 's/.*profile \([a-zA-Z0-9_-]*\).*/\1/'))
1789+if [ "$SHOW_AWS_PROMPT" != false ]; then
1790+ RPROMPT='$(aws_prompt_info)'"$RPROMPT"
1791+fi
1792+
1793+
1794+# Load awscli completions
1795+
1796+function _awscli-homebrew-installed() {
1797+ # check if Homebrew is installed
1798+ (( $+commands[brew] )) || return 1
1799+
1800+ # speculatively check default brew prefix
1801+ if [ -h /usr/local/opt/awscli ]; then
1802+ _brew_prefix=/usr/local/opt/awscli
1803+ else
1804+ # ok, it is not in the default prefix
1805+ # this call to brew is expensive (about 400 ms), so at least let's make it only once
1806+ _brew_prefix=$(brew --prefix awscli)
1807+ fi
1808 }
1809
1810-compctl -K aws_profiles asp
1811+# get aws_zsh_completer.sh location from $PATH
1812+_aws_zsh_completer_path="$commands[aws_zsh_completer.sh]"
1813
1814-if _homebrew-installed && _awscli-homebrew-installed ; then
1815- _aws_zsh_completer_path=$(brew --prefix awscli)/libexec/bin/aws_zsh_completer.sh
1816-else
1817- _aws_zsh_completer_path=$(which aws_zsh_completer.sh)
1818diff --git a/plugins/battery/README.md b/plugins/battery/README.md
1819new file mode 100644
1820index 0000000000000000000000000000000000000000..b7a13a7ecc2ac6aa79c1492d2d6e2cda8237155a
1821--- /dev/null
1822+++ b/plugins/battery/README.md
1823@@ -0,0 +1,13 @@
1824+# Battery Plugin
1825+
1826+This plugin adds some functions you can use to display battery information in your custom theme.
1827+
1828+To use, add `battery` to the list of plugins in your `.zshrc` file:
1829+
1830+`plugins=(... battery)`
1831+
1832+Then, add the `battery_pct_prompt` function to your custom theme. For example:
1833+
1834+```
1835+RPROMPT='$(battery_pct_prompt)'
1836+```
1837diff --git a/plugins/battery/battery.plugin.zsh b/plugins/battery/battery.plugin.zsh
1838index 0bb9e77f09174d8b08da465229157089dc00962b..6b668471606f9ac8248f0898815a45deb37ba927 100644
1839--- a/plugins/battery/battery.plugin.zsh
1840+++ b/plugins/battery/battery.plugin.zsh
1841@@ -7,6 +7,9 @@
1842 # Email: neuralsandwich@gmail.com #
1843 # Modified to add support for Apple Mac #
1844 ###########################################
1845+# Author: J (927589452) #
1846+# Modified to add support for FreeBSD #
1847+###########################################
1848
1849 if [[ "$OSTYPE" = darwin* ]] ; then
1850
1851@@ -64,7 +67,53 @@ if [[ "$OSTYPE" = darwin* ]] ; then
1852 [[ $(ioreg -rc "AppleSmartBattery"| grep '^.*"IsCharging"\ =\ ' | sed -e 's/^.*"IsCharging"\ =\ //') == "Yes" ]]
1853 }
1854
1855-elif [[ $(uname) == "Linux" ]] ; then
1856+elif [[ "$OSTYPE" = freebsd* ]] ; then
1857+
1858+ function battery_is_charging() {
1859+ [[ $(sysctl -n hw.acpi.battery.state) -eq 2 ]]
1860+ }
1861+
1862+ function battery_pct() {
1863+ if (( $+commands[sysctl] )) ; then
1864+ echo "$(sysctl -n hw.acpi.battery.life)"
1865+ fi
1866+ }
1867+
1868+ function battery_pct_remaining() {
1869+ if [ ! $(battery_is_charging) ] ; then
1870+ battery_pct
1871+ else
1872+ echo "External Power"
1873+ fi
1874+ }
1875+
1876+ function battery_time_remaining() {
1877+ remaining_time=$(sysctl -n hw.acpi.battery.time)
1878+ if [[ $remaining_time -ge 0 ]] ; then
1879+ # calculation from https://www.unix.com/shell-programming-and-scripting/23695-convert-minutes-hours-minutes-seconds.html
1880+ ((hour=$remaining_time/60))
1881+ ((minute=$remaining_time-$hour*60))
1882+ echo $hour:$minute
1883+ fi
1884+ }
1885+
1886+ function battery_pct_prompt() {
1887+ b=$(battery_pct_remaining)
1888+ if [ ! $(battery_is_charging) ] ; then
1889+ if [ $b -gt 50 ] ; then
1890+ color='green'
1891+ elif [ $b -gt 20 ] ; then
1892+ color='yellow'
1893+ else
1894+ color='red'
1895+ fi
1896+ echo "%{$fg[$color]%}$(battery_pct_remaining)%%%{$reset_color%}"
1897+ else
1898+ echo "∞"
1899+ fi
1900+ }
1901+
1902+elif [[ "$OSTYPE" = linux* ]] ; then
1903
1904 function battery_is_charging() {
1905 ! [[ $(acpi 2>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]]
1906@@ -100,7 +149,7 @@ elif [[ $(uname) == "Linux" ]] ; then
1907 else
1908 color='red'
1909 fi
1910- echo "%{$fg[$color]%}[$(battery_pct_remaining)%%]%{$reset_color%}"
1911+ echo "%{$fg[$color]%}$(battery_pct_remaining)%%%{$reset_color%}"
1912 else
1913 echo "∞"
1914 fi
1915diff --git a/plugins/bbedit/README.md b/plugins/bbedit/README.md
1916index ec2b743d6a29bebc1bb5bec6d195ed90d0f74ccf..263c54c47bd0d4872ab282a5c2deac08c201eafc 100644
1917--- a/plugins/bbedit/README.md
1918+++ b/plugins/bbedit/README.md
1919@@ -1,11 +1,11 @@
1920 ## bbedit
1921
1922-Plugin for BBEdit, an HTML and text editor for Mac OS X
1923+Plugin for BBEdit, an HTML and text editor for Mac OS X
1924
1925 ### Requirements
1926
1927- * [BBEdit](http://www.barebones.com/products/bbedit/)
1928- * [BBEdit Command-Line Tools](http://www.barebones.com/support/bbedit/cmd-line-tools.html)
1929+ * [BBEdit](https://www.barebones.com/products/bbedit/)
1930+ * [BBEdit Command-Line Tools](https://www.barebones.com/support/bbedit/cmd-line-tools.html)
1931
1932 ### Usage
1933
1934diff --git a/plugins/bgnotify/README.md b/plugins/bgnotify/README.md
1935index b154916d61f2d0b2b1d1f1cb63e93fb69066e6c9..1d8fac54d03e77b8d33fba6f15635186e97ab391 100644
1936--- a/plugins/bgnotify/README.md
1937+++ b/plugins/bgnotify/README.md
1938@@ -10,10 +10,10 @@ Standalone homepage: [t413/zsh-background-notify](https://github.com/t413/zsh-ba
1939
1940 Just add bgnotify to your plugins list in your `.zshrc`
1941
1942-- On OS X you'll need [terminal-notifer](https://github.com/alloy/terminal-notifier)
1943+- On OS X you'll need [terminal-notifier](https://github.com/alloy/terminal-notifier)
1944 * `brew install terminal-notifier` (or `gem install terminal-notifier`)
1945 - On ubuntu you're already all set!
1946-- On windows you can use [notifu](http://www.paralint.com/projects/notifu/) or the Cygwin Ports libnotify package
1947+- On windows you can use [notifu](https://www.paralint.com/projects/notifu/) or the Cygwin Ports libnotify package
1948
1949
1950 ## Screenshots
1951diff --git a/plugins/bgnotify/bgnotify.plugin.zsh b/plugins/bgnotify/bgnotify.plugin.zsh
1952old mode 100755
1953new mode 100644
1954index 459f5214e62c07d62d65dbd98901ea2c4dc82bcc..b3a6890b8f3aa7fd4ffa9bac49d0e36b5b1f2c1a
1955--- a/plugins/bgnotify/bgnotify.plugin.zsh
1956+++ b/plugins/bgnotify/bgnotify.plugin.zsh
1957@@ -42,7 +42,7 @@ bgnotify () { ## args: (title, subtitle)
1958 elif hash notify-send 2>/dev/null; then #ubuntu gnome!
1959 notify-send "$1" "$2"
1960 elif hash kdialog 2>/dev/null; then #ubuntu kde!
1961- kdialog -title "$1" --passivepopup "$2" 5
1962+ kdialog --title "$1" --passivepopup "$2" 5
1963 elif hash notifu 2>/dev/null; then #cygwyn support!
1964 notifu /m "$2" /p "$1"
1965 fi
1966diff --git a/plugins/bower/README.md b/plugins/bower/README.md
1967new file mode 100644
1968index 0000000000000000000000000000000000000000..743b6a0ea9e451f082d4d79c40f41054896d7f66
1969--- /dev/null
1970+++ b/plugins/bower/README.md
1971@@ -0,0 +1,18 @@
1972+# Bower plugin
1973+
1974+This plugin adds completion for [Bower](https://bower.io/) and a few useful aliases for common Bower commands.
1975+
1976+To use it, add `bower` to the plugins array in your zshrc file:
1977+
1978+```
1979+plugins=(... bower)
1980+```
1981+
1982+## Aliases
1983+
1984+| Alias | Command | Description |
1985+|-------|-----------------|--------------------------------------------------------|
1986+| bi | `bower install` | Installs the project dependencies listed in bower.json |
1987+| bl | `bower list` | List local packages and possible updates |
1988+| bs | `bower search` | Finds all packages or a specific package. |
1989+
1990diff --git a/plugins/brew/README.md b/plugins/brew/README.md
1991new file mode 100644
1992index 0000000000000000000000000000000000000000..c129a7652fe45be10c1377c0a0c0728be123d5f1
1993--- /dev/null
1994+++ b/plugins/brew/README.md
1995@@ -0,0 +1,21 @@
1996+# brew plugin
1997+
1998+The plugin adds several aliases for common [brew](https://brew.sh) commands.
1999+
2000+To use it, add `brew` to the plugins array of your zshrc file:
2001+```
2002+plugins=(... brew)
2003+```
2004+
2005+## Aliases
2006+
2007+| Alias | Command | Description |
2008+|--------|----------------------|---------------|
2009+| brewp | `brew pin` | Pin a specified formulae, preventing them from being upgraded when issuing the brew upgrade <formulae> command. |
2010+| brews | `brew list -1` | List installed formulae, one entry per line, or the installed files for a given formulae. |
2011+| brewsp | `brew list --pinned` | Show the versions of pinned formulae, or only the specified (pinned) formulae if formulae are given. |
2012+| bubo | `brew update && brew outdated` | Fetch the newest version of Homebrew and all formulae, then list outdated formulae. |
2013+| bubc | `brew upgrade && brew cleanup` | Upgrade outdated, unpinned brews (with existing install options), then removes stale lock files and outdated downloads for formulae and casks, and removes old versions of installed formulae. |
2014+| bubu | `bubo && bubc` | Updates Homebrew, lists outdated formulae, upgrades oudated and unpinned formulae, and removes stale and outdated downloads and versions. |
2015+| bcubo | `brew update && brew cask outdated` | Fetch the newest version of Homebrew and all formulae, then list outdated casks. |
2016+| bcubc | `brew cask reinstall $(brew cask outdated) && brew cleanup` | Updates outdated casks, then runs cleanup. |
2017diff --git a/plugins/brew/brew.plugin.zsh b/plugins/brew/brew.plugin.zsh
2018index 5b5847328bb60cbb0ddc4991855b58fe4af05f96..cfbaa3480eec781f762b8d61ae90b9335be2e50e 100644
2019--- a/plugins/brew/brew.plugin.zsh
2020+++ b/plugins/brew/brew.plugin.zsh
2021@@ -1,4 +1,24 @@
2022+alias brewp='brew pin'
2023 alias brews='brew list -1'
2024+alias brewsp='brew list --pinned'
2025 alias bubo='brew update && brew outdated'
2026 alias bubc='brew upgrade && brew cleanup'
2027 alias bubu='bubo && bubc'
2028+alias bcubo='brew update && brew cask outdated'
2029+alias bcubc='brew cask reinstall $(brew cask outdated) && brew cleanup'
2030+
2031+if command mkdir "$ZSH_CACHE_DIR/.brew-completion-message" 2>/dev/null; then
2032+ print -P '%F{yellow}'Oh My Zsh brew plugin:
2033+ cat <<-'EOF'
2034+
2035+ With the advent of their 1.0 release, Homebrew has decided to bundle
2036+ the zsh completion as part of the brew installation, so we no longer
2037+ ship it with the brew plugin; now it only has brew aliases.
2038+
2039+ If you find that brew completion no longer works, make sure you have
2040+ your Homebrew installation fully up to date.
2041+
2042+ You will only see this message once.
2043+ EOF
2044+ print -P '%f'
2045+fi