Merge branch 'master' into colorize-chroma-support

This commit is contained in:
Aaron N. Brock 2019-11-22 10:40:37 -05:00 committed by GitHub
commit 420e9d789a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
54 changed files with 261 additions and 142 deletions

1
.gitignore vendored
View File

@ -4,3 +4,4 @@ custom/
# temp files directories # temp files directories
cache/ cache/
log/ log/
*.swp

View File

@ -31,7 +31,7 @@ your problem.
If you find one, comment on it so we can know there are more people experiencing it. 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. 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. 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 You should be familiar with the basics of
[contributing on GitHub](https://help.github.com/articles/using-pull-requests) and have a fork [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. 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 ### 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. send themes for now.
Please be so kind as to [search](#use-the-search-luke) for any pending, merged or rejected Pull Requests 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, before making any contribution, it avoids duplicates and eases maintenance. Trust me,
that works 90% of the time. 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. 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 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!! :) 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. page for instructions on where to start and more.

View File

@ -1,6 +1,6 @@
MIT License 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 Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -2,6 +2,9 @@
<img src="https://s3.amazonaws.com/ohmyzsh/oh-my-zsh-logo.png" alt="Oh My Zsh"> <img src="https://s3.amazonaws.com/ohmyzsh/oh-my-zsh-logo.png" alt="Oh My Zsh">
</p> </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. 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. Sounds boring. Let's try again.
@ -19,7 +22,7 @@ To learn more, visit [ohmyz.sh](https://ohmyz.sh) and follow [@ohmyzsh](https://
### Prerequisites ### Prerequisites
* A Unix-like operating system: macOS, Linux, BSD. On Windows: WSL is preferred, but cygwin or msys also mostly work. * 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 * `curl` or `wget` should be installed
* `git` 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 #### via curl
```shell ```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 #### via wget
```shell ```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 #### Manual inspection
@ -46,7 +49,7 @@ that by downloading the install script first, looking through it so everything l
then running it: then running it:
```shell ```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 sh install.sh
``` ```
@ -54,7 +57,7 @@ sh install.sh
### Plugins ### 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 #### Enabling Plugins
@ -86,7 +89,7 @@ Most plugins (should! we're working on this) include a __README__, which documen
### Themes ### 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 #### Selecting a Theme
@ -102,7 +105,7 @@ To use a different theme, simply change the value to match the name of your desi
```shell ```shell
ZSH_THEME="agnoster" # (this is one of the fancy ones) 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._ _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) ![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. 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. the default shell, and also won't run `zsh` when the installation has finished.
```shell ```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 #### Installing from a forked repository
The install script also accepts these variables to allow installation of a different 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}`. 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 - `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: ##### 1. Clone the repository:
```shell ```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: ##### 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! 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. See [Contributing](CONTRIBUTING.md) for more details.
### Do NOT send us themes ### 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 ## Contributors

View File

@ -75,8 +75,9 @@ function omz_termsupport_preexec {
title '$CMD' '%100>...>$LINE%<<' title '$CMD' '%100>...>$LINE%<<'
} }
precmd_functions+=(omz_termsupport_precmd) autoload -U add-zsh-hook
preexec_functions+=(omz_termsupport_preexec) add-zsh-hook precmd omz_termsupport_precmd
add-zsh-hook preexec omz_termsupport_preexec
# Keep Apple Terminal.app's current working directory updated # 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 # 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 # Run once to get initial cwd set
update_terminalapp_cwd update_terminalapp_cwd
fi fi

View File

@ -43,4 +43,5 @@ preexec_alias-finder() {
fi fi
} }
preexec_functions+=(preexec_alias-finder) autoload -U add-zsh-hook
add-zsh-hook preexec preexec_alias-finder

View File

@ -42,7 +42,7 @@ This will exclude the `foreman` and `spin` gems (i.e. their executable) from bei
## Excluded gems ## 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` `berks`
`foreman` `foreman`

View File

@ -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 ```console
$ source ~/.zshrc $ exec zsh
$ $
``` ```

View File

@ -43,6 +43,6 @@ In the latter form, the file contents will be concatenated and presented by less
## Requirements ## 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) Or install chroma: [https://github.com/alecthomas/chroma](https://github.com/alecthomas/chroma)

View File

@ -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 ```console
$ source ~/.zshrc $ exec zsh
$ $
``` ```

