Unverified Commit 420e9d78 authored by Aaron N. Brock's avatar Aaron N. Brock Committed by GitHub
Browse files

Merge branch 'master' into colorize-chroma-support

parents 57226778 76d6b025
......@@ -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
......
......@@ -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.
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.
......@@ -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
......
......@@ -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 }
......
......@@ -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
......@@ -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"
......
......@@ -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
$
```
......
......@@ -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'
## 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:
......
......@@ -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).
## 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)
......
......@@ -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 |
......@@ -219,7 +219,19 @@ function vncviewer() {
}
# iTunes control function
function itunes() {
function itunes music() {
local APP_NAME=Music
autoload is-at-least
if is-at-least 10.15 $(sw_vers -productVersion); then
if [[ $0 = itunes ]]; then
echo >&2 The itunes function name is deprecated. Use \`music\' instead.
return 1
fi
else
APP_NAME=iTunes
fi
local opt=$1
local playlist=$2
shift
......@@ -236,7 +248,7 @@ function itunes() {
opt="$opt track"
;;
vol)
local new_volume volume=$(osascript -e 'tell application "iTunes" to get sound volume')
local new_volume volume=$(osascript -e "tell application \"$APP_NAME\" to get sound volume")
if [[ $# -eq 0 ]]; then
echo "Current volume is ${volume}."
return 0
......@@ -251,26 +263,26 @@ function itunes() {
opt="set sound volume to ${new_volume}"
;;
playlist)
# Inspired by: https://gist.github.com/nakajijapan/ac8b45371064ae98ea7f
if [[ ! -z "$playlist" ]]; then
osascript -e 'tell application "iTunes"' -e "set new_playlist to \"$playlist\" as string" -e "play playlist new_playlist" -e "end tell" 2>/dev/null;
# Inspired by: https://gist.github.com/nakajijapan/ac8b45371064ae98ea7f
if [[ ! -z "$playlist" ]]; then
osascript -e "tell application \"$APP_NAME\"" -e "set new_playlist to \"$playlist\" as string" -e "play playlist new_playlist" -e "end tell" 2>/dev/null;
if [[ $? -eq 0 ]]; then
opt="play"
else
opt="stop"
fi
else
opt="set allPlaylists to (get name of every playlist)"
fi
;;
else
opt="set allPlaylists to (get name of every playlist)"
fi
;;
playing|status)
local state=`osascript -e 'tell application "iTunes" to player state as string'`
local state=`osascript -e "tell application \"$APP_NAME\" to player state as string"`
if [[ "$state" = "playing" ]]; then
currenttrack=`osascript -e 'tell application "iTunes" to name of current track as string'`
currentartist=`osascript -e 'tell application "iTunes" to artist of current track as string'`
currenttrack=`osascript -e "tell application \"$APP_NAME\" to name of current track as string"`
currentartist=`osascript -e "tell application \"$APP_NAME\" to artist of current track as string"`
echo -E "Listening to $fg[yellow]$currenttrack$reset_color by $fg[yellow]$currentartist$reset_color";
else
echo "iTunes is" $state;
echo "$APP_NAME is" $state;
fi
return 0
;;
......@@ -284,7 +296,7 @@ if [[ ! -z "$playlist" ]]; then
if [[ -n "$state" && ! "$state" =~ "^(on|off|toggle)$" ]]
then
print "Usage: itunes shuffle [on|off|toggle]. Invalid option."
print "Usage: $0 shuffle [on|off|toggle]. Invalid option."
return 1
fi
......@@ -305,14 +317,14 @@ EOF
esac
;;
""|-h|--help)
echo "Usage: itunes <option>"
echo "Usage: $0 <option>"
echo "option:"
echo "\tlaunch|play|pause|stop|rewind|resume|quit"
echo "\tmute|unmute\tcontrol volume set"
echo "\tnext|previous\tplay next or previous track"
echo "\tshuf|shuffle [on|off|toggle]\tSet shuffled playback. Default: toggle. Note: toggle doesn't support the MiniPlayer."
echo "\tvol [0-100|up|down]\tGet or set the volume. 0 to 100 sets the volume. 'up' / 'down' increases / decreases by 10 points. No argument displays current volume."
echo "\tplaying|status\tShow what song is currently playing in iTunes."
echo "\tplaying|status\tShow what song is currently playing in Music."
echo "\tplaylist [playlist name]\t Play specific playlist"
echo "\thelp\tshow this message and exit"
return 0
......@@ -322,7 +334,7 @@ EOF
return 1
;;
esac
osascript -e "tell application \"iTunes\" to $opt"
osascript -e "tell application \"$APP_NAME\" to $opt"
}
# Spotify control function
......
## percol
Provides some useful function to make [percol](https://github.com/mooz/percol) work with zsh history and [jump plugin](https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/jump/jump.plugin.zsh)
Provides some useful function to make [percol](https://github.com/mooz/percol) work with zsh history and [jump plugin](https://github.com/ohmyzsh/ohmyzsh/blob/master/plugins/jump/jump.plugin.zsh)
### Requirements
......@@ -8,7 +8,7 @@ Provides some useful function to make [percol](https://github.com/mooz/percol) w
pip install percol
```
And [jump](https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/jump/jump.plugin.zsh) for `oh-my-zsh` is a optional requirement.
And [jump](https://github.com/ohmyzsh/ohmyzsh/blob/master/plugins/jump/jump.plugin.zsh) for `oh-my-zsh` is a optional requirement.
### Usage
......
......@@ -23,7 +23,8 @@ _togglePipenvShell() {
fi
fi
}
chpwd_functions+=(_togglePipenvShell)
autoload -U add-zsh-hook
add-zsh-hook chpwd _togglePipenvShell
# Aliases
alias pch="pipenv check"
......
......@@ -18,7 +18,7 @@ plugins=(... rails)
| `rcs` | `rails console --sandbox` | Test code in a sandbox, without changing any data |
| `rd` | `rails destroy` | Undo a generate operation |
| `rdb` | `rails dbconsole` | Interact with your db from the console |
| `rgen` | `rails generate` | Generate boilerplate code |
| `rgen`| `rails generate` | Generate boilerplate code |
| `rgm` | `rails generate migration` | Generate a db migration |
| `rp` | `rails plugin` | Run a Rails plugin command |
| `ru` | `rails runner` | Run Ruby code in the context of Rails |
......@@ -44,7 +44,7 @@ plugins=(... rails)
| `rlc` | `rake log:clear` | Clear Rails logs |
| `rn` | `rake notes` | Search for notes (`FIXME`, `TODO`) in code comments |
| `rr` | `rake routes` | List all defined routes |
| `rrg` | `rake routes | grep` | List and filter the defined routes |
| `rrg` | `rake routes \| grep` | List and filter the defined routes |
| `rt` | `rake test` | Run Rails tests |
| `rmd` | `rake middleware` | Interact with Rails middlewares |
| `rsts` | `rake stats` | Print code statistics |
......
......@@ -34,4 +34,4 @@ The plugin also aliases `rake` to [`jimweirich`](https://github.com/jimweirich),
and big time contributor to the Ruby open source community. He passed away in 2014:
> Thank you Jim for everything you contributed to the Ruby and open source community
> over the years. We will miss you dearly. — [**@robbyrussell**](https://github.com/robbyrussell/oh-my-zsh/commit/598a9c6f990756386517d66b6bcf77e53791e905)
> over the years. We will miss you dearly. — [**@robbyrussell**](https://github.com/ohmyzsh/ohmyzsh/commit/598a9c6f990756386517d66b6bcf77e53791e905)
......@@ -271,7 +271,7 @@ _salt_comp(){
fi
if _cache_invalid salt/salt_dir || ! _retrieve_cache salt/salt_dir; then
salt_dir="${$(python2 -c 'import salt; print(salt.__file__);')%__init__*}"
salt_dir="${$(python2 -c 'import sys; del sys.path[0]; import salt; print(salt.__file__);')%__init__*}"
_store_cache salt/salt_dir salt_dir
fi
}
......
......@@ -13,10 +13,10 @@ Easily prefix your current or previous commands with `sudo` by pressing <kbd>esc
)
```
2. Reload the source file or restart your Terminal session:
2. Restart your shell or restart your Terminal session:
```console
$ source ~/.zshrc
$ exec zsh
$
```
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment