From c840594c6ffdcecc241c9ccb130daeb630831ef7 Mon Sep 17 00:00:00 2001 From: Robert McLeod Date: Fri, 10 Apr 2015 15:07:29 +1200 Subject: [PATCH 001/343] added aliases for vagrant --- plugins/vagrant/vagrant.plugin.zsh | 31 ++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 plugins/vagrant/vagrant.plugin.zsh diff --git a/plugins/vagrant/vagrant.plugin.zsh b/plugins/vagrant/vagrant.plugin.zsh new file mode 100644 index 000000000..a238d9ffe --- /dev/null +++ b/plugins/vagrant/vagrant.plugin.zsh @@ -0,0 +1,31 @@ +alias vgi="vagrant init" + +alias vup="vagrant up" +alias vd="vagrant destroy" +alias vdf="vagrant destroy -f" + +alias vssh="vagrant ssh" +alias vrdp="vagrant rdp" + +alias vh="vagrant halt" +alias vssp="vagrant suspend" +alias vst="vagrant status" +alias vre="vagrant resume" + +alias vpr="vagrant provision" +alias vr="vagrant reload" +alias vrp="vagrant reload --provision" + +alias vp="vagrant push" +alias vsh="vagrant share" + +alias vba="vagrant box add" +alias vbr="vagrant box remove" +alias vbl="vagrant box list" +alias vbo="vagrant box outdated" +alias vbu="vagrant box update" + +alias vpli="vagrant plugin install" +alias vpll="vagrant plugin list" +alias vplun="vagrant plugin uninstall" +alias vplu="vagrant plugin update" From b6ed2e7ac378438689d3348b4be00b2bce4fd9a8 Mon Sep 17 00:00:00 2001 From: Robert McLeod Date: Wed, 8 Jul 2015 07:54:42 +1200 Subject: [PATCH 002/343] added aliases for ssh-config and global-status So the following aliases call the respective commands: vgs = vagrant global-status vsshc = vagrant ssh-config --- plugins/vagrant/vagrant.plugin.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/vagrant/vagrant.plugin.zsh b/plugins/vagrant/vagrant.plugin.zsh index a238d9ffe..a4e9b06c2 100644 --- a/plugins/vagrant/vagrant.plugin.zsh +++ b/plugins/vagrant/vagrant.plugin.zsh @@ -5,12 +5,14 @@ alias vd="vagrant destroy" alias vdf="vagrant destroy -f" alias vssh="vagrant ssh" +alias vsshc="vagrant ssh-config" alias vrdp="vagrant rdp" alias vh="vagrant halt" alias vssp="vagrant suspend" alias vst="vagrant status" alias vre="vagrant resume" +alias vgs="vagrant global-status" alias vpr="vagrant provision" alias vr="vagrant reload" From 9dd76fb6bc29071bd616d9ea32e29ce7b4dcba73 Mon Sep 17 00:00:00 2001 From: spacewander Date: Fri, 23 Sep 2016 12:02:23 +0800 Subject: [PATCH 003/343] add task description to fabric completion --- plugins/fabric/_fab | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/fabric/_fab b/plugins/fabric/_fab index 9628e1224..79d596ed6 100644 --- a/plugins/fabric/_fab +++ b/plugins/fabric/_fab @@ -5,7 +5,10 @@ local curcontext=$curcontext state line declare -A opt_args declare target_list -target_list=(`fab --shortlist 2>/dev/null`) +IFS="$(printf '\n+')" target_list=($(fab -l | awk '{ + if(NR > 2) + printf "%s:%s\n", $1, substr($0, index($0, $2)) +}' 2>/dev/null)) _targets() { _describe -t commands "fabric targets" target_list From 67e0ef7aa6a494b2357c64a204214f7b19fb52e7 Mon Sep 17 00:00:00 2001 From: "GIL B. Chan" Date: Sun, 7 Apr 2019 18:48:22 +0900 Subject: [PATCH 004/343] edit colorize plugin: add `-f terminal` option The option (`pygmentize -f terminal <...>`) lets pygments use terminal color scheme. Otherwise, it would use its default colors, which might be unbalanced with that of terminal (e.g. not harmonious with background color of terminal). --- plugins/colorize/colorize.plugin.zsh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/colorize/colorize.plugin.zsh b/plugins/colorize/colorize.plugin.zsh index 8eede9a94..d52e95c49 100644 --- a/plugins/colorize/colorize.plugin.zsh +++ b/plugins/colorize/colorize.plugin.zsh @@ -9,7 +9,7 @@ colorize_via_pygmentize() { # pygmentize stdin if no arguments passed if [ $# -eq 0 ]; then - pygmentize -g + pygmentize -f terminal -g return $? fi @@ -20,9 +20,9 @@ colorize_via_pygmentize() { do lexer=$(pygmentize -N "$FNAME") if [[ $lexer != text ]]; then - pygmentize -l "$lexer" "$FNAME" + pygmentize -f terminal -l "$lexer" "$FNAME" else - pygmentize -g "$FNAME" + pygmentize -f terminal -g "$FNAME" fi done } From c1446b4750a31506daba7fc7d41957dd515e8022 Mon Sep 17 00:00:00 2001 From: Erik Demaine Date: Sat, 6 Jul 2019 12:10:30 -0400 Subject: [PATCH 005/343] Automatic title: Replace fg with description from jobs --- lib/termsupport.zsh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index aa14f3f07..a74ad9922 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -72,7 +72,19 @@ function omz_termsupport_preexec { local CMD=${1[(wr)^(*=*|sudo|ssh|mosh|rake|-*)]:gs/%/%%} local LINE="${2:gs/%/%%}" - title '$CMD' '%100>...>$LINE%<<' + if [[ "$CMD" = fg ]]; then + # replace fg, possibly with argument, with description from jobs + local JOB + if [[ ${(z)1} = fg ]]; then # no arguments + JOB="$(jobs %%)" + else # arguments + JOB="$(jobs ${${(z)1}[2]})" + fi + JOB="${${(z)JOB}[4,$]}" # trim job number, +, pid, status + title ${JOB:gs/%/%%} ${JOB:gs/%/%%} + else + title '$CMD' '%100>...>$LINE%<<' + fi } precmd_functions+=(omz_termsupport_precmd) From 902e3172c9b991ca0995a0dcd658caa29b918d8e Mon Sep 17 00:00:00 2001 From: Erik Demaine Date: Sun, 7 Jul 2019 10:48:36 -0400 Subject: [PATCH 006/343] Avoid error messages when there is no job --- lib/termsupport.zsh | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index a74ad9922..59a1efb02 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -72,19 +72,22 @@ function omz_termsupport_preexec { local CMD=${1[(wr)^(*=*|sudo|ssh|mosh|rake|-*)]:gs/%/%%} local LINE="${2:gs/%/%%}" + # replace fg, possibly with argument, with description from jobs if [[ "$CMD" = fg ]]; then - # replace fg, possibly with argument, with description from jobs local JOB if [[ ${(z)1} = fg ]]; then # no arguments - JOB="$(jobs %%)" + JOB="$(jobs %% 2>/dev/null)" else # arguments - JOB="$(jobs ${${(z)1}[2]})" + JOB="$(jobs ${${(z)1}[2]} 2>/dev/null)" + fi + if [[ $? -eq 0 ]]; then + JOB="${${(z)JOB}[4,$]}" # trim job number, +, pid, status + title ${JOB:gs/%/%%} ${JOB:gs/%/%%} + return fi - JOB="${${(z)JOB}[4,$]}" # trim job number, +, pid, status - title ${JOB:gs/%/%%} ${JOB:gs/%/%%} - else - title '$CMD' '%100>...>$LINE%<<' fi + + title '$CMD' '%100>...>$LINE%<<' } precmd_functions+=(omz_termsupport_precmd) From d855547661ee4173bd01ab89ad18418d4dbf508a Mon Sep 17 00:00:00 2001 From: Robert Estelle Date: Fri, 12 Jul 2019 17:01:10 -0400 Subject: [PATCH 007/343] clipboard: Reduce unnecessary special-casing on stdin Ideally the parameter would just be removed-users could always just do "clipcopy < some-file". but removing the parameter would break backwards compatibility. In any case, this simplifies the logic considerably. --- lib/clipboard.zsh | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/lib/clipboard.zsh b/lib/clipboard.zsh index 2c93d1bb5..15ad6d916 100644 --- a/lib/clipboard.zsh +++ b/lib/clipboard.zsh @@ -17,32 +17,17 @@ # function clipcopy() { emulate -L zsh - local file=$1 + local file="${1:-/dev/stdin}" + if [[ $OSTYPE == darwin* ]]; then - if [[ -z $file ]]; then - pbcopy - else - cat $file | pbcopy - fi + pbcopy < "${file}" elif [[ $OSTYPE == cygwin* ]]; then - if [[ -z $file ]]; then - cat > /dev/clipboard - else - cat $file > /dev/clipboard - fi + cat "${file}" > /dev/clipboard else if (( $+commands[xclip] )); then - if [[ -z $file ]]; then - xclip -in -selection clipboard - else - xclip -in -selection clipboard $file - fi + xclip -in -selection clipboard < "${file}" elif (( $+commands[xsel] )); then - if [[ -z $file ]]; then - xsel --clipboard --input - else - cat "$file" | xsel --clipboard --input - fi + xsel --clipboard --input < "${file}" else print "clipcopy: Platform $OSTYPE not supported or xclip/xsel not installed" >&2 return 1 From 956ca639bba5780dc6272e76b0507c67e93c098b Mon Sep 17 00:00:00 2001 From: Robert Estelle Date: Fri, 12 Jul 2019 17:16:01 -0400 Subject: [PATCH 008/343] clipboard: Avoid unnecessary re-detection each time Previously, OS detection would happen on each invocation. This makes it happen once (unless it fails, in which case it will try again on the next invocation). This has the additional benefit of localizing the platform-specific checks and commands, too, versus spreading them out in separate functions. --- lib/clipboard.zsh | 65 +++++++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 31 deletions(-) diff --git a/lib/clipboard.zsh b/lib/clipboard.zsh index 15ad6d916..512a5a248 100644 --- a/lib/clipboard.zsh +++ b/lib/clipboard.zsh @@ -15,26 +15,9 @@ # # clipcopy - copies a file's contents to clipboard # -function clipcopy() { - emulate -L zsh - local file="${1:-/dev/stdin}" - - if [[ $OSTYPE == darwin* ]]; then - pbcopy < "${file}" - elif [[ $OSTYPE == cygwin* ]]; then - cat "${file}" > /dev/clipboard - else - if (( $+commands[xclip] )); then - xclip -in -selection clipboard < "${file}" - elif (( $+commands[xsel] )); then - xsel --clipboard --input < "${file}" - else - print "clipcopy: Platform $OSTYPE not supported or xclip/xsel not installed" >&2 - return 1 - fi - fi -} - +# +## +# # clippaste - "Paste" data from clipboard to stdout # # Usage: @@ -52,20 +35,40 @@ function clipcopy() { # # # Paste to a file # clippaste > file.txt -function clippaste() { +# +function detect-clipboard() { emulate -L zsh + if [[ $OSTYPE == darwin* ]]; then - pbpaste + function clipcopy() { pbcopy < "${1:-/dev/stdin}"; } + function clippaste() { pbpaste; } elif [[ $OSTYPE == cygwin* ]]; then - cat /dev/clipboard + function clipcopy() { cat "${1:-/dev/stdin}" > /dev/clipboard; } + function clippaste() { cat /dev/clipboard; } + elif (( $+commands[xclip] )); then + function clipcopy() { xclip -in -selection clipboard < "${1:-/dev/stdin}"; } + function clippaste() { xclip -out -selection clipboard; } + elif (( $+commands[xsel] )); then + function clipcopy() { xsel --clipboard --input < "${1:-/dev/stdin}"; } + function clippaste() { xsel --clipboard --output; } else - if (( $+commands[xclip] )); then - xclip -out -selection clipboard - elif (( $+commands[xsel] )); then - xsel --clipboard --output - else - print "clipcopy: Platform $OSTYPE not supported or xclip/xsel not installed" >&2 - return 1 - fi + function _retry_clipboard_detection_or_fail() { + local clipcmd="${1}"; shift + if detect-clipboard; then + "${clipcmd}" "$@" + else + print "${clipcmd}: Platform $OSTYPE not supported or xclip/xsel not installed" >&2 + return 1 + fi + } + function clipcopy() { _retry_clipboard_detection_or_fail clipcopy "$@"; } + function cilppaste() { _retry_clipboard_detection_or_fail clippaste "$@"; } + return 1 fi } + +# Detect at startup. A non-zero exit here indicates that the dummy clipboards were set, +# which is not really an error. If the user calls them, they will attempt to redetect +# (for example, perhaps the user has now installed xclip) and then either print an error +# or proceed successfully. +detect-clipboard || true From 01e934d6346a93acd6b4343de3256d5ba82c5961 Mon Sep 17 00:00:00 2001 From: Robert Estelle Date: Fri, 12 Jul 2019 17:39:16 -0400 Subject: [PATCH 009/343] clipboard: Add support for several more clipboards This implements essentially the same heuristic as neovim, with the additional (existing) special support for Cygwin. See: https://github.com/neovim/neovim/blob/e682d799fa3cf2e80a02d00c6ea874599d58f0e7/runtime/autoload/provider/clipboard.vim#L55-L121 - pbcopy, pbpaste (macOS) - cygwin (Windows running Cygwin) - wl-copy, wl-paste (if $WAYLAND_DISPLAY is set) - xclip (if $DISPLAY is set) - xsel (if $DISPLAY is set) - lemonade (for SSH) https://github.com/pocke/lemonade - doitclient (for SSH) http://www.chiark.greenend.org.uk/~sgtatham/doit/ - win32yank (Windows) - tmux (if $TMUX is set) --- lib/clipboard.zsh | 47 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 37 insertions(+), 10 deletions(-) diff --git a/lib/clipboard.zsh b/lib/clipboard.zsh index 512a5a248..17d8d1aaf 100644 --- a/lib/clipboard.zsh +++ b/lib/clipboard.zsh @@ -3,10 +3,23 @@ # This file has support for doing system clipboard copy and paste operations # from the command line in a generic cross-platform fashion. # -# On OS X and Windows, the main system clipboard or "pasteboard" is used. On other -# Unix-like OSes, this considers the X Windows CLIPBOARD selection to be the -# "system clipboard", and the X Windows `xclip` command must be installed. - +# This is uses essentially the same heuristic as neovim, with the additional +# special support for Cygwin. +# See: https://github.com/neovim/neovim/blob/e682d799fa3cf2e80a02d00c6ea874599d58f0e7/runtime/autoload/provider/clipboard.vim#L55-L121 +# +# - pbcopy, pbpaste (macOS) +# - cygwin (Windows running Cygwin) +# - wl-copy, wl-paste (if $WAYLAND_DISPLAY is set) +# - xclip (if $DISPLAY is set) +# - xsel (if $DISPLAY is set) +# - lemonade (for SSH) https://github.com/pocke/lemonade +# - doitclient (for SSH) http://www.chiark.greenend.org.uk/~sgtatham/doit/ +# - win32yank (Windows) +# - tmux (if $TMUX is set) +# +# Defines two functions, clipcopy and clippaste, based on the detected platform. +## +# # clipcopy - Copy data to clipboard # # Usage: @@ -15,7 +28,6 @@ # # clipcopy - copies a file's contents to clipboard # -# ## # # clippaste - "Paste" data from clipboard to stdout @@ -39,18 +51,33 @@ function detect-clipboard() { emulate -L zsh - if [[ $OSTYPE == darwin* ]]; then + if [[ "${OSTYPE}" == darwin* ]] && (( ${+commands[pbcopy]} )) && (( ${+commands[pbpaste]} )); then function clipcopy() { pbcopy < "${1:-/dev/stdin}"; } function clippaste() { pbpaste; } - elif [[ $OSTYPE == cygwin* ]]; then + elif [[ "${OSTYPE}" == cygwin* ]]; then function clipcopy() { cat "${1:-/dev/stdin}" > /dev/clipboard; } function clippaste() { cat /dev/clipboard; } - elif (( $+commands[xclip] )); then + elif [ -n "${WAYLAND_DISPLAY:-}" ] && (( ${+commands[wl-copy]} )) && (( ${+commands[wl-paste]} )); then + function clipcopy() { wl-copy < "${1:-/dev/stdin}"; } + function clippaste() { wl-paste; } + elif [ -n "${DISPLAY:-}" ] && (( ${+commands[xclip]} )); then function clipcopy() { xclip -in -selection clipboard < "${1:-/dev/stdin}"; } function clippaste() { xclip -out -selection clipboard; } - elif (( $+commands[xsel] )); then - function clipcopy() { xsel --clipboard --input < "${1:-/dev/stdin}"; } + elif [ -n "${DISPLAY:-}" ] && $(( ${+commands[xsel]} )); then + function clipcopy() { xsel --clipboard --input < "${1:-/dev/stdin}"; } function clippaste() { xsel --clipboard --output; } + elif (( ${+commands[lemonade]} )); then + function clipcopy() { lemonade copy < "${1:-/dev/stdin}"; } + function clippaste() { lemonade paste; } + elif (( ${+commands[doitclient]} )); then + function clipcopy() { doitclient wclip < "${1:-/dev/stdin}"; } + function clippaste() { doitclient wclip -r; } + elif (( ${+commands[win32yank]} )); then + function clipcopy() { win32yank -i < "${1:-/dev/stdin}"; } + function clippaste() { win32yank -o; } + elif [ -n "${TMUX:-}" ] && (( ${+commands[tmux]} )); then + function clipcopy() { tmux load-buffer "${1:-/dev/stdin}"; } + function clippaste() { tmux save-buffer -; } else function _retry_clipboard_detection_or_fail() { local clipcmd="${1}"; shift From d71d3d99050fa2b658f41602b830c971235b9202 Mon Sep 17 00:00:00 2001 From: Robert Estelle Date: Sun, 14 Jul 2019 12:52:47 -0400 Subject: [PATCH 010/343] clipboard: Fix "cilppaste" -> "clippaste" typo --- lib/clipboard.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/clipboard.zsh b/lib/clipboard.zsh index 17d8d1aaf..671d33d8e 100644 --- a/lib/clipboard.zsh +++ b/lib/clipboard.zsh @@ -89,7 +89,7 @@ function detect-clipboard() { fi } function clipcopy() { _retry_clipboard_detection_or_fail clipcopy "$@"; } - function cilppaste() { _retry_clipboard_detection_or_fail clippaste "$@"; } + function clippaste() { _retry_clipboard_detection_or_fail clippaste "$@"; } return 1 fi } From 841008c947d5fbe780111539804945c46dcdfaf4 Mon Sep 17 00:00:00 2001 From: Robert Estelle Date: Sun, 14 Jul 2019 12:53:27 -0400 Subject: [PATCH 011/343] clipboard: Fix tmux clipcopy after testing Tmux must have special handling for /dev/stdin since it's managing the terminal itself. This was tested with tmux-2.9a on macOS. --- lib/clipboard.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/clipboard.zsh b/lib/clipboard.zsh index 671d33d8e..5001f4695 100644 --- a/lib/clipboard.zsh +++ b/lib/clipboard.zsh @@ -76,7 +76,7 @@ function detect-clipboard() { function clipcopy() { win32yank -i < "${1:-/dev/stdin}"; } function clippaste() { win32yank -o; } elif [ -n "${TMUX:-}" ] && (( ${+commands[tmux]} )); then - function clipcopy() { tmux load-buffer "${1:-/dev/stdin}"; } + function clipcopy() { tmux load-buffer "${1:--}"; } function clippaste() { tmux save-buffer -; } else function _retry_clipboard_detection_or_fail() { From d81cd753e0b3a845e8f3549da245dbad102a6e4c Mon Sep 17 00:00:00 2001 From: Robert Estelle Date: Sun, 14 Jul 2019 12:56:48 -0400 Subject: [PATCH 012/343] clipboard: Fix bad expansion of exit-code test --- lib/clipboard.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/clipboard.zsh b/lib/clipboard.zsh index 5001f4695..333f58dd8 100644 --- a/lib/clipboard.zsh +++ b/lib/clipboard.zsh @@ -63,7 +63,7 @@ function detect-clipboard() { elif [ -n "${DISPLAY:-}" ] && (( ${+commands[xclip]} )); then function clipcopy() { xclip -in -selection clipboard < "${1:-/dev/stdin}"; } function clippaste() { xclip -out -selection clipboard; } - elif [ -n "${DISPLAY:-}" ] && $(( ${+commands[xsel]} )); then + elif [ -n "${DISPLAY:-}" ] && (( ${+commands[xsel]} )); then function clipcopy() { xsel --clipboard --input < "${1:-/dev/stdin}"; } function clippaste() { xsel --clipboard --output; } elif (( ${+commands[lemonade]} )); then From eaa682c0a64daad3138e6f08e7b6c8825700049f Mon Sep 17 00:00:00 2001 From: Lukasz Chrzaszcz Date: Thu, 24 Oct 2019 17:42:33 +0200 Subject: [PATCH 013/343] Add profiles documentation --- plugins/profiles/README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 plugins/profiles/README.md diff --git a/plugins/profiles/README.md b/plugins/profiles/README.md new file mode 100644 index 000000000..b590a370f --- /dev/null +++ b/plugins/profiles/README.md @@ -0,0 +1,21 @@ +# profiles plugin + +This plugin allows you to create separate configuration files for zsh based +on a domain of your host. + +It takes your `HOST` and looks for files named according to the domain parts +in `$ZSH_CUSTOM/profiles/` directory. + +For example, for `HOST=my.domain.com`, it will try to load the following files: + +```text +$ZSH_CUSTOM/profiles/my.domain.com +$ZSH_CUSTOM/profiles/domain.com +$ZSH_CUSTOM/profiles/com +``` + +To use it, add profiles to the plugins array of your zshrc file: + +```sh +plugins=(... profiles) +``` From 225425fe091ca052997833279ccc08643818c24a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 24 Oct 2019 17:56:08 +0200 Subject: [PATCH 014/343] Fix target_list creation. Supports fabric 1 and 2 --- plugins/fabric/_fab | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/plugins/fabric/_fab b/plugins/fabric/_fab index 79d596ed6..89e73e58b 100644 --- a/plugins/fabric/_fab +++ b/plugins/fabric/_fab @@ -4,13 +4,19 @@ local curcontext=$curcontext state line declare -A opt_args -declare target_list -IFS="$(printf '\n+')" target_list=($(fab -l | awk '{ - if(NR > 2) - printf "%s:%s\n", $1, substr($0, index($0, $2)) -}' 2>/dev/null)) +declare -a target_list +target_list=("${(@f)$(fab -l 2>/dev/null | awk '{ + if (NF == 0 || NR == 1) return + if (NF < 2) print $1 + else { + docstring=substr($0, index($0,$2)) + gsub(":", "\\:", docstring) + print $1":"docstring + } +}')}") -_targets() { +_fab_targets() { + [[ -n "$target_list" ]] || return _describe -t commands "fabric targets" target_list } @@ -31,7 +37,7 @@ _arguments -w -S -C \ '(-)--shortlist[print non-verbose list of possible commands and exit]: :->noargs' \ '(--reject-unknown-hosts)--reject-unknown-hosts[reject unknown hosts]' \ '(--no-pty)--no-pty[do not use pseudo-terminal in run/sudo]' \ - "(-d+ --display=-)"{-d+,--display=-}"[print detailed info about a given command]: :_targets" \ + "(-d+ --display=-)"{-d+,--display=-}"[print detailed info about a given command]: :_fab_targets" \ '(-D --disable-known-hosts)'{-D,--disable-known-hosts}'[do not load user known_hosts file]' \ '(-r --reject-unknown-hosts)'{-r,--reject-unknown-hosts}'[reject unknown hosts]' \ '(-u+ --user=-)'{-u+,--user=-}'[username to use when connecting to remote hosts]: :' \ @@ -56,7 +62,7 @@ if [[ CURRENT -ge 1 ]]; then levels) _describe -t commands "output levels" output_levels;; *) - _targets;; + _fab_targets;; esac return From 4eab95f08a7bd9f5378568a3b7740dae803dcecc Mon Sep 17 00:00:00 2001 From: Anton Balaniuc Date: Fri, 25 Oct 2019 11:59:53 +0100 Subject: [PATCH 015/343] mvn: add autocompletion for openliberty (#8244) --- plugins/mvn/mvn.plugin.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index 01aef814d..0866e5553 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -267,6 +267,8 @@ function listMavenCompletions { stage:copy # toolchain toolchain:toolchain + #liberty + liberty:clean-server liberty:compile-jsp liberty:configure-arquillian liberty:create-server liberty:debug liberty:debug-server liberty:deploy liberty:dev liberty:display-url liberty:dump-server liberty:install-apps liberty:install-feature liberty:install-server liberty:java-dump-server liberty:package-server liberty:run liberty:run-server liberty:server-status liberty:start liberty:start-server liberty:status liberty:stop liberty:stop-server liberty:test-start-server liberty:test-stop-server liberty:undeploy liberty:uninstall-feature # options "-Dmaven.test.skip=true" -DskipTests -DskipITs -Dmaven.surefire.debug -DenableCiProfile "-Dpmd.skip=true" "-Dcheckstyle.skip=true" "-Dtycho.mode=maven" "-Dmaven.test.failure.ignore=true" "-DgroupId=" "-DartifactId=" "-Dversion=" "-Dpackaging=jar" "-Dfile=" From c1e5cbed5bbefbe09608581d0b47774652221780 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Fri, 25 Oct 2019 13:14:36 +0200 Subject: [PATCH 016/343] Fix order and reword some things --- plugins/profiles/README.md | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/plugins/profiles/README.md b/plugins/profiles/README.md index b590a370f..5aa1918e2 100644 --- a/plugins/profiles/README.md +++ b/plugins/profiles/README.md @@ -1,21 +1,25 @@ # profiles plugin This plugin allows you to create separate configuration files for zsh based -on a domain of your host. - -It takes your `HOST` and looks for files named according to the domain parts -in `$ZSH_CUSTOM/profiles/` directory. - -For example, for `HOST=my.domain.com`, it will try to load the following files: - -```text -$ZSH_CUSTOM/profiles/my.domain.com -$ZSH_CUSTOM/profiles/domain.com -$ZSH_CUSTOM/profiles/com -``` +on your long hostname (including the domain). To use it, add profiles to the plugins array of your zshrc file: ```sh plugins=(... profiles) ``` + +It takes your `$HOST` variable and looks for files named according to the +domain parts in `$ZSH_CUSTOM/profiles/` directory. + +For example, for `HOST=host.domain.com`, it will try to load the following files, +in this order: + +```text +$ZSH_CUSTOM/profiles/com +$ZSH_CUSTOM/profiles/domain.com +$ZSH_CUSTOM/profiles/host.domain.com +``` + +This means that if there are conflicting settings on those files, the one to take +precedence will be the last applied, i.e. the one in host.domain.com. From 36092aac0c3e1979caf4afb9fa9bd2115f404fc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Chrz=C4=85szcz?= Date: Fri, 25 Oct 2019 13:14:53 +0200 Subject: [PATCH 017/343] powder: add README (#8310) --- plugins/powder/README.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 plugins/powder/README.md diff --git a/plugins/powder/README.md b/plugins/powder/README.md new file mode 100644 index 000000000..a83b1f2d3 --- /dev/null +++ b/plugins/powder/README.md @@ -0,0 +1,8 @@ +# Powder + +This plugin provides completion for [powder](https://github.com/powder-rb/powder/). + +To use it, add powder to the plugins array of your zshrc file: +``` +plugins=(... powder) +``` From 9785d24172a8cc558e90dd266e37ef5ffa29aa80 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 25 Oct 2019 11:24:35 +0000 Subject: [PATCH 018/343] python: fix and extend pyclean (#7762) Deleting `.mypy_cache` did not work, because the directories were not empty. They contain JSON files instead of compiled byte-code. This extends the cleanup by also getting rid of `.pytest_cache` directories. --- plugins/python/python.plugin.zsh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/python/python.plugin.zsh b/plugins/python/python.plugin.zsh index 950b0e01a..f39cd80b7 100644 --- a/plugins/python/python.plugin.zsh +++ b/plugins/python/python.plugin.zsh @@ -1,13 +1,14 @@ # Find python file alias pyfind='find . -name "*.py"' -# Remove python compiled byte-code and mypy cache in either current directory or in a -# list of specified directories +# Remove python compiled byte-code and mypy/pytest cache in either the current +# directory or in a list of specified directories (including sub directories). function pyclean() { ZSH_PYCLEAN_PLACES=${*:-'.'} find ${ZSH_PYCLEAN_PLACES} -type f -name "*.py[co]" -delete find ${ZSH_PYCLEAN_PLACES} -type d -name "__pycache__" -delete - find ${ZSH_PYCLEAN_PLACES} -type d -name ".mypy_cache" -delete + find ${ZSH_PYCLEAN_PLACES} -depth -type d -name ".mypy_cache" -exec rm -r "{}" + + find ${ZSH_PYCLEAN_PLACES} -depth -type d -name ".pytest_cache" -exec rm -r "{}" + } # Grep among .py files From e363109a6d3367d8be1dd66f05a38eb38b4257d7 Mon Sep 17 00:00:00 2001 From: Vice Versa <0x7c48@gmail.com> Date: Sun, 27 Oct 2019 18:36:00 +0200 Subject: [PATCH 019/343] alias-finder: fix wc numeric conditional (#8251) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Never use `[[` for numeric comparisons, for that, we’ll use `((`. --- plugins/alias-finder/alias-finder.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/alias-finder/alias-finder.plugin.zsh b/plugins/alias-finder/alias-finder.plugin.zsh index 2bfaad597..6b8fa66ce 100644 --- a/plugins/alias-finder/alias-finder.plugin.zsh +++ b/plugins/alias-finder/alias-finder.plugin.zsh @@ -14,7 +14,7 @@ alias-finder() { esac done cmd=$(sed 's/[].\|$(){}?+*^[]/\\&/g' <<< $cmd) # adds escaping for grep - if [[ $(wc -l <<< $cmd) == 1 ]]; then + if (( $(wc -l <<< $cmd) == 1 )); then while [[ $cmd != "" ]]; do if [[ $longer = true ]]; then wordStart="'{0,1}" From 687c50bdf999f8efd45f3c8f578a62329b0633da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 30 Oct 2019 23:12:45 +0100 Subject: [PATCH 020/343] fabric: fix awk "return not in function" error in completion Fixes #8337 --- plugins/fabric/_fab | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/fabric/_fab b/plugins/fabric/_fab index 89e73e58b..9102dadef 100644 --- a/plugins/fabric/_fab +++ b/plugins/fabric/_fab @@ -6,7 +6,7 @@ declare -A opt_args declare -a target_list target_list=("${(@f)$(fab -l 2>/dev/null | awk '{ - if (NF == 0 || NR == 1) return + if (NF == 0 || NR == 1) next if (NF < 2) print $1 else { docstring=substr($0, index($0,$2)) From 0ec59e25c7f6ac11d0988082fef908ff753126a2 Mon Sep 17 00:00:00 2001 From: Sudhin MN <34642968+sudhinm@users.noreply.github.com> Date: Tue, 5 Nov 2019 17:57:19 +0530 Subject: [PATCH 021/343] fasd: add README (#8334) --- plugins/fasd/README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 plugins/fasd/README.md diff --git a/plugins/fasd/README.md b/plugins/fasd/README.md new file mode 100644 index 000000000..1641a92d0 --- /dev/null +++ b/plugins/fasd/README.md @@ -0,0 +1,21 @@ +# fasd + +[`Fasd`](https://github.com/clvv/fasd) (pronounced similar to "fast") is a command-line productivity booster. Fasd offers quick access to files and directories for POSIX shells. + +To use it, add `fasd` to the plugins array in your zshrc file: + +```zsh +plugins=(... fd) +``` + +## Installation + +Please find detailed installation guide [`here`](https://github.com/clvv/fasd#install) + +## Aliases + +| Alias | Command | Description | +|-------|-------------------------------------------|-------------------------------------------------------------| +| v | `fasd -f -e "$EDITOR"` | List frequent/recent files matching the given filename. | +| o | `fasd -a -e xdg-open` | List frequent/recent files and directories matching. | +| j | `fasd_cd -d -i` | cd with interactive selection | \ No newline at end of file From 7cc3a32bff9b283bf5eea139b92cbfddf3b75de5 Mon Sep 17 00:00:00 2001 From: Wang Guan Date: Thu, 31 Oct 2013 05:46:27 +0900 Subject: [PATCH 022/343] Add an option about git submodules to ignore $GIT_STATUS_IGNORE_SUBMODULES can be used to specify handling of submodules. It can be: not set : ignore dirty submodules (this was default zsh behavior) "git" : do not use "--ignore-submodules" and let git choose, this obeys setting in .gitmodules other : comes into "--ignore-submodules=$GIT_STATUS_IGNORE_SUBMODULES" --- lib/git.zsh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/git.zsh b/lib/git.zsh index 640561e97..e8ef0d78d 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -17,6 +17,19 @@ function parse_git_dirty() { if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" == "true" ]]; then FLAGS+='--untracked-files=no' fi + case "$GIT_STATUS_IGNORE_SUBMODULES" in + "") + # if unset: ignore dirty submodules + FLAGS+="--ignore-submodules=dirty" + ;; + "git") + # let git decide (this respects per-repo config in .gitmodules) + ;; + *) + # other values are passed to --ignore-submodules + FLAGS+="--ignore-submodules=$GIT_STATUS_IGNORE_SUBMODULES" + ;; + esac STATUS=$(command git status ${FLAGS} 2> /dev/null | tail -n1) fi if [[ -n $STATUS ]]; then From b7e37cea90b2bc718c66f90c0f9d52d1aa49ca79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 6 Nov 2019 19:41:13 +0100 Subject: [PATCH 023/343] Clean up ignore submodules logic in parse_git_dirty --- lib/git.zsh | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/git.zsh b/lib/git.zsh index e8ef0d78d..7affdec68 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -18,16 +18,13 @@ function parse_git_dirty() { FLAGS+='--untracked-files=no' fi case "$GIT_STATUS_IGNORE_SUBMODULES" in - "") - # if unset: ignore dirty submodules - FLAGS+="--ignore-submodules=dirty" - ;; - "git") + git) # let git decide (this respects per-repo config in .gitmodules) ;; *) + # if unset: ignore dirty submodules # other values are passed to --ignore-submodules - FLAGS+="--ignore-submodules=$GIT_STATUS_IGNORE_SUBMODULES" + FLAGS+="--ignore-submodules=${GIT_STATUS_IGNORE_SUBMODULES:-dirty}" ;; esac STATUS=$(command git status ${FLAGS} 2> /dev/null | tail -n1) From 1546e1226a7b739776bda43f264b221739ba0397 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 6 Nov 2019 19:46:52 +0100 Subject: [PATCH 024/343] Fix badly resolved rebase conflict --- lib/git.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/git.zsh b/lib/git.zsh index 7affdec68..2054fe272 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -12,7 +12,7 @@ function git_prompt_info() { function parse_git_dirty() { local STATUS local -a FLAGS - FLAGS=('--porcelain' '--ignore-submodules=dirty') + FLAGS=('--porcelain') if [[ "$(command git config --get oh-my-zsh.hide-dirty)" != "1" ]]; then if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" == "true" ]]; then FLAGS+='--untracked-files=no' From fc99e6db3e917a0556afe56273c901220c8105a9 Mon Sep 17 00:00:00 2001 From: Eric Dobbs Date: Wed, 6 Nov 2019 12:25:36 -0700 Subject: [PATCH 025/343] emacs: support BSD mktemp in emacsclient.sh (#8351) Piping stdin to emacs alias on MacOS was breaking (--tmpdir is not supported in BSD flavored mktemp). Tested in MacOS 10.14 and debian:buster to confirm it still works in linux. --- plugins/emacs/emacsclient.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/emacs/emacsclient.sh b/plugins/emacs/emacsclient.sh index 26b28d495..0aa8d6f40 100755 --- a/plugins/emacs/emacsclient.sh +++ b/plugins/emacs/emacsclient.sh @@ -20,7 +20,8 @@ _emacsfun() # tempfile. (first argument will be `--no-wait` passed in by the plugin.zsh) if [ "$#" -ge "2" -a "$2" = "-" ] then - tempfile="$(mktemp emacs-stdin-$USER.XXXXXXX --tmpdir)" + tempfile="$(mktemp --tmpdir emacs-stdin-$USER.XXXXXXX 2>/dev/null \ + || mktemp -t emacs-stdin-$USER)" # support BSD mktemp cat - > "$tempfile" _emacsfun --no-wait $tempfile else From 107e512c9e62b140d8591c578527c901b1db9d37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 6 Nov 2019 21:22:15 +0100 Subject: [PATCH 026/343] Remove line below copyright so that GitHub shows LICENSE details --- LICENSE.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/LICENSE.txt b/LICENSE.txt index 4d465b1c3..eb9978a7a 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,7 +1,6 @@ -The MIT License (MIT) +MIT License -Copyright (c) 2009-2019 Robby Russell and contributors -See the full list at https://github.com/robbyrussell/oh-my-zsh/contributors +Copyright (c) 2009-2019 Robby Russell and contributors (https://github.com/robbyrussell/oh-my-zsh/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 From ef96a38fa599c983823f0e1ef530de847ee76da0 Mon Sep 17 00:00:00 2001 From: Isaac Clayton Date: Fri, 8 Nov 2019 22:42:02 +0800 Subject: [PATCH 027/343] Upgrade some URLs to HTTPS (#8202) * Update http to https in Solarized * Upgrade http to https for 'Burger In Your Shell' * Upgrade http to https for tmux.github.io --- plugins/emoji-clock/emoji-clock.plugin.zsh | 2 +- plugins/tmux/README.md | 2 +- themes/sunrise.zsh-theme | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/emoji-clock/emoji-clock.plugin.zsh b/plugins/emoji-clock/emoji-clock.plugin.zsh index 0a55528f0..bdd606f89 100644 --- a/plugins/emoji-clock/emoji-clock.plugin.zsh +++ b/plugins/emoji-clock/emoji-clock.plugin.zsh @@ -2,7 +2,7 @@ # FILE: emoji-clock.plugin.zsh # DESCRIPTION: The current time with half hour accuracy as an emoji symbol. # Inspired by Andre Torrez' "Put A Burger In Your Shell" -# http://notes.torrez.org/2013/04/put-a-burger-in-your-shell.html +# https://notes.torrez.org/2013/04/put-a-burger-in-your-shell.html # AUTHOR: Alexis Hildebrandt (afh[at]surryhill.net) # VERSION: 1.0.0 # ----------------------------------------------------------------------------- diff --git a/plugins/tmux/README.md b/plugins/tmux/README.md index 427119d3d..e887ceebb 100644 --- a/plugins/tmux/README.md +++ b/plugins/tmux/README.md @@ -1,6 +1,6 @@ # tmux -This plugin provides aliases for [tmux](http://tmux.github.io/), the terminal multiplexer. +This plugin provides aliases for [tmux](https://tmux.github.io/), the terminal multiplexer. To use it add `tmux` to the plugins array in your zshrc file. ```zsh diff --git a/themes/sunrise.zsh-theme b/themes/sunrise.zsh-theme index e3f4019d6..2111576c3 100644 --- a/themes/sunrise.zsh-theme +++ b/themes/sunrise.zsh-theme @@ -1,5 +1,5 @@ # Sunrise theme for oh-my-zsh -# Intended to be used with Solarized: http://ethanschoonover.com/solarized +# Intended to be used with Solarized: https://ethanschoonover.com/solarized # Color shortcuts R=$fg_no_bold[red] From 86b39cfa0a42cd0962be2b8072e73229280c362b Mon Sep 17 00:00:00 2001 From: StelFux <22601105+StelFux@users.noreply.github.com> Date: Fri, 8 Nov 2019 21:44:44 +0100 Subject: [PATCH 028/343] tmux: allow to define a custom configuration path (#7606) --- plugins/tmux/README.md | 1 + plugins/tmux/tmux.extra.conf | 2 +- plugins/tmux/tmux.plugin.zsh | 9 ++++++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/plugins/tmux/README.md b/plugins/tmux/README.md index e887ceebb..1e25af38f 100644 --- a/plugins/tmux/README.md +++ b/plugins/tmux/README.md @@ -37,3 +37,4 @@ The plugin also supports the following - | `ZSH_TMUX_ITERM2` | Sets the `-CC` option for iTerm2 tmux integration (default: `false`) | | `ZSH_TMUX_FIXTERM_WITHOUT_256COLOR` | `$TERM` to use for non 256-color terminals (default: `screen`) | | `ZSH_TMUX_FIXTERM_WITH_256COLOR` | `$TERM` to use for 256-color terminals (default: `screen-256color` | +| `ZSH_TMUX_CONFIG` | Set the configuration path (default: `$HOME/.tmux.conf`) | \ No newline at end of file diff --git a/plugins/tmux/tmux.extra.conf b/plugins/tmux/tmux.extra.conf index beffd380c..3420d19d4 100644 --- a/plugins/tmux/tmux.extra.conf +++ b/plugins/tmux/tmux.extra.conf @@ -1,2 +1,2 @@ set -g default-terminal $ZSH_TMUX_TERM -source $HOME/.tmux.conf +source $ZSH_TMUX_CONFIG \ No newline at end of file diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index 2f3c3e79d..d7b299690 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -34,6 +34,8 @@ alias tkss='tmux kill-session -t' # Tmux states this should be screen-256color, but you may need to change it on # systems without the proper terminfo : ${ZSH_TMUX_FIXTERM_WITH_256COLOR:=screen-256color} +# Set the configuration path +: ${ZSH_TMUX_CONFIG:=$HOME/.tmux.conf} # Determine if the terminal supports 256 colors if [[ $terminfo[colors] == 256 ]]; then @@ -43,7 +45,7 @@ else fi # Set the correct local config file to use. -if [[ "$ZSH_TMUX_ITERM2" == "false" && -e "$HOME/.tmux.conf" ]]; then +if [[ "$ZSH_TMUX_ITERM2" == "false" && -e "$ZSH_TMUX_CONFIG" ]]; then export _ZSH_TMUX_FIXED_CONFIG="${0:h:a}/tmux.extra.conf" else export _ZSH_TMUX_FIXED_CONFIG="${0:h:a}/tmux.only.conf" @@ -65,8 +67,9 @@ function _zsh_tmux_plugin_run() { # If failed, just run tmux, fixing the TERM variable if requested. if [[ $? -ne 0 ]]; then - [[ "$ZSH_TMUX_FIXTERM" == "true" ]] && tmux_cmd+=(-f "$_ZSH_TMUX_FIXED_CONFIG") - $tmux_cmd new-session + [[ "$ZSH_TMUX_FIXTERM" == "true" ]] && tmux_cmd+=(-f "$_ZSH_TMUX_FIXED_CONFIG") || \ + [[ -e "$ZSH_TMUX_CONFIG" ]] && tmux_cmd+=(-f "$ZSH_TMUX_CONFIG") + $tmux_cmd new-session fi if [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]]; then From 24726678dd39ab69f5a14a789775fe53ccfd7c1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sat, 9 Nov 2019 12:37:41 +0100 Subject: [PATCH 029/343] extract: keep *.gz files with pigz and gunzip Fixes #8368 --- plugins/extract/extract.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh index 5e9b9ff24..d3d847daf 100644 --- a/plugins/extract/extract.plugin.zsh +++ b/plugins/extract/extract.plugin.zsh @@ -41,7 +41,7 @@ extract() { && tar --lzma -xvf "$1" \ || lzcat "$1" | tar xvf - ;; (*.tar) tar xvf "$1" ;; - (*.gz) (( $+commands[pigz] )) && pigz -d "$1" || gunzip "$1" ;; + (*.gz) (( $+commands[pigz] )) && pigz -dk "$1" || gunzip -k "$1" ;; (*.bz2) bunzip2 "$1" ;; (*.xz) unxz "$1" ;; (*.lzma) unlzma "$1" ;; From 8b6b2ea07e7e18129757195731a3df5d57465807 Mon Sep 17 00:00:00 2001 From: Quentin Dreyer Date: Sat, 9 Nov 2019 12:49:17 +0100 Subject: [PATCH 030/343] upgrade: remove double whitespace in message (#7517) --- tools/upgrade.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/upgrade.sh b/tools/upgrade.sh index 0dd855b70..f64a0096e 100644 --- a/tools/upgrade.sh +++ b/tools/upgrade.sh @@ -43,7 +43,7 @@ then printf '%s\n' ' /____/ ' printf "${BLUE}%s\n" "Hooray! Oh My Zsh has been updated and/or is at the current version." printf "${BLUE}${BOLD}%s${NORMAL}\n" "To keep up on the latest news and updates, follow us on twitter: https://twitter.com/ohmyzsh" - printf "${BLUE}${BOLD}%s${NORMAL}\n" "Get your Oh My Zsh swag at: https://shop.planetargon.com/collections/oh-my-zsh" + printf "${BLUE}${BOLD}%s${NORMAL}\n" "Get your Oh My Zsh swag at: https://shop.planetargon.com/collections/oh-my-zsh" else printf "${RED}%s${NORMAL}\n" 'There was an error updating. Try again later?' fi From 24d83d1e8c84689d6fe0953f6fa6743d983fa07a Mon Sep 17 00:00:00 2001 From: Yuan-Hao Chen Date: Thu, 14 Nov 2019 20:34:02 +0800 Subject: [PATCH 031/343] tmux: fix bad tmux config syntax and logical expression error in 86b39cf (#8374) --- plugins/tmux/tmux.extra.conf | 2 +- plugins/tmux/tmux.plugin.zsh | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/plugins/tmux/tmux.extra.conf b/plugins/tmux/tmux.extra.conf index 3420d19d4..c4aaad0b0 100644 --- a/plugins/tmux/tmux.extra.conf +++ b/plugins/tmux/tmux.extra.conf @@ -1,2 +1,2 @@ set -g default-terminal $ZSH_TMUX_TERM -source $ZSH_TMUX_CONFIG \ No newline at end of file +source-file $ZSH_TMUX_CONFIG \ No newline at end of file diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index d7b299690..5b5d1b1ba 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -67,9 +67,12 @@ function _zsh_tmux_plugin_run() { # If failed, just run tmux, fixing the TERM variable if requested. if [[ $? -ne 0 ]]; then - [[ "$ZSH_TMUX_FIXTERM" == "true" ]] && tmux_cmd+=(-f "$_ZSH_TMUX_FIXED_CONFIG") || \ - [[ -e "$ZSH_TMUX_CONFIG" ]] && tmux_cmd+=(-f "$ZSH_TMUX_CONFIG") - $tmux_cmd new-session + if [[ "$ZSH_TMUX_FIXTERM" == "true" ]]; then + tmux_cmd+=(-f "$_ZSH_TMUX_FIXED_CONFIG") + elif [[ -e "$ZSH_TMUX_CONFIG" ]]; then + tmux_cmd+=(-f "$ZSH_TMUX_CONFIG") + fi + $tmux_cmd new-session fi if [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]]; then From e453731fc93419cb71661dd1f277965e3d07ff0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20H=C3=89JA?= Date: Thu, 14 Nov 2019 18:32:21 +0100 Subject: [PATCH 032/343] osx: fix exit on unknown command in spotify function (#8375) --- plugins/osx/spotify | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/osx/spotify b/plugins/osx/spotify index 39f8e0437..78d6c7d0f 100644 --- a/plugins/osx/spotify +++ b/plugins/osx/spotify @@ -470,7 +470,7 @@ while [ $# -gt 0 ]; do break ;; * ) showHelp; - exit 1; + break; esac done From 0ad988c598cf9ceda392815ea0c823a76720d17e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paulo=20Diovani=20Gon=C3=A7alves?= Date: Fri, 15 Nov 2019 12:47:11 -0300 Subject: [PATCH 033/343] tmux: export ZSH_TMUX_CONFIG again to provide to tmux (#8390) --- plugins/tmux/tmux.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index 5b5d1b1ba..dad3db578 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -46,6 +46,7 @@ fi # Set the correct local config file to use. if [[ "$ZSH_TMUX_ITERM2" == "false" && -e "$ZSH_TMUX_CONFIG" ]]; then + export ZSH_TMUX_CONFIG export _ZSH_TMUX_FIXED_CONFIG="${0:h:a}/tmux.extra.conf" else export _ZSH_TMUX_FIXED_CONFIG="${0:h:a}/tmux.only.conf" From 66e2284a08f86e5dcf661e3cf220483e1fb1f530 Mon Sep 17 00:00:00 2001 From: "Aaron N. Brock" Date: Fri, 15 Nov 2019 14:11:50 -0500 Subject: [PATCH 034/343] Add support for chroma --- plugins/colorize/colorize.plugin.zsh | 47 ++++++++++++++++++++++------ 1 file changed, 38 insertions(+), 9 deletions(-) diff --git a/plugins/colorize/colorize.plugin.zsh b/plugins/colorize/colorize.plugin.zsh index 565ba5a36..051d2269c 100644 --- a/plugins/colorize/colorize.plugin.zsh +++ b/plugins/colorize/colorize.plugin.zsh @@ -3,21 +3,46 @@ alias ccat='colorize_via_pygmentize' alias cless='colorize_via_pygmentize_less' colorize_via_pygmentize() { - if ! (( $+commands[pygmentize] )); then - echo "package 'Pygments' is not installed!" + + if [[ $ZSH_COLORIZE_TOOL != "chroma" && $ZSH_COLORIZE_TOOL != "pygmentize" ]]; then + echo "ZSH_COLORIZE_TOOL not recognized. Options are 'pygmentize' or 'chroma'" return 1 fi - # If the environment varianle ZSH_COLORIZE_STYLE + if [ -z $ZSH_COLORIZE_TOOL ]; then + if (( $+commands[pygmentize] )); then + ZSH_COLORIZE_TOOL="pygmentize" + elif (( $+commands[chroma] )); then + ZSH_COLORIZE_TOOL="chroma" + else + echo "niether 'Pygments' nor 'chroma' is not installed!" + return 1 + fi + fi + + echo "Tool: $ZSH_COLORIZE_TOOL" + + # If the environment variable ZSH_COLORIZE_STYLE # is set, use that theme instead. Otherwise, # use the default. if [ -z $ZSH_COLORIZE_STYLE ]; then - ZSH_COLORIZE_STYLE="default" + if [[ $ZSH_COLORIZE_TOOL == "pygmentize" ]]; then + ZSH_COLORIZE_STYLE="default" + else + # Choosing 'emacs' to match pygmentize's default as per: + # https://github.com/pygments/pygments/blob/master/pygments/styles/default.py#L19 + ZSH_COLORIZE_STYLE="emacs" + fi fi + echo "color style: $ZSH_COLORIZE_STYLE" # pygmentize stdin if no arguments passed if [ $# -eq 0 ]; then - pygmentize -O style="$ZSH_COLORIZE_STYLE" -g + if [[ $ZSH_COLORIZE_TOOL == "pygmentize" ]]; then + pygmentize -O style="$ZSH_COLORIZE_STYLE" -g + else + chroma --style="$ZSH_COLORIZE_STYLE" + fi return $? fi @@ -27,11 +52,15 @@ colorize_via_pygmentize() { local FNAME lexer for FNAME in "$@" do - lexer=$(pygmentize -N "$FNAME") - if [[ $lexer != text ]]; then - pygmentize -O style="$ZSH_COLORIZE_STYLE" -l "$lexer" "$FNAME" + if [[ $ZSH_COLORIZE_TOOL == "pygmentize" ]]; then + lexer=$(pygmentize -N "$FNAME") + if [[ $lexer != text ]]; then + pygmentize -O style="$ZSH_COLORIZE_STYLE" -l "$lexer" "$FNAME" + else + pygmentize -O style="$ZSH_COLORIZE_STYLE" -g "$FNAME" + fi else - pygmentize -O style="$ZSH_COLORIZE_STYLE" -g "$FNAME" + chroma --style="$ZSH_COLORIZE_STYLE" "$FNAME" fi done } From 8aa070db0e1f8a5752f0e45834b7093b9b72860f Mon Sep 17 00:00:00 2001 From: "Aaron N. Brock" Date: Fri, 15 Nov 2019 15:34:24 -0500 Subject: [PATCH 035/343] Update README.md --- plugins/colorize/README.md | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/plugins/colorize/README.md b/plugins/colorize/README.md index d1f878e62..b6e27fd27 100644 --- a/plugins/colorize/README.md +++ b/plugins/colorize/README.md @@ -10,12 +10,23 @@ To use it, add colorize to the plugins array of your zshrc file: ``` plugins=(... colorize) ``` +## Configuration -## Styles +### Colorize tool + +Colorize supports using either the `pygmentize` tool or the `chroma` tool. By default colorize uses `pygmentize` unless it's not installed & `chroma` is installed. However, you can override this with the `ZSH_COLORIZE_TOOL` environment variable: + +``` +ZSH_COLORIZE_TOOL=chroma +``` + +### Styles Pygments offers multiple styles. By default, the `default` style is used, but you can choose another theme by setting the `ZSH_COLORIZE_STYLE` environment variable: -`ZSH_COLORIZE_STYLE="colorful"` +``` +ZSH_COLORIZE_STYLE="colorful" +``` ## Usage @@ -32,4 +43,6 @@ In the latter form, the file contents will be concatenated and presented by less ## Requirements -You have to install Pygments first: [pygments.org](http://pygments.org/download/) +You have to either install Pygments: [pygments.org](http://pygments.org/download/) + +Or install chroma: [https://github.com/alecthomas/chroma](https://github.com/alecthomas/chroma) \ No newline at end of file From 451fb257032a37a7d9cae4631c03f65fd3aa7f1c Mon Sep 17 00:00:00 2001 From: James Jensen Date: Sat, 16 Nov 2019 05:59:20 +0800 Subject: [PATCH 036/343] osx: modify itunes function to support Apple Music (#8372) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change `itunes` to `music`, as iTunes was renamed to Music in _**macOS** Catalina 10.15_ Co-authored-by: Marc Cornellà --- plugins/osx/README.md | 35 +++++++++++++++-------------- plugins/osx/osx.plugin.zsh | 46 ++++++++++++++++++++++++-------------- 2 files changed, 47 insertions(+), 34 deletions(-) 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