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 diff --git a/README.md b/README.md index 2f23febf5..ac4b3879c 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,9 @@ Oh My Zsh

+[![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