View File

@ -53,7 +53,8 @@ function push_future() {
} }
# Called by zsh when directory changes # Called by zsh when directory changes
chpwd_functions+=(chpwd_dirhistory) autoload -U add-zsh-hook
add-zsh-hook chpwd chpwd_dirhistory
function chpwd_dirhistory() { function chpwd_dirhistory() {
push_past $PWD push_past $PWD
# If DIRHISTORY_CD is not set... # If DIRHISTORY_CD is not set...

View File

@ -11,7 +11,8 @@ if [[ -f ${dirstack_file} ]] && [[ ${#dirstack[*]} -eq 0 ]] ; then
[[ -d $dirstack[1] ]] && cd $dirstack[1] && cd $OLDPWD [[ -d $dirstack[1] ]] && cd $dirstack[1] && cd $OLDPWD
fi fi
chpwd_functions+=(chpwd_dirpersist) autoload -U add-zsh-hook
add-zsh-hook chpwd chpwd_dirpersist
chpwd_dirpersist() { chpwd_dirpersist() {
if (( $DIRSTACKSIZE <= 0 )) || [[ -z $dirstack_file ]]; then return; fi if (( $DIRSTACKSIZE <= 0 )) || [[ -z $dirstack_file ]]; then return; fi
local -ax my_stack local -ax my_stack

View File

@ -374,7 +374,8 @@ _managepy-commands() {
_applist() { _applist() {
local line local line
local -a apps 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\\ bn=op.basename(op.abspath(op.curdir));[sys\\
.stdout.write(str(re.sub(r'^%s\.(.*?)$' % .stdout.write(str(re.sub(r'^%s\.(.*?)$' %
bn, r'\1', i)) + '\n') for i in django.conf.settings.\\ bn, r'\1', i)) + '\n') for i in django.conf.settings.\\

View File

@ -8,7 +8,7 @@ To use it, add emotty to the plugins array in your zshrc file:
plugins=(... emotty) 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 ## Usage

View File

@ -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 ```sh
source ~/.zshrc exec zsh
``` ```
## Usage and examples ## Usage and examples

View File

@ -27,6 +27,7 @@ plugins=(... extract)
| `jar` | Java Archive | | `jar` | Java Archive |
| `lzma` | LZMA archive | | `lzma` | LZMA archive |
| `rar` | WinRAR archive | | `rar` | WinRAR archive |
| `rpm` | RPM package |
| `sublime-package` | Sublime Text package | | `sublime-package` | Sublime Text package |
| `tar` | Tarball | | `tar` | Tarball |
| `tar.bz2` | Tarball with bzip2 compression | | `tar.bz2` | Tarball with bzip2 compression |

View File

@ -3,5 +3,5 @@
_arguments \ _arguments \
'(-r --remove)'{-r,--remove}'[Remove archive.]' \ '(-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 && return 0

View File

@ -48,6 +48,7 @@ extract() {
(*.z) uncompress "$1" ;; (*.z) uncompress "$1" ;;
(*.zip|*.war|*.jar|*.sublime-package|*.ipsw|*.xpi|*.apk|*.aar|*.whl) unzip "$1" -d $extract_dir ;; (*.zip|*.war|*.jar|*.sublime-package|*.ipsw|*.xpi|*.apk|*.aar|*.whl) unzip "$1" -d $extract_dir ;;
(*.rar) unrar x -ad "$1" ;; (*.rar) unrar x -ad "$1" ;;
(*.rpm) mkdir "$extract_dir" && cd "$extract_dir" && rpm2cpio "../$1" | cpio --quiet -id && cd .. ;;
(*.7z) 7za x "$1" ;; (*.7z) 7za x "$1" ;;
(*.deb) (*.deb)
mkdir -p "$extract_dir/control" mkdir -p "$extract_dir/control"

View File

@ -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.

View File

@ -1,16 +1,17 @@
GIT_AUTO_FETCH_INTERVAL=${GIT_AUTO_FETCH_INTERVAL:=60} GIT_AUTO_FETCH_INTERVAL=${GIT_AUTO_FETCH_INTERVAL:=60}
function git-fetch-all { function git-fetch-all {
(`git rev-parse --is-inside-work-tree 2>/dev/null` && (`command git rev-parse --is-inside-work-tree 2>/dev/null` &&
dir=`git rev-parse --git-dir` && dir=`command git rev-parse --git-dir` &&
[[ ! -f $dir/NO_AUTO_FETCH ]] && [[ ! -f $dir/NO_AUTO_FETCH ]] &&
(( `date +%s` - `date -r $dir/FETCH_LOG +%s 2>/dev/null || echo 0` > $GIT_AUTO_FETCH_INTERVAL )) && (( `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 { function git-auto-fetch {
`git rev-parse --is-inside-work-tree 2>/dev/null` || return `command git rev-parse --is-inside-work-tree 2>/dev/null` || return
guard="`git rev-parse --git-dir`/NO_AUTO_FETCH" guard="`command git rev-parse --git-dir`/NO_AUTO_FETCH"
(rm $guard 2>/dev/null && (rm $guard 2>/dev/null &&
echo "${fg_bold[green]}enabled${reset_color}") || echo "${fg_bold[green]}enabled${reset_color}") ||

View File

@ -20,9 +20,10 @@ function precmd_update_git_vars() {
fi fi
} }
chpwd_functions+=(chpwd_update_git_vars) autoload -U add-zsh-hook
precmd_functions+=(precmd_update_git_vars) add-zsh-hook chpwd chpwd_update_git_vars
preexec_functions+=(preexec_update_git_vars) add-zsh-hook precmd precmd_update_git_vars
add-zsh-hook preexec preexec_update_git_vars
## Function definitions ## Function definitions

View File

@ -11,5 +11,5 @@ plugins=(... gitfast)
## Aliases ## Aliases
An earlier version of the plugin also loaded the git plugin. If you want to keep those 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. as well.

View File

@ -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.

View File

@ -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 [1]: https://fishshell.com
[2]: https://www.zsh.org/mla/users/2009/msg00818.html [2]: https://www.zsh.org/mla/users/2009/msg00818.html
[3]: https://sourceforge.net/projects/fizsh/ [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 [5]: https://github.com/zsh-users/zsh-history-substring-search
[6]: https://github.com/zsh-users/zsh-syntax-highlighting [6]: https://github.com/zsh-users/zsh-syntax-highlighting

View File

@ -15,7 +15,7 @@ if [[ $FOUND_JENV -eq 0 ]]; then
fi fi
if [[ $FOUND_JENV -eq 1 ]]; then if [[ $FOUND_JENV -eq 1 ]]; then
export PATH="${jenvdir}/bin:$PATH" (( $+commands[jenv] )) || export PATH="${jenvdir}/bin:$PATH"
eval "$(jenv init - zsh)" eval "$(jenv init - zsh)"
function jenv_prompt_info() { jenv version-name 2>/dev/null } function jenv_prompt_info() { jenv version-name 2>/dev/null }

View File

@ -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 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]))"' 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 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 " alias is_json='python -c "
import json, sys; import sys; del sys.path[0];
import json;
try: try:
json.loads(sys.stdin.read()) json.loads(sys.stdin.read())
except ValueError, e: except ValueError, e:
@ -22,11 +23,13 @@ else:
print True print True
sys.exit(0)"' sys.exit(0)"'
alias urlencode_json='python -c " 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()) print urllib.quote_plus(sys.stdin.read())
sys.exit(0)"' sys.exit(0)"'
alias urldecode_json='python -c " 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()) print urllib.unquote_plus(sys.stdin.read())
sys.exit(0)"' sys.exit(0)"'
elif [[ $(whence ruby) != "" && ( "x$JSONTOOLS_METHOD" = "x" || "x$JSONTOOLS_METHOD" = "xruby" ) ]]; then elif [[ $(whence ruby) != "" && ( "x$JSONTOOLS_METHOD" = "x" || "x$JSONTOOLS_METHOD" = "xruby" ) ]]; then

View File

@ -2,7 +2,8 @@
typeset -g ZSH_LAST_WORKING_DIRECTORY typeset -g ZSH_LAST_WORKING_DIRECTORY
# Updates the last directory once directory is changed # 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() { chpwd_last_working_dir() {
if [ "$ZSH_SUBSHELL" = 0 ]; then if [ "$ZSH_SUBSHELL" = 0 ]; then
local cache_file="$ZSH_CACHE_DIR/last-working-dir" local cache_file="$ZSH_CACHE_DIR/last-working-dir"

View File

@ -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 ```console
$ source ~/.zshrc $ exec zsh
$ $
``` ```

View File

@ -45,7 +45,7 @@ alias bringz='git pull'
alias chicken='git add' alias chicken='git add'
alias oanward='git commit -m' alias oanward='git commit -m'
alias ooanward='git commit -am' 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 letcat='git checkout'
alias violenz='git rebase' alias violenz='git rebase'

View File

@ -1,6 +1,6 @@
## Introduction ## 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. [useful aliases](#aliases) as well as completion for the `meteor` command.
Enable it by adding `meteor` to the plugins array in your zshrc file: Enable it by adding `meteor` to the plugins array in your zshrc file:

View File

@ -55,4 +55,4 @@ has colored output, so this function will be soon removed from the plugin.
### Known bugs ### Known bugs
It has a bug where it will swallow mvn prompts for user input, _e.g._ when using 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).

View File

@ -1,6 +1,6 @@
## NG Plugin ## 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). adds completion support for Angular's CLI (named ng).
Ng is hosted on [ng home](https://github.com/catull/angular-cli) Ng is hosted on [ng home](https://github.com/catull/angular-cli)

View File

@ -43,7 +43,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
## Commands ## Commands
| Command | Description | | Command | Description |
| :-------------- | :-------------------------------------------------- | | :-------------- | :---------------------------------------------------- |
| `tab` | Open the current directory in a new tab | | `tab` | Open the current directory in a new tab |
| `split_tab` | Split the current terminal tab horizontally | | `split_tab` | Split the current terminal tab horizontally |
| `vsplit_tab` | Split the current terminal tab vertically | | `vsplit_tab` | Split the current terminal tab vertically |
@ -56,6 +56,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
| `man-preview` | Open a specified man page in Preview app | | `man-preview` | Open a specified man page in Preview app |
| `showfiles` | Show hidden files | | `showfiles` | Show hidden files |
| `hidefiles` | Hide the hidden files | | `hidefiles` | Hide the hidden files |
| `itunes` | Control iTunes. Use `itunes -h` for usage details | | `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… | | `spotify` | Control Spotify and search by artist, album, track… |
| `rmdsstore` | Remove .DS\_Store files recursively in a directory | | `rmdsstore` | Remove .DS\_Store files recursively in a directory |

View File

@ -219,7 +219,19 @@ function vncviewer() {
} }
# iTunes control function # 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 opt=$1
local playlist=$2 local playlist=$2
shift shift
@ -236,7 +248,7 @@ function itunes() {
opt="$opt track" opt="$opt track"
;; ;;
vol) 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 if [[ $# -eq 0 ]]; then
echo "Current volume is ${volume}." echo "Current volume is ${volume}."
return 0 return 0
@ -252,8 +264,8 @@ function itunes() {
;; ;;
playlist) playlist)
# Inspired by: https://gist.github.com/nakajijapan/ac8b45371064ae98ea7f # Inspired by: https://gist.github.com/nakajijapan/ac8b45371064ae98ea7f
if [[ ! -z "$playlist" ]]; then 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; 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 if [[ $? -eq 0 ]]; then
opt="play" opt="play"
else else
@ -264,13 +276,13 @@ if [[ ! -z "$playlist" ]]; then
fi fi
;; ;;
playing|status) 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 if [[ "$state" = "playing" ]]; then
currenttrack=`osascript -e 'tell application "iTunes" to name of current track as string'` currenttrack=`osascript -e "tell application \"$APP_NAME\" to name of current track as string"`
currentartist=`osascript -e 'tell application "iTunes" to artist 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"; echo -E "Listening to $fg[yellow]$currenttrack$reset_color by $fg[yellow]$currentartist$reset_color";
else else
echo "iTunes is" $state; echo "$APP_NAME is" $state;
fi fi
return 0 return 0
;; ;;
@ -284,7 +296,7 @@ if [[ ! -z "$playlist" ]]; then
if [[ -n "$state" && ! "$state" =~ "^(on|off|toggle)$" ]] if [[ -n "$state" && ! "$state" =~ "^(on|off|toggle)$" ]]
then then
print "Usage: itunes shuffle [on|off|toggle]. Invalid option." print "Usage: $0 shuffle [on|off|toggle]. Invalid option."
return 1 return 1
fi fi
@ -305,14 +317,14 @@ EOF
esac esac
;; ;;
""|-h|--help) ""|-h|--help)
echo "Usage: itunes <option>" echo "Usage: $0 <option>"
echo "option:" echo "option:"
echo "\tlaunch|play|pause|stop|rewind|resume|quit" echo "\tlaunch|play|pause|stop|rewind|resume|quit"
echo "\tmute|unmute\tcontrol volume set" echo "\tmute|unmute\tcontrol volume set"
echo "\tnext|previous\tplay next or previous track" 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 "\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 "\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 "\tplaylist [playlist name]\t Play specific playlist"
echo "\thelp\tshow this message and exit" echo "\thelp\tshow this message and exit"
return 0 return 0
@ -322,7 +334,7 @@ EOF
return 1 return 1
;; ;;
esac esac
osascript -e "tell application \"iTunes\" to $opt" osascript -e "tell application \"$APP_NAME\" to $opt"
} }
# Spotify control function # Spotify control function

View File

@ -1,6 +1,6 @@
## percol ## 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 ### Requirements
@ -8,7 +8,7 @@ Provides some useful function to make [percol](https://github.com/mooz/percol) w
pip install percol 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 ### Usage

View File

@ -23,7 +23,8 @@ _togglePipenvShell() {
fi fi
fi fi
} }
chpwd_functions+=(_togglePipenvShell) autoload -U add-zsh-hook
add-zsh-hook chpwd _togglePipenvShell
# Aliases # Aliases
alias pch="pipenv check" alias pch="pipenv check"

View File

@ -18,7 +18,7 @@ plugins=(... rails)
| `rcs` | `rails console --sandbox` | Test code in a sandbox, without changing any data | | `rcs` | `rails console --sandbox` | Test code in a sandbox, without changing any data |
| `rd` | `rails destroy` | Undo a generate operation | | `rd` | `rails destroy` | Undo a generate operation |
| `rdb` | `rails dbconsole` | Interact with your db from the console | | `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 | | `rgm` | `rails generate migration` | Generate a db migration |
| `rp` | `rails plugin` | Run a Rails plugin command | | `rp` | `rails plugin` | Run a Rails plugin command |
| `ru` | `rails runner` | Run Ruby code in the context of Rails | | `ru` | `rails runner` | Run Ruby code in the context of Rails |
@ -44,7 +44,7 @@ plugins=(... rails)
| `rlc` | `rake log:clear` | Clear Rails logs | | `rlc` | `rake log:clear` | Clear Rails logs |
| `rn` | `rake notes` | Search for notes (`FIXME`, `TODO`) in code comments | | `rn` | `rake notes` | Search for notes (`FIXME`, `TODO`) in code comments |
| `rr` | `rake routes` | List all defined routes | | `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 | | `rt` | `rake test` | Run Rails tests |
| `rmd` | `rake middleware` | Interact with Rails middlewares | | `rmd` | `rake middleware` | Interact with Rails middlewares |
| `rsts` | `rake stats` | Print code statistics | | `rsts` | `rake stats` | Print code statistics |

View File

@ -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: 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 > 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)

View File

@ -271,7 +271,7 @@ _salt_comp(){
fi fi
if _cache_invalid salt/salt_dir || ! _retrieve_cache salt/salt_dir; then 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 _store_cache salt/salt_dir salt_dir
fi fi
} }

View File

@ -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 ```console
$ source ~/.zshrc $ exec zsh
$ $
``` ```

View File

@ -1,6 +1,6 @@
#compdef terraform #compdef terraform
local -a _terraform_cmds local -a _terraform_cmds opt_args
_terraform_cmds=( _terraform_cmds=(
'apply:Builds or changes infrastructure' 'apply:Builds or changes infrastructure'
'console:Interactive console for Terraform interpolations' 'console:Interactive console for Terraform interpolations'
@ -16,13 +16,21 @@ _terraform_cmds=(
'push:Upload this Terraform module to Atlas to run' 'push:Upload this Terraform module to Atlas to run'
'refresh:Update local state file against real resources' 'refresh:Update local state file against real resources'
'show:Inspect Terraform state or plan' 'show:Inspect Terraform state or plan'
'state:Advanced state management'
'taint:Manually mark a resource for recreation' 'taint:Manually mark a resource for recreation'
'untaint:Manually unmark a resource as tainted' 'untaint:Manually unmark a resource as tainted'
'validate:Validates the Terraform files' 'validate:Validates the Terraform files'
'version:Prints the Terraform version' 'version:Prints the Terraform version'
'workspace:Workspace management' '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() { __apply() {
_arguments \ _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.]' \ '-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.]' \ '-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=[(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.]' \ '-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[("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.]' '-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.]' \ '-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=[(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.]' \ '-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[("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.]' '-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.]' \ '-parallelism=[(10) Limit the number of concurrent operations.]' \
'-refresh=[(true) Update state prior to checking for differences.]' \ '-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.]' \ '-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[("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.]' \ '-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.]' \ '-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=[(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.]' \ '-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[("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.]' '-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.]' '-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() { __taint() {
_arguments \ _arguments \
'-allow-missing[If specified, the command will succeed (exit code 0) even if the resource is missing.]' \ '-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).]' \ '-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.]' \ '-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=[(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() { __untaint() {
@ -236,6 +309,8 @@ fi
local -a _command_args local -a _command_args
case "$words[1]" in case "$words[1]" in
0.12upgrade)
__012upgrade ;;
apply) apply)
__apply ;; __apply ;;
console) console)
@ -264,6 +339,14 @@ case "$words[1]" in
__refresh ;; __refresh ;;
show) show)
__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)
__taint ;; __taint ;;
untaint) untaint)

View File

@ -6,4 +6,4 @@
Press `ESC` twice to correct previous console command. Press `ESC` twice to correct previous console command.
## Notes ## 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.

View File

@ -25,5 +25,6 @@ __timer_display_timer_precmd() {
fi fi
} }
preexec_functions+=(__timer_save_time_preexec) autoload -U add-zsh-hook
precmd_functions+=(__timer_display_timer_precmd) add-zsh-hook preexec __timer_save_time_preexec
add-zsh-hook precmd __timer_display_timer_precmd

