diff options
54 files changed, 261 insertions, 142 deletions
diff --git a/.gitignore b/.gitignore index 87a79cdae..251c9dc9f 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ custom/ # temp files directories cache/ log/ +*.swp diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f575157c2..be67e93b0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -31,7 +31,7 @@ your problem. If you find one, comment on it so we can know there are more people experiencing it. -If not, look at the [Troubleshooting](https://github.com/robbyrussell/oh-my-zsh/wiki/Troubleshooting) +If not, look at the [Troubleshooting](https://github.com/ohmyzsh/ohmyzsh/wiki/Troubleshooting) page for instructions on how to gather data to better debug your problem. Then, you can go ahead and create an issue with as much detail as you can provide. @@ -62,7 +62,7 @@ maintainers) by mentioning their GitHub handle (starting with `@`) in your messa You should be familiar with the basics of [contributing on GitHub](https://help.github.com/articles/using-pull-requests) and have a fork -[properly set up](https://github.com/robbyrussell/oh-my-zsh/wiki/Contribution-Technical-Practices). +[properly set up](https://github.com/ohmyzsh/ohmyzsh/wiki/Contribution-Technical-Practices). You MUST always create PRs with _a dedicated branch_ based on the latest upstream tree. @@ -85,7 +85,7 @@ maintainers) by mentioning their GitHub handle (starting with `@`) in your messa ### You have an addition -Please [do not](https://github.com/robbyrussell/oh-my-zsh/wiki/Themes#dont-send-us-your-theme-for-now) +Please [do not](https://github.com/ohmyzsh/ohmyzsh/wiki/Themes#dont-send-us-your-theme-for-now) send themes for now. Please be so kind as to [search](#use-the-search-luke) for any pending, merged or rejected Pull Requests @@ -109,7 +109,7 @@ to help you check whether a similar contribution to yours already exists. Please before making any contribution, it avoids duplicates and eases maintenance. Trust me, that works 90% of the time. -You can also take a look at the [FAQ](https://github.com/robbyrussell/oh-my-zsh/wiki/FAQ) +You can also take a look at the [FAQ](https://github.com/ohmyzsh/ohmyzsh/wiki/FAQ) to be sure your contribution has not already come up. If all fails, your thing has probably not been reported yet, so you can go ahead @@ -121,5 +121,5 @@ and [create an issue](#reporting-issues) or [submit a PR](#submitting-pull-reque Very nice!! :) -Please have a look at the [Volunteer](https://github.com/robbyrussell/oh-my-zsh/wiki/Volunteers) +Please have a look at the [Volunteer](https://github.com/ohmyzsh/ohmyzsh/wiki/Volunteers) page for instructions on where to start and more. diff --git a/LICENSE.txt b/LICENSE.txt index eb9978a7a..7431907a6 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2009-2019 Robby Russell and contributors (https://github.com/robbyrussell/oh-my-zsh/contributors) +Copyright (c) 2009-2019 Robby Russell and contributors (https://github.com/ohmyzsh/ohmyzsh/contributors) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -2,6 +2,9 @@ <img src="https://s3.amazonaws.com/ohmyzsh/oh-my-zsh-logo.png" alt="Oh My Zsh"> </p> +[![Discord server](https://img.shields.io/discord/642496866407284746)](https://discord.gg/bpXWhnN) +[![Follow @ohmyzsh](https://img.shields.io/twitter/follow/ohmyzsh?label=Follow+@ohmyzsh&style=flat)](https://twitter.com/intent/follow?screen_name=ohmyzsh) + Oh My Zsh is an open source, community-driven framework for managing your [zsh](https://www.zsh.org/) configuration. Sounds boring. Let's try again. @@ -19,7 +22,7 @@ To learn more, visit [ohmyz.sh](https://ohmyz.sh) and follow [@ohmyzsh](https:// ### Prerequisites * A Unix-like operating system: macOS, Linux, BSD. On Windows: WSL is preferred, but cygwin or msys also mostly work. -* [Zsh](https://www.zsh.org) should be installed (v4.3.9 or more recent). If not pre-installed (run `zsh --version` to confirm), check the following instructions here: [Installing ZSH](https://github.com/robbyrussell/oh-my-zsh/wiki/Installing-ZSH) +* [Zsh](https://www.zsh.org) should be installed (v4.3.9 or more recent). If not pre-installed (run `zsh --version` to confirm), check the following instructions here: [Installing ZSH](https://github.com/ohmyzsh/ohmyzsh/wiki/Installing-ZSH) * `curl` or `wget` should be installed * `git` should be installed @@ -30,13 +33,13 @@ Oh My Zsh is installed by running one of the following commands in your terminal #### via curl ```shell -sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" +sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" ``` #### via wget ```shell -sh -c "$(wget -O- https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" +sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" ``` #### Manual inspection @@ -46,7 +49,7 @@ that by downloading the install script first, looking through it so everything l then running it: ```shell -curl -Lo install.sh https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh +curl -Lo install.sh https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh sh install.sh ``` @@ -54,7 +57,7 @@ sh install.sh ### Plugins -Oh My Zsh comes with a shitload of plugins to take advantage of. You can take a look in the [plugins](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins) directory and/or the [wiki](https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins) to see what's currently available. +Oh My Zsh comes with a shitload of plugins to take advantage of. You can take a look in the [plugins](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins) directory and/or the [wiki](https://github.com/ohmyzsh/ohmyzsh/wiki/Plugins) to see what's currently available. #### Enabling Plugins @@ -86,7 +89,7 @@ Most plugins (should! we're working on this) include a __README__, which documen ### Themes -We'll admit it. Early in the Oh My Zsh world, we may have gotten a bit too theme happy. We have over one hundred themes now bundled. Most of them have [screenshots](https://github.com/robbyrussell/oh-my-zsh/wiki/Themes) on the wiki. Check them out! +We'll admit it. Early in the Oh My Zsh world, we may have gotten a bit too theme happy. We have over one hundred themes now bundled. Most of them have [screenshots](https://github.com/ohmyzsh/ohmyzsh/wiki/Themes) on the wiki. Check them out! #### Selecting a Theme @@ -102,7 +105,7 @@ To use a different theme, simply change the value to match the name of your desi ```shell ZSH_THEME="agnoster" # (this is one of the fancy ones) -# see https://github.com/robbyrussell/oh-my-zsh/wiki/Themes#agnoster +# see https://github.com/ohmyzsh/ohmyzsh/wiki/Themes#agnoster ``` _Note: many themes require installing the [Powerline Fonts](https://github.com/powerline/fonts) in order to render properly._ @@ -111,7 +114,7 @@ Open up a new terminal window and your prompt should look something like this: ![Agnoster theme](https://cloud.githubusercontent.com/assets/2618447/6316862/70f58fb6-ba03-11e4-82c9-c083bf9a6574.png) -In case you did not find a suitable theme for your needs, please have a look at the wiki for [more of them](https://github.com/robbyrussell/oh-my-zsh/wiki/External-themes). +In case you did not find a suitable theme for your needs, please have a look at the wiki for [more of them](https://github.com/ohmyzsh/ohmyzsh/wiki/External-themes). If you're feeling feisty, you can let the computer select one randomly for you each time you open a new terminal window. @@ -157,14 +160,14 @@ flag `--unattended` to the `install.sh` script. This will have the effect of not the default shell, and also won't run `zsh` when the installation has finished. ```shell -sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" "" --unattended +sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended ``` #### Installing from a forked repository The install script also accepts these variables to allow installation of a different repository: -- `REPO` (default: `robbyrussell/oh-my-zsh`): this takes the form of `owner/repository`. If you set +- `REPO` (default: `ohmyzsh/ohmyzsh`): this takes the form of `owner/repository`. If you set this variable, the installer will look for a repository at `https://github.com/{owner}/{repository}`. - `REMOTE` (default: `https://github.com/${REPO}.git`): this is the full URL of the git repository @@ -188,7 +191,7 @@ REPO=apjanke/oh-my-zsh BRANCH=edge sh install.sh ##### 1. Clone the repository: ```shell -git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh +git clone https://github.com/ohmyzsh/ohmyzsh.git ~/.oh-my-zsh ``` ##### 2. *Optionally*, backup your existing `~/.zshrc` file: @@ -270,13 +273,13 @@ Before you participate in our delightful community, please read the [code of con I'm far from being a [Zsh](https://www.zsh.org/) expert and suspect there are many ways to improve – if you have ideas on how to make the configuration easier to maintain (and faster), don't hesitate to fork and send pull requests! -We also need people to test out pull-requests. So take a look through [the open issues](https://github.com/robbyrussell/oh-my-zsh/issues) and help where you can. +We also need people to test out pull-requests. So take a look through [the open issues](https://github.com/ohmyzsh/ohmyzsh/issues) and help where you can. See [Contributing](CONTRIBUTING.md) for more details. ### Do NOT send us themes -We have (more than) enough themes for the time being. Please add your theme to the [external themes](https://github.com/robbyrussell/oh-my-zsh/wiki/External-themes) wiki page. +We have (more than) enough themes for the time being. Please add your theme to the [external themes](https://github.com/ohmyzsh/ohmyzsh/wiki/External-themes) wiki page. ## Contributors diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index aa14f3f07..f5e367fcb 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -75,8 +75,9 @@ function omz_termsupport_preexec { title '$CMD' '%100>...>$LINE%<<' } -precmd_functions+=(omz_termsupport_precmd) -preexec_functions+=(omz_termsupport_preexec) +autoload -U add-zsh-hook +add-zsh-hook precmd omz_termsupport_precmd +add-zsh-hook preexec omz_termsupport_preexec # Keep Apple Terminal.app's current working directory updated @@ -99,7 +100,7 @@ if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then } # Use a precmd hook instead of a chpwd hook to avoid contaminating output - precmd_functions+=(update_terminalapp_cwd) + add-zsh-hook precmd update_terminalapp_cwd # Run once to get initial cwd set update_terminalapp_cwd fi diff --git a/plugins/alias-finder/alias-finder.plugin.zsh b/plugins/alias-finder/alias-finder.plugin.zsh index 6b8fa66ce..caee9b5a3 100644 --- a/plugins/alias-finder/alias-finder.plugin.zsh +++ b/plugins/alias-finder/alias-finder.plugin.zsh @@ -4,7 +4,7 @@ alias-finder() { case $i in -e|--exact) exact=true;; -l|--longer) longer=true;; - *) + *) if [[ -z $cmd ]]; then cmd=$i else @@ -43,4 +43,5 @@ preexec_alias-finder() { fi } -preexec_functions+=(preexec_alias-finder) +autoload -U add-zsh-hook +add-zsh-hook preexec preexec_alias-finder diff --git a/plugins/bundler/README.md b/plugins/bundler/README.md index a7d40cd0a..9f211b02f 100644 --- a/plugins/bundler/README.md +++ b/plugins/bundler/README.md @@ -42,7 +42,7 @@ This will exclude the `foreman` and `spin` gems (i.e. their executable) from bei ## Excluded gems -These gems should not be called with `bundle exec`. Please see [issue #2923](https://github.com/robbyrussell/oh-my-zsh/pull/2923) on GitHub for clarification. +These gems should not be called with `bundle exec`. Please see [issue #2923](https://github.com/ohmyzsh/ohmyzsh/pull/2923) on GitHub for clarification. `berks` `foreman` diff --git a/plugins/catimg/README.md b/plugins/catimg/README.md index 2fc28a1c6..42b59a62c 100644 --- a/plugins/catimg/README.md +++ b/plugins/catimg/README.md @@ -17,10 +17,10 @@ Plugin for displaying images on the terminal using the the `catimg.sh` script pr ) ``` -2. Reload the source file or restart your Terminal session: +2. Restart the shell or restart your Terminal session: ```console - $ source ~/.zshrc + $ exec zsh $ ``` diff --git a/plugins/colorize/README.md b/plugins/colorize/README.md index 38d17dc76..8971fa011 100644 --- a/plugins/colorize/README.md +++ b/plugins/colorize/README.md @@ -43,6 +43,6 @@ In the latter form, the file contents will be concatenated and presented by less ## Requirements -You have to either install Pygments: [pygments.org](http://pygments.org/download/) +You have to either install Pygments: [pygments.org](http://pygments.org/download.html) -Or install chroma: [https://github.com/alecthomas/chroma](https://github.com/alecthomas/chroma)
\ No newline at end of file +Or install chroma: [https://github.com/alecthomas/chroma](https://github.com/alecthomas/chroma) diff --git a/plugins/dircycle/README.md b/plugins/dircycle/README.md index 3ac162f05..3c9b3a96f 100644 --- a/plugins/dircycle/README.md +++ b/plugins/dircycle/README.md @@ -15,10 +15,10 @@ This plugin enables directory navigation similar to using back and forward on br ) ``` -2. Reload the source file or restart your Terminal session: +2. Restart the shell or restart your Terminal session: ```console - $ source ~/.zshrc + $ exec zsh $ ``` diff --git a/plugins/dirhistory/dirhistory.plugin.zsh b/plugins/dirhistory/dirhistory.plugin.zsh index 239915e48..35c43d76a 100644 --- a/plugins/dirhistory/dirhistory.plugin.zsh +++ b/plugins/dirhistory/dirhistory.plugin.zsh @@ -53,7 +53,8 @@ function push_future() { } # Called by zsh when directory changes -chpwd_functions+=(chpwd_dirhistory) +autoload -U add-zsh-hook +add-zsh-hook chpwd chpwd_dirhistory function chpwd_dirhistory() { push_past $PWD # If DIRHISTORY_CD is not set... diff --git a/plugins/dirpersist/dirpersist.plugin.zsh b/plugins/dirpersist/dirpersist.plugin.zsh index 616e2c3c6..daadc3850 100644 --- a/plugins/dirpersist/dirpersist.plugin.zsh +++ b/plugins/dirpersist/dirpersist.plugin.zsh @@ -11,7 +11,8 @@ if [[ -f ${dirstack_file} ]] && [[ ${#dirstack[*]} -eq 0 ]] ; then [[ -d $dirstack[1] ]] && cd $dirstack[1] && cd $OLDPWD fi -chpwd_functions+=(chpwd_dirpersist) +autoload -U add-zsh-hook +add-zsh-hook chpwd chpwd_dirpersist chpwd_dirpersist() { if (( $DIRSTACKSIZE <= 0 )) || [[ -z $dirstack_file ]]; then return; fi local -ax my_stack diff --git a/plugins/django/django.plugin.zsh b/plugins/django/django.plugin.zsh index 86558ff2e..c2d00c171 100644 --- a/plugins/django/django.plugin.zsh +++ b/plugins/django/django.plugin.zsh @@ -374,7 +374,8 @@ _managepy-commands() { _applist() { local line local -a apps - _call_program help-command "python -c \"import os.path as op, re, django.conf, sys;\\ + _call_program help-command "python -c \"import sys; del sys.path[0];\\ + import os.path as op, re, django.conf;\\ bn=op.basename(op.abspath(op.curdir));[sys\\ .stdout.write(str(re.sub(r'^%s\.(.*?)$' % bn, r'\1', i)) + '\n') for i in django.conf.settings.\\ diff --git a/plugins/emotty/README.md b/plugins/emotty/README.md index 2cfbe120c..ee571705a 100644 --- a/plugins/emotty/README.md +++ b/plugins/emotty/README.md @@ -8,7 +8,7 @@ To use it, add emotty to the plugins array in your zshrc file: plugins=(... emotty) ``` -**NOTE:** it requires the [emoji plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/emoji). +**NOTE:** it requires the [emoji plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/emoji). ## Usage diff --git a/plugins/encode64/README.md b/plugins/encode64/README.md index 9850da85f..66fc7cba4 100644 --- a/plugins/encode64/README.md +++ b/plugins/encode64/README.md @@ -20,10 +20,10 @@ Alias plugin for encoding or decoding using `base64` command ) ``` -2. Restart your terminal session or reload configuration by running: +2. Restart your terminal session or restart the shell: ```sh - source ~/.zshrc + exec zsh ``` ## Usage and examples diff --git a/plugins/extract/README.md b/plugins/extract/README.md index 83b878c32..41b6a61f1 100644 --- a/plugins/extract/README.md +++ b/plugins/extract/README.md @@ -27,6 +27,7 @@ plugins=(... extract) | `jar` | Java Archive | | `lzma` | LZMA archive | | `rar` | WinRAR archive | +| `rpm` | RPM package | | `sublime-package` | Sublime Text package | | `tar` | Tarball | | `tar.bz2` | Tarball with bzip2 compression | diff --git a/plugins/extract/_extract b/plugins/extract/_extract index 33d49fcc5..0257ce231 100644 --- a/plugins/extract/_extract +++ b/plugins/extract/_extract @@ -3,5 +3,5 @@ _arguments \ '(-r --remove)'{-r,--remove}'[Remove archive.]' \ - "*::archive file:_files -g '(#i)*.(7z|Z|apk|aar|bz2|deb|gz|ipsw|jar|lzma|rar|sublime-package|tar|tar.bz2|tar.gz|tar.xz|tar.zma|tbz|tbz2|tgz|tlz|txz|war|whl|xpi|xz|zip)(-.)'" \ + "*::archive file:_files -g '(#i)*.(7z|Z|apk|aar|bz2|deb|gz|ipsw|jar|lzma|rar|rpm|sublime-package|tar|tar.bz2|tar.gz|tar.xz|tar.zma|tbz|tbz2|tgz|tlz|txz|war|whl|xpi|xz|zip)(-.)'" \ && return 0 diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh index d3d847daf..27b9e50f1 100644 --- a/plugins/extract/extract.plugin.zsh +++ b/plugins/extract/extract.plugin.zsh @@ -48,6 +48,7 @@ extract() { (*.z) uncompress "$1" ;; (*.zip|*.war|*.jar|*.sublime-package|*.ipsw|*.xpi|*.apk|*.aar|*.whl) unzip "$1" -d $extract_dir ;; (*.rar) unrar x -ad "$1" ;; + (*.rpm) mkdir "$extract_dir" && cd "$extract_dir" && rpm2cpio "../$1" | cpio --quiet -id && cd .. ;; (*.7z) 7za x "$1" ;; (*.deb) mkdir -p "$extract_dir/control" diff --git a/plugins/fedora/README.md b/plugins/fedora/README.md index 6594799b3..85d8d7dea 100644 --- a/plugins/fedora/README.md +++ b/plugins/fedora/README.md @@ -1 +1 @@ -The fedora plugin is deprecated. Use the [dnf plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/dnf) instead. +The fedora plugin is deprecated. Use the [dnf plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/dnf) instead. diff --git a/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh b/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh index 56ab86dbe..5c42c21a7 100644 --- a/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh +++ b/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh @@ -1,16 +1,17 @@ GIT_AUTO_FETCH_INTERVAL=${GIT_AUTO_FETCH_INTERVAL:=60} function git-fetch-all { - (`git rev-parse --is-inside-work-tree 2>/dev/null` && - dir=`git rev-parse --git-dir` && + (`command git rev-parse --is-inside-work-tree 2>/dev/null` && + dir=`command git rev-parse --git-dir` && [[ ! -f $dir/NO_AUTO_FETCH ]] && (( `date +%s` - `date -r $dir/FETCH_LOG +%s 2>/dev/null || echo 0` > $GIT_AUTO_FETCH_INTERVAL )) && - git fetch --all 2>/dev/null &>! $dir/FETCH_LOG &) + GIT_SSH_COMMAND="command ssh -o BatchMode=yes" \ + command git fetch --all 2>/dev/null &>! $dir/FETCH_LOG &) } function git-auto-fetch { - `git rev-parse --is-inside-work-tree 2>/dev/null` || return - guard="`git rev-parse --git-dir`/NO_AUTO_FETCH" + `command git rev-parse --is-inside-work-tree 2>/dev/null` || return + guard="`command git rev-parse --git-dir`/NO_AUTO_FETCH" (rm $guard 2>/dev/null && echo "${fg_bold[green]}enabled${reset_color}") || diff --git a/plugins/git-prompt/git-prompt.plugin.zsh b/plugins/git-prompt/git-prompt.plugin.zsh index 76ac2e62b..da674af98 100644 --- a/plugins/git-prompt/git-prompt.plugin.zsh +++ b/plugins/git-prompt/git-prompt.plugin.zsh @@ -20,9 +20,10 @@ function precmd_update_git_vars() { fi } -chpwd_functions+=(chpwd_update_git_vars) -precmd_functions+=(precmd_update_git_vars) -preexec_functions+=(preexec_update_git_vars) +autoload -U add-zsh-hook +add-zsh-hook chpwd chpwd_update_git_vars +add-zsh-hook precmd precmd_update_git_vars +add-zsh-hook preexec preexec_update_git_vars ## Function definitions diff --git a/plugins/gitfast/README.md b/plugins/gitfast/README.md index 84e35d77c..23db5393b 100644 --- a/plugins/gitfast/README.md +++ b/plugins/gitfast/README.md @@ -11,5 +11,5 @@ plugins=(... gitfast) ## Aliases An earlier version of the plugin also loaded the git plugin. If you want to keep those -aliases enable the [git plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/git) +aliases enable the [git plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/git) as well. diff --git a/plugins/go/README.md b/plugins/go/README.md index 6ce6f4ee2..bf43b9feb 100644 --- a/plugins/go/README.md +++ b/plugins/go/README.md @@ -1 +1 @@ -The go plugin is deprecated. Use the [golang plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/golang) instead. +The go plugin is deprecated. Use the [golang plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/golang) instead. diff --git a/plugins/history-substring-search/README.md b/plugins/history-substring-search/README.md index 7fb0fa0b6..0ffb21351 100644 --- a/plugins/history-substring-search/README.md +++ b/plugins/history-substring-search/README.md @@ -9,7 +9,7 @@ You can also use K and J in VI mode or ^P and ^N in EMACS mode for the same. [1]: https://fishshell.com [2]: https://www.zsh.org/mla/users/2009/msg00818.html [3]: https://sourceforge.net/projects/fizsh/ -[4]: https://github.com/robbyrussell/oh-my-zsh/pull/215 +[4]: https://github.com/ohmyzsh/ohmyzsh/pull/215 [5]: https://github.com/zsh-users/zsh-history-substring-search [6]: https://github.com/zsh-users/zsh-syntax-highlighting diff --git a/plugins/jenv/jenv.plugin.zsh b/plugins/jenv/jenv.plugin.zsh index 2eda8037b..b85906a0b 100644 --- a/plugins/jenv/jenv.plugin.zsh +++ b/plugins/jenv/jenv.plugin.zsh @@ -15,7 +15,7 @@ if [[ $FOUND_JENV -eq 0 ]]; then fi if [[ $FOUND_JENV -eq 1 ]]; then - export PATH="${jenvdir}/bin:$PATH" + (( $+commands[jenv] )) || export PATH="${jenvdir}/bin:$PATH" eval "$(jenv init - zsh)" function jenv_prompt_info() { jenv version-name 2>/dev/null } diff --git a/plugins/jsontools/jsontools.plugin.zsh b/plugins/jsontools/jsontools.plugin.zsh index 20d5eb1c9..912c83509 100644 --- a/plugins/jsontools/jsontools.plugin.zsh +++ b/plugins/jsontools/jsontools.plugin.zsh @@ -11,9 +11,10 @@ if [[ $(whence node) != "" && ( "x$JSONTOOLS_METHOD" = "x" || "x$JSONTOOLS_METH alias urlencode_json='xargs -0 node -e "console.log(encodeURIComponent(process.argv[1]))"' alias urldecode_json='xargs -0 node -e "console.log(decodeURIComponent(process.argv[1]))"' elif [[ $(whence python) != "" && ( "x$JSONTOOLS_METHOD" = "x" || "x$JSONTOOLS_METHOD" = "xpython" ) ]]; then - alias pp_json='python -mjson.tool' + alias pp_json='python -c "import sys; del sys.path[0]; import runpy; runpy._run_module_as_main(\"json.tool\")"' alias is_json='python -c " -import json, sys; +import sys; del sys.path[0]; +import json; try: json.loads(sys.stdin.read()) except ValueError, e: @@ -22,11 +23,13 @@ else: print True sys.exit(0)"' alias urlencode_json='python -c " -import urllib, json, sys; +import sys; del sys.path[0]; +import urllib, json; print urllib.quote_plus(sys.stdin.read()) sys.exit(0)"' alias urldecode_json='python -c " -import urllib, json, sys; +import sys; del sys.path[0]; +import urllib, json; print urllib.unquote_plus(sys.stdin.read()) sys.exit(0)"' elif [[ $(whence ruby) != "" && ( "x$JSONTOOLS_METHOD" = "x" || "x$JSONTOOLS_METHOD" = "xruby" ) ]]; then @@ -36,4 +39,4 @@ elif [[ $(whence ruby) != "" && ( "x$JSONTOOLS_METHOD" = "x" || "x$JSONTOOLS_MET alias urldecode_json='ruby -e "require \"uri\"; puts URI.unescape(STDIN.read)"' fi -unset JSONTOOLS_METHOD
\ No newline at end of file +unset JSONTOOLS_METHOD diff --git a/plugins/last-working-dir/last-working-dir.plugin.zsh b/plugins/last-working-dir/last-working-dir.plugin.zsh index 53bb19e46..fd21705ae 100644 --- a/plugins/last-working-dir/last-working-dir.plugin.zsh +++ b/plugins/last-working-dir/last-working-dir.plugin.zsh @@ -2,7 +2,8 @@ typeset -g ZSH_LAST_WORKING_DIRECTORY # Updates the last directory once directory is changed -chpwd_functions+=(chpwd_last_working_dir) +autoload -U add-zsh-hook +add-zsh-hook chpwd chpwd_last_working_dir chpwd_last_working_dir() { if [ "$ZSH_SUBSHELL" = 0 ]; then local cache_file="$ZSH_CACHE_DIR/last-working-dir" diff --git a/plugins/lol/README.md b/plugins/lol/README.md index b0e54f575..8fba7b713 100644 --- a/plugins/lol/README.md +++ b/plugins/lol/README.md @@ -13,10 +13,10 @@ Plugin for adding catspeak aliases, because why not ) ``` -2. Reload the source file or restart your Terminal session: +2. Restart your terminal session or restart the shell: ```console - $ source ~/.zshrc + $ exec zsh $ ``` diff --git a/plugins/lol/lol.plugin.zsh b/plugins/lol/lol.plugin.zsh index 585f96e4f..3c30259a1 100644 --- a/plugins/lol/lol.plugin.zsh +++ b/plugins/lol/lol.plugin.zsh @@ -45,7 +45,7 @@ alias bringz='git pull' alias chicken='git add' alias oanward='git commit -m' alias ooanward='git commit -am' -alias yolo='git commit -m "$(curl -s https://whatthecommit.com/index.txt)"' +alias yolo='git commit -m "$(curl -s http://whatthecommit.com/index.txt)"' alias letcat='git checkout' alias violenz='git rebase' diff --git a/plugins/meteor/README.md b/plugins/meteor/README.md index 4bee87f8f..187a45a62 100644 --- a/plugins/meteor/README.md +++ b/plugins/meteor/README.md @@ -1,6 +1,6 @@ ## Introduction -The [meteor plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/meteor) provides many +The [meteor plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/meteor) provides many [useful aliases](#aliases) as well as completion for the `meteor` command. Enable it by adding `meteor` to the plugins array in your zshrc file: diff --git a/plugins/mvn/README.md b/plugins/mvn/README.md index 88f5be8ba..3bbba5b4f 100644 --- a/plugins/mvn/README.md +++ b/plugins/mvn/README.md @@ -55,4 +55,4 @@ has colored output, so this function will be soon removed from the plugin. ### Known bugs It has a bug where it will swallow mvn prompts for user input, _e.g._ when using -`archetype:generate`. See [#5052](https://github.com/robbyrussell/oh-my-zsh/issues/5052). +`archetype:generate`. See [#5052](https://github.com/ohmyzsh/ohmyzsh/issues/5052). diff --git a/plugins/ng/README.md b/plugins/ng/README.md index 86ad64041..94a450c18 100644 --- a/plugins/ng/README.md +++ b/plugins/ng/README.md @@ -1,6 +1,6 @@ ## NG Plugin -This [ng plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/ng) +This [ng plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/ng) adds completion support for Angular's CLI (named ng). Ng is hosted on [ng home](https://github.com/catull/angular-cli) diff --git a/plugins/osx/README.md b/plugins/osx/README.md index 4595ee319..f3881ec6b 100644 --- a/plugins/osx/README.md +++ b/plugins/osx/README.md @@ -42,20 +42,21 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ## Commands -| Command | Description | -| :-------------- | :-------------------------------------------------- | -| `tab` | Open the current directory in a new tab | -| `split_tab` | Split the current terminal tab horizontally | -| `vsplit_tab` | Split the current terminal tab vertically | -| `ofd` | Open the current directory in a Finder window | -| `pfd` | Return the path of the frontmost Finder window | -| `pfs` | Return the current Finder selection | -| `cdf` | `cd` to the current Finder directory | -| `pushdf` | `pushd` to the current Finder directory | -| `quick-look` | Quick-Look a specified file | -| `man-preview` | Open a specified man page in Preview app | -| `showfiles` | Show hidden files | -| `hidefiles` | Hide the hidden files | -| `itunes` | Control iTunes. Use `itunes -h` for usage details | -| `spotify` | Control Spotify and search by artist, album, track… | -| `rmdsstore` | Remove .DS\_Store files recursively in a directory | +| Command | Description | +| :-------------- | :---------------------------------------------------- | +| `tab` | Open the current directory in a new tab | +| `split_tab` | Split the current terminal tab horizontally | +| `vsplit_tab` | Split the current terminal tab vertically | +| `ofd` | Open the current directory in a Finder window | +| `pfd` | Return the path of the frontmost Finder window | +| `pfs` | Return the current Finder selection | +| `cdf` | `cd` to the current Finder directory | +| `pushdf` | `pushd` to the current Finder directory | +| `quick-look` | Quick-Look a specified file | +| `man-preview` | Open a specified man page in Preview app | +| `showfiles` | Show hidden files | +| `hidefiles` | Hide the hidden files | +| `itunes` | DEPRECATED. Use `music` from macOS Catalina on | +| `music` | Control Apple Music. Use `music -h` for usage details | +| `spotify` | Control Spotify and search by artist, album, track… | +| `rmdsstore` | Remove .DS\_Store files recursively in a directory | diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh index eb3c4fb7a..03e9c1c8c 100644 --- a/plugins/osx/osx.plugin.zsh +++ b/plugins/osx/osx.plugin.zsh @@ -219,7 +219,19 @@ function vncviewer() { } # iTunes control function -function itunes() { +function itunes music() { + local APP_NAME=Music + + autoload is-at-least + if is-at-least 10.15 $(sw_vers -productVersion); then + if [[ $0 = itunes ]]; then + echo >&2 The itunes function name is deprecated. Use \`music\' instead. + return 1 + fi + else + APP_NAME=iTunes + fi + local opt=$1 local playlist=$2 shift @@ -236,7 +248,7 @@ function itunes() { opt="$opt track" ;; vol) - local new_volume volume=$(osascript -e 'tell application "iTunes" to get sound volume') + local new_volume volume=$(osascript -e "tell application \"$APP_NAME\" to get sound volume") if [[ $# -eq 0 ]]; then echo "Current volume is ${volume}." return 0 @@ -251,26 +263,26 @@ function itunes() { opt="set sound volume to ${new_volume}" ;; playlist) - # Inspired by: https://gist.github.com/nakajijapan/ac8b45371064ae98ea7f -if [[ ! -z "$playlist" ]]; then - osascript -e 'tell application "iTunes"' -e "set new_playlist to \"$playlist\" as string" -e "play playlist new_playlist" -e "end tell" 2>/dev/null; + # Inspired by: https://gist.github.com/nakajijapan/ac8b45371064ae98ea7f + if [[ ! -z "$playlist" ]]; then + osascript -e "tell application \"$APP_NAME\"" -e "set new_playlist to \"$playlist\" as string" -e "play playlist new_playlist" -e "end tell" 2>/dev/null; if [[ $? -eq 0 ]]; then opt="play" else opt="stop" fi - else - opt="set allPlaylists to (get name of every playlist)" - fi - ;; + else + opt="set allPlaylists to (get name of every playlist)" + fi + ;; playing|status) - local state=`osascript -e 'tell application "iTunes" to player state as string'` + local state=`osascript -e "tell application \"$APP_NAME\" to player state as string"` if [[ "$state" = "playing" ]]; then - currenttrack=`osascript -e 'tell application "iTunes" to name of current track as string'` - currentartist=`osascript -e 'tell application "iTunes" to artist of current track as string'` + currenttrack=`osascript -e "tell application \"$APP_NAME\" to name of current track as string"` + currentartist=`osascript -e "tell application \"$APP_NAME\" to artist of current track as string"` echo -E "Listening to $fg[yellow]$currenttrack$reset_color by $fg[yellow]$currentartist$reset_color"; else - echo "iTunes is" $state; + echo "$APP_NAME is" $state; fi return 0 ;; @@ -284,7 +296,7 @@ if [[ ! -z "$playlist" ]]; then if [[ -n "$state" && ! "$state" =~ "^(on|off|toggle)$" ]] then - print "Usage: itunes shuffle [on|off|toggle]. Invalid option." + print "Usage: $0 shuffle [on|off|toggle]. Invalid option." return 1 fi @@ -305,14 +317,14 @@ EOF esac ;; ""|-h|--help) - echo "Usage: itunes <option>" + echo "Usage: $0 <option>" echo "option:" echo "\tlaunch|play|pause|stop|rewind|resume|quit" echo "\tmute|unmute\tcontrol volume set" echo "\tnext|previous\tplay next or previous track" echo "\tshuf|shuffle [on|off|toggle]\tSet shuffled playback. Default: toggle. Note: toggle doesn't support the MiniPlayer." echo "\tvol [0-100|up|down]\tGet or set the volume. 0 to 100 sets the volume. 'up' / 'down' increases / decreases by 10 points. No argument displays current volume." - echo "\tplaying|status\tShow what song is currently playing in iTunes." + echo "\tplaying|status\tShow what song is currently playing in Music." echo "\tplaylist [playlist name]\t Play specific playlist" echo "\thelp\tshow this message and exit" return 0 @@ -322,7 +334,7 @@ EOF return 1 ;; esac - osascript -e "tell application \"iTunes\" to $opt" + osascript -e "tell application \"$APP_NAME\" to $opt" } # Spotify control function diff --git a/plugins/percol/README.md b/plugins/percol/README.md index b262e414e..ec5de4f86 100644 --- a/plugins/percol/README.md +++ b/plugins/percol/README.md @@ -1,6 +1,6 @@ ## percol -Provides some useful function to make [percol](https://github.com/mooz/percol) work with zsh history and [jump plugin](https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/jump/jump.plugin.zsh) +Provides some useful function to make [percol](https://github.com/mooz/percol) work with zsh history and [jump plugin](https://github.com/ohmyzsh/ohmyzsh/blob/master/plugins/jump/jump.plugin.zsh) ### Requirements @@ -8,7 +8,7 @@ Provides some useful function to make [percol](https://github.com/mooz/percol) w pip install percol ``` -And [jump](https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/jump/jump.plugin.zsh) for `oh-my-zsh` is a optional requirement. +And [jump](https://github.com/ohmyzsh/ohmyzsh/blob/master/plugins/jump/jump.plugin.zsh) for `oh-my-zsh` is a optional requirement. ### Usage diff --git a/plugins/pipenv/pipenv.plugin.zsh b/plugins/pipenv/pipenv.plugin.zsh index 0a5dc56a4..ec41c3e02 100644 --- a/plugins/pipenv/pipenv.plugin.zsh +++ b/plugins/pipenv/pipenv.plugin.zsh @@ -23,7 +23,8 @@ _togglePipenvShell() { fi fi } -chpwd_functions+=(_togglePipenvShell) +autoload -U add-zsh-hook +add-zsh-hook chpwd _togglePipenvShell # Aliases alias pch="pipenv check" diff --git a/plugins/rails/README.md b/plugins/rails/README.md index 5549ba18b..ad83fffe8 100644 --- a/plugins/rails/README.md +++ b/plugins/rails/README.md @@ -18,7 +18,7 @@ plugins=(... rails) | `rcs` | `rails console --sandbox` | Test code in a sandbox, without changing any data | | `rd` | `rails destroy` | Undo a generate operation | | `rdb` | `rails dbconsole` | Interact with your db from the console | -| `rgen` | `rails generate` | Generate boilerplate code | +| `rgen`| `rails generate` | Generate boilerplate code | | `rgm` | `rails generate migration` | Generate a db migration | | `rp` | `rails plugin` | Run a Rails plugin command | | `ru` | `rails runner` | Run Ruby code in the context of Rails | @@ -44,7 +44,7 @@ plugins=(... rails) | `rlc` | `rake log:clear` | Clear Rails logs | | `rn` | `rake notes` | Search for notes (`FIXME`, `TODO`) in code comments | | `rr` | `rake routes` | List all defined routes | -| `rrg` | `rake routes | grep` | List and filter the defined routes | +| `rrg` | `rake routes \| grep` | List and filter the defined routes | | `rt` | `rake test` | Run Rails tests | | `rmd` | `rake middleware` | Interact with Rails middlewares | | `rsts` | `rake stats` | Print code statistics | diff --git a/plugins/rake/README.md b/plugins/rake/README.md index e235bd91a..e888c0785 100644 --- a/plugins/rake/README.md +++ b/plugins/rake/README.md @@ -34,4 +34,4 @@ The plugin also aliases `rake` to [`jimweirich`](https://github.com/jimweirich), and big time contributor to the Ruby open source community. He passed away in 2014: > Thank you Jim for everything you contributed to the Ruby and open source community -> over the years. We will miss you dearly. — [**@robbyrussell**](https://github.com/robbyrussell/oh-my-zsh/commit/598a9c6f990756386517d66b6bcf77e53791e905) +> over the years. We will miss you dearly. — [**@robbyrussell**](https://github.com/ohmyzsh/ohmyzsh/commit/598a9c6f990756386517d66b6bcf77e53791e905) diff --git a/plugins/salt/_salt b/plugins/salt/_salt index 10b782af4..78d8611d2 100644 --- a/plugins/salt/_salt +++ b/plugins/salt/_salt @@ -271,7 +271,7 @@ _salt_comp(){ fi if _cache_invalid salt/salt_dir || ! _retrieve_cache salt/salt_dir; then - salt_dir="${$(python2 -c 'import salt; print(salt.__file__);')%__init__*}" + salt_dir="${$(python2 -c 'import sys; del sys.path[0]; import salt; print(salt.__file__);')%__init__*}" _store_cache salt/salt_dir salt_dir fi } diff --git a/plugins/sudo/README.md b/plugins/sudo/README.md index ebfdfd10d..25eb85829 100644 --- a/plugins/sudo/README.md +++ b/plugins/sudo/README.md @@ -13,10 +13,10 @@ Easily prefix your current or previous commands with `sudo` by pressing <kbd>esc ) ``` -2. Reload the source file or restart your Terminal session: +2. Restart your shell or restart your Terminal session: ```console - $ source ~/.zshrc + $ exec zsh $ ``` diff --git a/plugins/terraform/_terraform b/plugins/terraform/_terraform index 1d1315a8a..5b3655801 100644 --- a/plugins/terraform/_terraform +++ b/plugins/terraform/_terraform @@ -1,6 +1,6 @@ #compdef terraform -local -a _terraform_cmds +local -a _terraform_cmds opt_args _terraform_cmds=( 'apply:Builds or changes infrastructure' 'console:Interactive console for Terraform interpolations' @@ -16,13 +16,21 @@ _terraform_cmds=( 'push:Upload this Terraform module to Atlas to run' 'refresh:Update local state file against real resources' 'show:Inspect Terraform state or plan' + 'state:Advanced state management' 'taint:Manually mark a resource for recreation' 'untaint:Manually unmark a resource as tainted' 'validate:Validates the Terraform files' 'version:Prints the Terraform version' 'workspace:Workspace management' + '0.12upgrade:Rewrites pre-0.12 module source code for v0.12' ) +__012upgrade() { + _arguments \ + '-yes[Skip the initial introduction messages and interactive confirmation. This can be used to run this command in batch from a script.]' \ + '-force[ Override the heuristic that attempts to detect if a configuration is already written for v0.12 or later. Some of the transformations made by this command are not idempotent, so re-running against the same module may change the meanings expressions in the module.]' +} + __apply() { _arguments \ '-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]' \ @@ -35,7 +43,7 @@ __apply() { '-refresh=[(true) Update state prior to checking for differences. This has no effect if a plan file is given to apply.]' \ '-state=[(terraform.tfstate) Path to read and save state (unless state-out is specified).]' \ '-state-out=[(path) Path to write state to that is different than "-state". This can be used to preserve the old state.]' \ - '-target=[(resource) Resource to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]' \ + '-target=[(resource) Resource to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]:target:__statelist' \ '-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \ '-var-file=[(foo) Set variables in the Terraform configuration from a file. If "terraform.tfvars" or any ".auto.tfvars" files are present, they will be automatically loaded.]' } @@ -59,7 +67,7 @@ __destroy() { '-refresh=[(true) Update state prior to checking for differences. This has no effect if a plan file is given to apply.]' \ '-state=[(terraform.tfstate) Path to read and save state (unless state-out is specified).]' \ '-state-out=[(path) Path to write state to that is different than "-state". This can be used to preserve the old state.]' \ - '-target=[(resource) Resource to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]' \ + '-target=[(resource) Resource to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]:target:__statelist' \ '-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \ '-var-file=[(foo) Set variables in the Terraform configuration from a file. If "terraform.tfvars" or any ".auto.tfvars" files are present, they will be automatically loaded.]' } @@ -140,7 +148,7 @@ __plan() { '-parallelism=[(10) Limit the number of concurrent operations.]' \ '-refresh=[(true) Update state prior to checking for differences.]' \ '-state=[(statefile) Path to a Terraform state file to use to look up Terraform-managed resources. By default it will use the state "terraform.tfstate" if it exists.]' \ - '-target=[(resource) Resource to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]' \ + '-target=[(resource) Resource to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]:target:__statelist' \ '-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \ '-var-file=[(foo) Set variables in the Terraform configuration from a file. If "terraform.tfvars" or any ".auto.tfvars" files are present, they will be automatically loaded.]' \ } @@ -172,7 +180,7 @@ __refresh() { '-no-color[If specified, output will not contain any color.]' \ '-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]' \ '-state-out=[(path) Path to write state to that is different than "-state". This can be used to preserve the old state.]' \ - '-target=[(resource) A Resource Address to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]' \ + '-target=[(resource) A Resource Address to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]:target:__statelist' \ '-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \ '-var-file=[(path) Set variables in the Terraform configuration from a file. If "terraform.tfvars" is present, it will be automatically loaded if this flag is not specified.]' } @@ -183,6 +191,70 @@ __show() { '-no-color[If specified, output will not contain any color.]' } +__state() { + local -a __state_cmds + __state_cmds=( + 'list:List resources in the state' + 'mv:Move an item in the state' + 'pull:Pull current state and output to stdout' + 'push:Update remote state from a local state file' + 'rm:Remove instances from the state' + 'show:Show a resource in the state' + ) + _describe -t state "state commands" __state_cmds +} + +__state_list() { + _arguments \ + '-state=[(path) Path to a Terraform state file to use to look up Terraform-managed resources. By default it will use the state "terraform.tfstate" if it exists.]' \ + '-id=[(id) Filters the results to include only instances whose resource types have an attribute named id whose value equals the given id string.]' \ + "*:address:__statelist" +} + +__state_mv() { + _arguments \ + "-dry-run[If set, prints out what would've been moved but doesn't actually move anything.]" \ + "-backup=[(path) Path where Terraform should write the backup for the original state. This can't be disabled. If not set, Terraform will write it to the same path as the statefile with a \".backup\" extension.]:file:_files" \ + "-backup-out=[(path) Path where Terraform should write the backup for the destination state. This can't be disabled. If not set, Terraform will write it to the same path as the destination state file with a backup extension. This only needs to be specified if -state-out is set to a different path than -state.]:file:_files" \ + "-lock=[(true|false) Lock the state files when locking is supported.]:lock:(true false)" \ + "-lock-timeout=[(seconds) Duration to retry a state lock.]" \ + '-state=[(path) Path to the source state file. Defaults to the configured backend, or "terraform.tfstate"]:file:_files' \ + "-state-out=[(path) Path to the destination state file to write to. If this isn't specified, the source state file will be used. This can be a new or existing path.]:file:_files" \ + "::" \ + ":source:__statelist" \ + ":destination: " +} + +__state_push() { + _arguments \ + "-force[Write the state even if lineages don't match or the remote serial is higher.]" \ + '-lock=[(true|false) Lock the state file when locking is supported.]:lock:(true false)' \ + "-lock-timeout=[(seconds) Duration to retry a state lock.]" \ + "::" \ + ":destination:_files" +} + +__state_rm() { + _arguments \ + "-dry-run[If set, prints out what would've been removed but doesn't actually remove anything.]" \ + "-backup=[(path) Path where Terraform should write the backup for the original state.]:file:_files" \ + "-lock=[(true|false) Lock the state files when locking is supported.]:lock:(true false)" \ + "-lock-timeout=[(seconds) Duration to retry a state lock.]" \ + '-state=[(path) Path to the state file to update. Defaults to the current workspace state.]:file:_files' \ + "*:address:__statelist" +} + + +__state_show() { + _arguments \ + '-state=[(path) Path to a Terraform state file to use to look up Terraform-managed resources. By default it will use the state "terraform.tfstate" if it exists.]' \ + "*:address:__statelist" +} + +__statelist() { + compadd $(terraform state list $opt_args[-state]) +} + __taint() { _arguments \ '-allow-missing[If specified, the command will succeed (exit code 0) even if the resource is missing.]' \ @@ -192,7 +264,8 @@ __taint() { '-module=[(path) The module path where the resource lives. By default this will be root. Child modules can be specified by names. Ex. "consul" or "consul.vpc" (nested modules).]' \ '-no-color[If specified, output will not contain any color.]' \ '-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]' \ - '-state-out=[(path) Path to write updated state file. By default, the "-state" path will be used.]' + '-state-out=[(path) Path to write updated state file. By default, the "-state" path will be used.]' \ + "*:address:__statelist" } __untaint() { @@ -236,6 +309,8 @@ fi local -a _command_args case "$words[1]" in + 0.12upgrade) + __012upgrade ;; apply) __apply ;; console) @@ -264,6 +339,14 @@ case "$words[1]" in __refresh ;; show) __show ;; + state) + test $CURRENT -lt 3 && __state + [[ $words[2] = "list" ]] && __state_list + [[ $words[2] = "mv" ]] && __state_mv + [[ $words[2] = "push" ]] && __state_push + [[ $words[2] = "rm" ]] && __state_rm + [[ $words[2] = "show" ]] && __state_show + ;; taint) __taint ;; untaint) diff --git a/plugins/thefuck/README.md b/plugins/thefuck/README.md index a9b7550d7..bd407b316 100644 --- a/plugins/thefuck/README.md +++ b/plugins/thefuck/README.md @@ -6,4 +6,4 @@ Press `ESC` twice to correct previous console command. ## Notes -`Esc`-`Esc` key binding conflicts with [sudo](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/sudo) plugin. +`Esc`-`Esc` key binding conflicts with [sudo](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/sudo) plugin. diff --git a/plugins/timer/timer.plugin.zsh b/plugins/timer/timer.plugin.zsh index 231134e7d..728377c5c 100644 --- a/plugins/timer/timer.plugin.zsh +++ b/plugins/timer/timer.plugin.zsh @@ -25,5 +25,6 @@ __timer_display_timer_precmd() { fi } -preexec_functions+=(__timer_save_time_preexec) -precmd_functions+=(__timer_display_timer_precmd) +autoload -U add-zsh-hook +add-zsh-hook preexec __timer_save_time_preexec +add-zsh-hook precmd __timer_display_timer_precmd diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index 5b5d1b1ba..dad3db578 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -46,6 +46,7 @@ fi # Set the correct local config file to use. if [[ "$ZSH_TMUX_ITERM2" == "false" && -e "$ZSH_TMUX_CONFIG" ]]; then + export ZSH_TMUX_CONFIG export _ZSH_TMUX_FIXED_CONFIG="${0:h:a}/tmux.extra.conf" else export _ZSH_TMUX_FIXED_CONFIG="${0:h:a}/tmux.only.conf" diff --git a/plugins/urltools/README.md b/plugins/urltools/README.md index 548301c72..29c371070 100644 --- a/plugins/urltools/README.md +++ b/plugins/urltools/README.md @@ -21,9 +21,9 @@ Original idea and aliases: [Ruslan Spivak](https://ruslanspivak.wordpress.com/20 ## Examples ```zsh -urlencode 'https://github.com/robbyrussell/oh-my-zsh/search?q=urltools&type=Code' -# returns https%3A%2F%2Fgithub.com%2Frobbyrussell%2Foh-my-zsh%2Fsearch%3Fq%3Durltools%26type%3DCode +urlencode 'https://github.com/ohmyzsh/ohmyzsh/search?q=urltools&type=Code' +# returns https%3A%2F%2Fgithub.com%2Fohmyzsh%2Fohmyzsh%2Fsearch%3Fq%3Durltools%26type%3DCode -urldecode 'https%3A%2F%2Fgithub.com%2Frobbyrussell%2Foh-my-zsh%2Fsearch%3Fq%3Durltools%26type%3DCode' -# returns https://github.com/robbyrussell/oh-my-zsh/search?q=urltools&type=Code +urldecode 'https%3A%2F%2Fgithub.com%2Fohmyzsh%2Fohmyzsh%2Fsearch%3Fq%3Durltools%26type%3DCode' +# returns https://github.com/ohmyzsh/ohmyzsh/search?q=urltools&type=Code ``` diff --git a/plugins/urltools/urltools.plugin.zsh b/plugins/urltools/urltools.plugin.zsh index 47d9a34e4..b443e5027 100644 --- a/plugins/urltools/urltools.plugin.zsh +++ b/plugins/urltools/urltools.plugin.zsh @@ -12,11 +12,11 @@ if [[ $(whence node) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD alias urlencode='node -e "console.log(encodeURIComponent(process.argv[1]))"' alias urldecode='node -e "console.log(decodeURIComponent(process.argv[1]))"' elif [[ $(whence python3) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xpython" ) ]]; then - alias urlencode='python3 -c "import sys, urllib.parse as up; print(up.quote_plus(sys.argv[1]))"' - alias urldecode='python3 -c "import sys, urllib.parse as up; print(up.unquote_plus(sys.argv[1]))"' + alias urlencode='python3 -c "import sys; del sys.path[0]; import urllib.parse as up; print(up.quote_plus(sys.argv[1]))"' + alias urldecode='python3 -c "import sys; del sys.path[0]; import urllib.parse as up; print(up.unquote_plus(sys.argv[1]))"' elif [[ $(whence python2) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xpython" ) ]]; then - alias urlencode='python2 -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1])"' - alias urldecode='python2 -c "import sys, urllib as ul; print ul.unquote_plus(sys.argv[1])"' + alias urlencode='python2 -c "import sys; del sys.path[0]; import urllib as ul; print ul.quote_plus(sys.argv[1])"' + alias urldecode='python2 -c "import sys; del sys.path[0]; import urllib as ul; print ul.unquote_plus(sys.argv[1])"' elif [[ $(whence xxd) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xshell" ) ]]; then function urlencode() {echo $@ | tr -d "\n" | xxd -plain | sed "s/\(..\)/%\1/g"} function urldecode() {printf $(echo -n $@ | sed 's/\\/\\\\/g;s/\(%\)\([0-9a-fA-F][0-9a-fA-F]\)/\\x\2/g')"\n"} diff --git a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh index e27c6bb76..2a4b43189 100644 --- a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh +++ b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh @@ -96,7 +96,6 @@ if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then # Append workon_cwd to the chpwd_functions array, so it will be called on cd # http://zsh.sourceforge.net/Doc/Release/Functions.html - if ! (( $chpwd_functions[(I)workon_cwd] )); then - chpwd_functions+=(workon_cwd) - fi + autoload -U add-zsh-hook + add-zsh-hook chpwd workon_cwd fi diff --git a/plugins/wd/README.md b/plugins/wd/README.md index b1deeffd5..91d5d0ae7 100644 --- a/plugins/wd/README.md +++ b/plugins/wd/README.md @@ -13,7 +13,7 @@ wd ### oh-my-zsh -`wd` comes bundled with [oh-my-zshell](https://github.com/robbyrussell/oh-my-zsh)! +`wd` comes bundled with [oh-my-zshell](https://github.com/ohmyzsh/ohmyzsh)! Just add the plugin in your `~/.zshrc` file: @@ -53,7 +53,7 @@ Run either in terminal: #### Completion -If you're NOT using [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh) and you want to utilize the zsh-completion feature, you will also need to add the path to your `wd` installation (`~/bin/wd` if you used the automatic installer) to your `fpath`. E.g. in your `~/.zshrc`: +If you're NOT using [oh-my-zsh](https://github.com/ohmyzsh/ohmyzsh) and you want to utilize the zsh-completion feature, you will also need to add the path to your `wd` installation (`~/bin/wd` if you used the automatic installer) to your `fpath`. E.g. in your `~/.zshrc`: fpath=(~/path/to/wd $fpath) @@ -85,7 +85,7 @@ Also, you may have to force a rebuild of `zcompdump` by running: $ wd ... This is a wrapper for the zsh `dirs` function. - (You might need `setopt AUTO_PUSHD` in your `.zshrc` if you hare not using [oh-my-zshell](https://github.com/robbyrussell/oh-my-zsh)). + (You might need `setopt AUTO_PUSHD` in your `.zshrc` if you hare not using [oh-my-zshell](https://github.com/ohmyzsh/ohmyzsh)). * Remove warp point test point: diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template index 3cc5ad46c..d16713ccb 100644 --- a/templates/zshrc.zsh-template +++ b/templates/zshrc.zsh-template @@ -7,7 +7,7 @@ export ZSH=$HOME/.oh-my-zsh # Set name of the theme to load --- if set to "random", it will # load a random theme each time oh-my-zsh is loaded, in which case, # to know which specific one was loaded, run: echo $RANDOM_THEME -# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes +# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes ZSH_THEME="robbyrussell" # Set list of themes to pick from when loading at random diff --git a/themes/gallifrey.zsh-theme b/themes/gallifrey.zsh-theme index 768547064..47b057fa3 100644 --- a/themes/gallifrey.zsh-theme +++ b/themes/gallifrey.zsh-theme @@ -1,4 +1,4 @@ -# ZSH Theme - Preview: https://github.com/robbyrussell/oh-my-zsh/wiki/Themes#gallifrey +# ZSH Theme - Preview: https://github.com/ohmyzsh/ohmyzsh/wiki/Themes#gallifrey return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" host_color="%(!.%{$fg[red]%}.%{$fg[green]%})" diff --git a/themes/pygmalion-virtualenv.zsh-theme b/themes/pygmalion-virtualenv.zsh-theme index ea28e125a..605e3d10c 100644 --- a/themes/pygmalion-virtualenv.zsh-theme +++ b/themes/pygmalion-virtualenv.zsh-theme @@ -28,7 +28,8 @@ prompt_setup_pygmalion(){ base_prompt_nocolor=$(echo "$base_prompt" | perl -pe "s/%\{[^}]+\}//g") post_prompt_nocolor=$(echo "$post_prompt" | perl -pe "s/%\{[^}]+\}//g") - precmd_functions+=(prompt_pygmalion_precmd) + autoload -U add-zsh-hook + add-zsh-hook precmd prompt_pygmalion_precmd } prompt_pygmalion_precmd(){ @@ -46,5 +47,3 @@ prompt_pygmalion_precmd(){ } prompt_setup_pygmalion - - diff --git a/themes/pygmalion.zsh-theme b/themes/pygmalion.zsh-theme index 5f5fe7f9a..cd773e4a4 100644 --- a/themes/pygmalion.zsh-theme +++ b/themes/pygmalion.zsh-theme @@ -12,7 +12,8 @@ prompt_setup_pygmalion(){ base_prompt_nocolor=$(echo "$base_prompt" | perl -pe "s/%\{[^}]+\}//g") post_prompt_nocolor=$(echo "$post_prompt" | perl -pe "s/%\{[^}]+\}//g") - precmd_functions+=(prompt_pygmalion_precmd) + autoload -U add-zsh-hook + add-zsh-hook precmd prompt_pygmalion_precmd } prompt_pygmalion_precmd(){ @@ -30,5 +31,3 @@ prompt_pygmalion_precmd(){ } prompt_setup_pygmalion - - diff --git a/tools/install.sh b/tools/install.sh index a5a90e6f6..ae248be89 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -1,12 +1,12 @@ #!/bin/sh # # This script should be run via curl: -# sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" +# sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" # or wget: -# sh -c "$(wget -qO- https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" +# sh -c "$(wget -qO- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" # # As an alternative, you can first download the install script and run it afterwards: -# wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh +# wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh # sh install.sh # # You can tweak the install behavior by setting variables when running the script. For @@ -15,7 +15,7 @@ # # Respects the following environment variables: # ZSH - path to the Oh My Zsh repository folder (default: $HOME/.oh-my-zsh) -# REPO - name of the GitHub repo to install from (default: robbyrussell/oh-my-zsh) +# REPO - name of the GitHub repo to install from (default: ohmyzsh/ohmyzsh) # REMOTE - full remote URL of the git repo to install (default: GitHub via HTTPS) # BRANCH - branch to check out immediately after install (default: master) # @@ -33,7 +33,7 @@ set -e # Default settings ZSH=${ZSH:-~/.oh-my-zsh} -REPO=${REPO:-robbyrussell/oh-my-zsh} +REPO=${REPO:-ohmyzsh/ohmyzsh} REMOTE=${REMOTE:-https://github.com/${REPO}.git} BRANCH=${BRANCH:-master} diff --git a/tools/upgrade.sh b/tools/upgrade.sh index f64a0096e..3005e6542 100644 --- a/tools/upgrade.sh +++ b/tools/upgrade.sh @@ -31,6 +31,12 @@ git config fsck.zeroPaddedFilemode ignore git config fetch.fsck.zeroPaddedFilemode ignore git config receive.fsck.zeroPaddedFilemode ignore +# Update upstream remote to ohmyzsh org +remote=$(git remote -v | awk '/https:\/\/github\.com\/robbyrussell\/oh-my-zsh\.git/{ print $1; exit }') +if [ -n "$remote" ]; then + git remote set-url "$remote" "https://github.com/ohmyzsh/ohmyzsh.git" +fi + printf "${BLUE}%s${NORMAL}\n" "Updating Oh My Zsh" if git pull --rebase --stat origin master then |