View File

@ -46,6 +46,7 @@ fi
# Set the correct local config file to use. # Set the correct local config file to use.
if [[ "$ZSH_TMUX_ITERM2" == "false" && -e "$ZSH_TMUX_CONFIG" ]]; then if [[ "$ZSH_TMUX_ITERM2" == "false" && -e "$ZSH_TMUX_CONFIG" ]]; then
export ZSH_TMUX_CONFIG
export _ZSH_TMUX_FIXED_CONFIG="${0:h:a}/tmux.extra.conf" export _ZSH_TMUX_FIXED_CONFIG="${0:h:a}/tmux.extra.conf"
else else
export _ZSH_TMUX_FIXED_CONFIG="${0:h:a}/tmux.only.conf" export _ZSH_TMUX_FIXED_CONFIG="${0:h:a}/tmux.only.conf"

View File

@ -21,9 +21,9 @@ Original idea and aliases: [Ruslan Spivak](https://ruslanspivak.wordpress.com/20
## Examples ## Examples
```zsh ```zsh
urlencode 'https://github.com/robbyrussell/oh-my-zsh/search?q=urltools&type=Code' urlencode 'https://github.com/ohmyzsh/ohmyzsh/search?q=urltools&type=Code'
# returns https%3A%2F%2Fgithub.com%2Frobbyrussell%2Foh-my-zsh%2Fsearch%3Fq%3Durltools%26type%3DCode # 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' urldecode 'https%3A%2F%2Fgithub.com%2Fohmyzsh%2Fohmyzsh%2Fsearch%3Fq%3Durltools%26type%3DCode'
# returns https://github.com/robbyrussell/oh-my-zsh/search?q=urltools&type=Code # returns https://github.com/ohmyzsh/ohmyzsh/search?q=urltools&type=Code
``` ```

View File

@ -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 urlencode='node -e "console.log(encodeURIComponent(process.argv[1]))"'
alias urldecode='node -e "console.log(decodeURIComponent(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 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 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, urllib.parse as up; print(up.unquote_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 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 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, urllib as ul; print ul.unquote_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 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 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"} function urldecode() {printf $(echo -n $@ | sed 's/\\/\\\\/g;s/\(%\)\([0-9a-fA-F][0-9a-fA-F]\)/\\x\2/g')"\n"}

View File

@ -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 # Append workon_cwd to the chpwd_functions array, so it will be called on cd
# http://zsh.sourceforge.net/Doc/Release/Functions.html # http://zsh.sourceforge.net/Doc/Release/Functions.html
if ! (( $chpwd_functions[(I)workon_cwd] )); then autoload -U add-zsh-hook
chpwd_functions+=(workon_cwd) add-zsh-hook chpwd workon_cwd
fi
fi fi

View File

@ -13,7 +13,7 @@ wd
### oh-my-zsh ### 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: Just add the plugin in your `~/.zshrc` file:
@ -53,7 +53,7 @@ Run either in terminal:
#### Completion #### 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) fpath=(~/path/to/wd $fpath)
@ -85,7 +85,7 @@ Also, you may have to force a rebuild of `zcompdump` by running:
$ wd ... $ wd ...
This is a wrapper for the zsh `dirs` function. 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: * Remove warp point test point:

View File

@ -7,7 +7,7 @@ export ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load --- if set to "random", it will # 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, # 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 # 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" ZSH_THEME="robbyrussell"
# Set list of themes to pick from when loading at random # Set list of themes to pick from when loading at random

View File

@ -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%})" return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
host_color="%(!.%{$fg[red]%}.%{$fg[green]%})" host_color="%(!.%{$fg[red]%}.%{$fg[green]%})"

View File

@ -28,7 +28,8 @@ prompt_setup_pygmalion(){
base_prompt_nocolor=$(echo "$base_prompt" | perl -pe "s/%\{[^}]+\}//g") base_prompt_nocolor=$(echo "$base_prompt" | perl -pe "s/%\{[^}]+\}//g")
post_prompt_nocolor=$(echo "$post_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(){ prompt_pygmalion_precmd(){
@ -46,5 +47,3 @@ prompt_pygmalion_precmd(){
} }
prompt_setup_pygmalion prompt_setup_pygmalion

View File

@ -12,7 +12,8 @@ prompt_setup_pygmalion(){
base_prompt_nocolor=$(echo "$base_prompt" | perl -pe "s/%\{[^}]+\}//g") base_prompt_nocolor=$(echo "$base_prompt" | perl -pe "s/%\{[^}]+\}//g")
post_prompt_nocolor=$(echo "$post_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(){ prompt_pygmalion_precmd(){
@ -30,5 +31,3 @@ prompt_pygmalion_precmd(){
} }
prompt_setup_pygmalion prompt_setup_pygmalion

View File

@ -1,12 +1,12 @@
#!/bin/sh #!/bin/sh
# #
# This script should be run via curl: # 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: # 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: # 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 # sh install.sh
# #
# You can tweak the install behavior by setting variables when running the script. For # You can tweak the install behavior by setting variables when running the script. For
@ -15,7 +15,7 @@
# #
# Respects the following environment variables: # Respects the following environment variables:
# ZSH - path to the Oh My Zsh repository folder (default: $HOME/.oh-my-zsh) # 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) # REMOTE - full remote URL of the git repo to install (default: GitHub via HTTPS)
# BRANCH - branch to check out immediately after install (default: master) # BRANCH - branch to check out immediately after install (default: master)
# #
@ -33,7 +33,7 @@ set -e
# Default settings # Default settings
ZSH=${ZSH:-~/.oh-my-zsh} ZSH=${ZSH:-~/.oh-my-zsh}
REPO=${REPO:-robbyrussell/oh-my-zsh} REPO=${REPO:-ohmyzsh/ohmyzsh}
REMOTE=${REMOTE:-https://github.com/${REPO}.git} REMOTE=${REMOTE:-https://github.com/${REPO}.git}
BRANCH=${BRANCH:-master} BRANCH=${BRANCH:-master}

View File

@ -31,6 +31,12 @@ git config fsck.zeroPaddedFilemode ignore
git config fetch.fsck.zeroPaddedFilemode ignore git config fetch.fsck.zeroPaddedFilemode ignore
git config receive.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" printf "${BLUE}%s${NORMAL}\n" "Updating Oh My Zsh"
if git pull --rebase --stat origin master if git pull --rebase --stat origin master
then then