From c840594c6ffdcecc241c9ccb130daeb630831ef7 Mon Sep 17 00:00:00 2001 From: Robert McLeod Date: Fri, 10 Apr 2015 15:07:29 +1200 Subject: [PATCH 001/302] 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/302] 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/302] 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 23688fc7ab925111fdb0db07670b6b641e380ec9 Mon Sep 17 00:00:00 2001 From: Iulian Onofrei <6d0847b9@opayq.com> Date: Sat, 29 Sep 2018 17:01:41 +0300 Subject: [PATCH 004/302] Add option to color any help command This allows you to use `colored git log --help` for example, to get colored output. --- plugins/colored-man-pages/colored-man-pages.plugin.zsh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/colored-man-pages/colored-man-pages.plugin.zsh b/plugins/colored-man-pages/colored-man-pages.plugin.zsh index 1bea536e0..ac6a94654 100644 --- a/plugins/colored-man-pages/colored-man-pages.plugin.zsh +++ b/plugins/colored-man-pages/colored-man-pages.plugin.zsh @@ -16,7 +16,7 @@ EOF fi fi -function man() { +function colored() { env \ LESS_TERMCAP_mb=$(printf "\e[1;31m") \ LESS_TERMCAP_md=$(printf "\e[1;31m") \ @@ -28,5 +28,9 @@ function man() { PAGER="${commands[less]:-$PAGER}" \ _NROFF_U=1 \ PATH="$HOME/bin:$PATH" \ - man "$@" + "$@" +} + +function man() { + colored man "$@" } From 22e00b02efe63d3ee19a55dadbdea0bea1785942 Mon Sep 17 00:00:00 2001 From: Caleb Williams Date: Wed, 2 Jan 2019 14:12:13 -0600 Subject: [PATCH 005/302] Add Yarn Workspace command aliases --- plugins/yarn/yarn.plugin.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/yarn/yarn.plugin.zsh b/plugins/yarn/yarn.plugin.zsh index 9ed8322cd..7bdfdb48a 100644 --- a/plugins/yarn/yarn.plugin.zsh +++ b/plugins/yarn/yarn.plugin.zsh @@ -22,3 +22,5 @@ alias yt="yarn test" alias yuc="yarn global upgrade && yarn cache clean" alias yui="yarn upgrade-interactive" alias yup="yarn upgrade" +alias yw="yarn workspace" +alias yws="yarn workspaces" From 67e0ef7aa6a494b2357c64a204214f7b19fb52e7 Mon Sep 17 00:00:00 2001 From: "GIL B. Chan" Date: Sun, 7 Apr 2019 18:48:22 +0900 Subject: [PATCH 006/302] 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 17f4cfca99398cb5511557b8515a17bf1bf2948a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sat, 13 Jul 2019 12:48:10 +0200 Subject: [PATCH 007/302] af-magic: make separator window-size-aware (#7739) --- themes/af-magic.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/af-magic.zsh-theme b/themes/af-magic.zsh-theme index 1c6d1732c..2a6595a71 100644 --- a/themes/af-magic.zsh-theme +++ b/themes/af-magic.zsh-theme @@ -6,7 +6,7 @@ if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="green"; fi local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" # primary prompt -PROMPT='$FG[237]------------------------------------------------------------%{$reset_color%} +PROMPT='$FG[237]${(l.COLUMNS..-.)}%{$reset_color%} $FG[032]%~\ $(git_prompt_info) \ $FG[105]%(!.#.»)%{$reset_color%} ' From b90f76c1411b4a2182f4fd54b5739be5f78410e8 Mon Sep 17 00:00:00 2001 From: Ilya Gorski <52842983+gorsil@users.noreply.github.com> Date: Mon, 15 Jul 2019 00:40:28 +0300 Subject: [PATCH 008/302] fzf: Adding support for debian packages --- plugins/fzf/fzf.plugin.zsh | 136 +++++++++++++++++++++++-------------- 1 file changed, 86 insertions(+), 50 deletions(-) diff --git a/plugins/fzf/fzf.plugin.zsh b/plugins/fzf/fzf.plugin.zsh index 27e2d9246..e191bebbd 100644 --- a/plugins/fzf/fzf.plugin.zsh +++ b/plugins/fzf/fzf.plugin.zsh @@ -1,57 +1,93 @@ -test -d "${FZF_BASE}" && fzf_base="${FZF_BASE}" +function setup_using_base_dir() { + # Declare all variables local not no mess with outside env in any way + local fzf_base + local fzf_shell + local fzfdirs + local dir -if [[ -z "${fzf_base}" ]]; then - fzfdirs=( - "${HOME}/.fzf" - "/usr/local/opt/fzf" - "/usr/share/fzf" - ) - for dir in ${fzfdirs}; do - if [[ -d "${dir}" ]]; then - fzf_base="${dir}" - break - fi - done + test -d "${FZF_BASE}" && fzf_base="${FZF_BASE}" - if [[ -z "${fzf_base}" ]]; then - if (( ${+commands[brew]} )) && dir="$(brew --prefix fzf 2>/dev/null)"; then - if [[ -d "${dir}" ]]; then - fzf_base="${dir}" - fi - fi - fi -fi + if [[ -z "${fzf_base}" ]]; then + fzfdirs=( + "${HOME}/.fzf" + "/usr/local/opt/fzf" + "/usr/share/fzf" + ) + for dir in ${fzfdirs}; do + if [[ -d "${dir}" ]]; then + fzf_base="${dir}" + break + fi + done -if [[ -n "${fzf_base}" ]]; then + if [[ -z "${fzf_base}" ]]; then + if (( ${+commands[brew]} )) && dir="$(brew --prefix fzf 2>/dev/null)"; then + if [[ -d "${dir}" ]]; then + fzf_base="${dir}" + fi + fi + fi + fi - # Fix fzf shell directory for Archlinux package - if [[ ! -d "${fzf_base}/shell" ]] && [[ -f /etc/arch-release ]]; then - fzf_shell="${fzf_base}" - else - fzf_shell="${fzf_base}/shell" - fi + if [[ -d "${fzf_base}" ]]; then + # Fix fzf shell directory for Archlinux package + if [[ ! -d "${fzf_base}/shell" ]] && [[ -f /etc/arch-release ]]; then + fzf_shell="${fzf_base}" + else + fzf_shell="${fzf_base}/shell" + fi - # Setup fzf - # --------- - if ! (( ${+commands[fzf]} )) && [[ ! "$PATH" == *$fzf_base/bin* ]]; then - export PATH="$PATH:$fzf_base/bin" - fi - - # Auto-completion - # --------------- - if [[ ! "$DISABLE_FZF_AUTO_COMPLETION" == "true" ]]; then - [[ $- == *i* ]] && source "${fzf_shell}/completion.zsh" 2> /dev/null - fi - - # Key bindings - # ------------ - if [[ ! "$DISABLE_FZF_KEY_BINDINGS" == "true" ]]; then - source "${fzf_shell}/key-bindings.zsh" - fi + # Setup fzf binary path + if ! (( ${+commands[fzf]} )) && [[ ! "$PATH" == *$fzf_base/bin* ]]; then + export PATH="$PATH:$fzf_base/bin" + fi -else - print "[oh-my-zsh] fzf plugin: Cannot find fzf installation directory.\n"\ - "Please add \`export FZF_BASE=/path/to/fzf/install/dir\` to your .zshrc" >&2 -fi + # Auto-completion + if [[ ! "$DISABLE_FZF_AUTO_COMPLETION" == "true" ]]; then + [[ $- == *i* ]] && source "${fzf_shell}/completion.zsh" 2> /dev/null + fi -unset fzf_base fzf_shell dir fzfdirs + # Key bindings + if [[ ! "$DISABLE_FZF_KEY_BINDINGS" == "true" ]]; then + source "${fzf_shell}/key-bindings.zsh" + fi + else + return 1 + fi +} + + +function setup_using_debian_package() { + dpkg -s fzf &> /dev/null + if (( $? )); then + # Either not a debian based distro, or no fzf installed. In any case skip ahead + return 1 + fi + + # NOTE: There is no need to configure PATH for debian package, all binaries + # are installed to /usr/bin by default + + local completions="/usr/share/zsh/vendor-completions/_fzf" + local key_bindings="/usr/share/doc/fzf/examples/key-bindings.zsh" + + # Auto-completion + if [[ $- == *i* ]] && [[ ! "$DISABLE_FZF_AUTO_COMPLETION" == "true" ]]; then + source $completions 2> /dev/null + fi + + # Key bindings + if [[ ! "$DISABLE_FZF_KEY_BINDINGS" == "true" ]]; then + source $key_bindings + fi + + return 0 +} + +function indicate_error() { + print "[oh-my-zsh] fzf plugin: Cannot find fzf installation directory.\n"\ + "Please add \`export FZF_BASE=/path/to/fzf/install/dir\` to your .zshrc" >&2 +} + +# Check for debian package first, because it easy to short cut +# Indicate to user that fzf installation not found if nothing worked +setup_using_debian_package || setup_using_base_dir || indicate_error From 0565251c3bd91994073a265cdb8abb7eac9439e5 Mon Sep 17 00:00:00 2001 From: Ilya Gorski <52842983+gorsil@users.noreply.github.com> Date: Wed, 17 Jul 2019 02:43:00 +0300 Subject: [PATCH 009/302] Unset all local functions after running them --- plugins/fzf/fzf.plugin.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/fzf/fzf.plugin.zsh b/plugins/fzf/fzf.plugin.zsh index e191bebbd..646148297 100644 --- a/plugins/fzf/fzf.plugin.zsh +++ b/plugins/fzf/fzf.plugin.zsh @@ -91,3 +91,5 @@ function indicate_error() { # Check for debian package first, because it easy to short cut # Indicate to user that fzf installation not found if nothing worked setup_using_debian_package || setup_using_base_dir || indicate_error + +unset -f setup_using_debian_package setup_using_base_dir indicate_error From 783dd1504f99bd34aedd1d4a68ae6f14e38606da Mon Sep 17 00:00:00 2001 From: Pavel Omelchenko Date: Wed, 17 Jul 2019 15:17:34 +0300 Subject: [PATCH 010/302] change key string --- plugins/homestead/homestead.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/homestead/homestead.plugin.zsh b/plugins/homestead/homestead.plugin.zsh index cdbc564e4..f67a582f4 100644 --- a/plugins/homestead/homestead.plugin.zsh +++ b/plugins/homestead/homestead.plugin.zsh @@ -1,6 +1,6 @@ # Homestead basic command completion _homestead_get_command_list () { - homestead --no-ansi | sed "1,/Available commands/d" | awk '/^ +[a-z]+/ { print $1 }' + homestead --no-ansi | sed "1,/Common commands/d" | awk '/^ +[a-z]+/ { print $1 }' } _homestead () { From 508cba2fc2ec545504abcf38ecdd958f3a89e5e8 Mon Sep 17 00:00:00 2001 From: PLANET ARGON Date: Mon, 22 Jul 2019 07:28:33 -0700 Subject: [PATCH 011/302] Removing plugin that was named after an external tool, which carries a history as a racist phrase. Was reported by a user of OMZ who shared some background on the terminology and how it made them feel. (#8027) --- plugins/bwana/README.md | 12 ------------ plugins/bwana/bwana.plugin.zsh | 13 ------------- 2 files changed, 25 deletions(-) delete mode 100644 plugins/bwana/README.md delete mode 100644 plugins/bwana/bwana.plugin.zsh diff --git a/plugins/bwana/README.md b/plugins/bwana/README.md deleted file mode 100644 index dd4fe9f9c..000000000 --- a/plugins/bwana/README.md +++ /dev/null @@ -1,12 +0,0 @@ -# Bwana - -This plugin provides a function to open `man` pages directly with [Bwana](https://www.bruji.com/bwana/). - -To use it add bwana to the plugins array in your zshrc file. - -```bash -plugins=(... bwana) -``` - -The `bwana` function opens the man page of the passed argument in the Bwana app. -For example: `bwana ln` opens the man page for `ln` in Bwana. diff --git a/plugins/bwana/bwana.plugin.zsh b/plugins/bwana/bwana.plugin.zsh deleted file mode 100644 index 71c9eb18d..000000000 --- a/plugins/bwana/bwana.plugin.zsh +++ /dev/null @@ -1,13 +0,0 @@ -# -# Requires https://www.bruji.com/bwana/ -# -if [[ -e /Applications/Bwana.app ]] || - ( system_profiler -detailLevel mini SPApplicationsDataType | grep -q Bwana ) -then - function bwana() { - open "man:$1" - } -else - echo "Bwana lets you read man files in Safari through a man: URI scheme" - echo "To use it within Zsh, install it from https://www.bruji.com/bwana/" -fi From 9817e1e7ff62494abf9d7c78870e92908567e8f4 Mon Sep 17 00:00:00 2001 From: Gopal9816 Date: Sat, 27 Jul 2019 17:39:00 +0530 Subject: [PATCH 012/302] common-aliases: add README (#8039) --- plugins/common-aliases/README.md | 121 +++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 plugins/common-aliases/README.md diff --git a/plugins/common-aliases/README.md b/plugins/common-aliases/README.md new file mode 100644 index 000000000..d198a29ac --- /dev/null +++ b/plugins/common-aliases/README.md @@ -0,0 +1,121 @@ +# Common Aliases Plugin + +This plugin creates helpful shortcut aliases for many commonly used commands. + +To use it add `common-aliases` to the plugins array in your zshrc file: + +```zsh +plugins=(... common-aliases) +``` + +## Aliases + +### ls command + +| Alias | Command | Description | +|-------|---------------|--------------------------------------------------------------------------------| +| l | `ls -lFh` | List files as a long list, show size, type, human-readable | +| la | `ls -lAFh` | List almost all files as a long list show size, type, human-readable | +| lr | `ls -tRFh` | List files recursively sorted by date, show type, human-readable | +| lt | `ls -ltFh` | List files as a long list sorted by date, show type, human-readable | +| ll | `ls -l` | List files as a long list | +| ldot | `ls -ld .*` | List dot files as a long list | +| lS | `ls -1FSsh` | List files showing only size and name sorted by size | +| lart | `ls -1Fcart` | List all files sorted in reverse of create/modification time (oldest first) | +| lrt | `ls -1Fcrt` | List files sorted in reverse of create/modification time(oldest first) | + +### File handling + +| Alias | Command | Description | +|-------|-----------------------|------------------------------------------------------------------------------------| +| rm | `rm -i` | Remove a file | +| cp | `cp -i` | Copy a file | +| mv | `mv -i` | Move a file | +| zshrc | `${=EDITOR} ~/.zshrc` | Quickly access the ~/.zshrc file | +| dud | `du -d 1 -h` | Display the size of files at depth 1 in current location in human-readable form | +| duf | `du -sh` | Display the size of files in current location in human-readable form | +| t | `tail -f` | Shorthand for tail which outputs the last part of a file | + +### find and grep + +| Alias | Command | Description | +|-------|-----------------------------------------------------|-----------------------------------------| +| fd | `find . -type d -name` | Find a directory with the given name | +| ff | `find . -type f -name` | Find a file with the given name | +| grep | `grep --color` | Searches for a query string | +| sgrep | `grep -R -n -H -C 5 --exclude-dir={.git,.svn,CVS}` | Useful for searching within files | + +### Other Aliases + +| Alias | Command | Description | +|-----------|---------------------|-------------------------------------------------------------| +| h | `history` | Lists all recently used commands | +| hgrep | `fc -El 0 \| grep` | Searches for a word in the list of previously used commands | +| help | `man` | Opens up the man page for a command | +| p | `ps -f` | Displays currently executing processes | +| sortnr | `sort -n -r` | Used to sort the lines of a text file | +| unexport | `unset` | Used to unset an environment variable | + +## Global aliases + +These aliases are expanded in any position in the command line, meaning you can use them even at the +end of the command you've typed. Examples: + +Quickly pipe to less: +```zsh +$ ls -l /var/log L +# will run +$ ls -l /var/log | less +``` +Silences stderr output: +```zsh +$ find . -type f NE +# will run +$ find . -type f 2>/dev/null +``` + +| Alias | Command | Description | +|-------|-----------------------------|-------------------------------------------------------------| +| H | `\| head` | Pipes output to head which outputs the first part of a file | +| T | `\| tail` | Pipes output to tail which outputs the last part of a file | +| G | `\| grep` | Pipes output to grep to search for some word | +| L | `\| less` | Pipes output to less, useful for paging | +| M | `\| most` | Pipes output to more, useful for paging | +| LL | `2>&1 \| less` | Writes stderr to stdout and passes it to less | +| CA | `2>&1 \| cat -A` | Writes stderr to stdout and passes it to cat | +| NE | `2 > /dev/null` | Silences stderr | +| NUL | `> /dev/null 2>&1` | Silences both stdout and stderr | +| P | `2>&1\| pygmentize -l pytb` | Writes stderr to stdout and passes it to pygmentize | + +## File extension aliases + +These are special aliases that are triggered when a file name is passed as the command. For example, +if the pdf file extension is aliased to `acroread` (a popular Linux pdf reader), when running `file.pdf` +that file will be open with `acroread`. + +### Reading Docs + +| Alias | Command | Description | +|-------|-------------|-------------------------------------| +| pdf | `acroread` | Opens up a document using acroread | +| ps | `gv` | Opens up a .ps file using gv | +| dvi | `xdvi` | Opens up a .dvi file using xdvi | +| chm | `xchm` | Opens up a .chm file using xchm | +| djvu | `djview` | Opens up a .djvu file using djview | + +### Listing files inside a packed file + +| Alias | Command | Description | +|---------|-------------|-------------------------------------| +| zip | `unzip -l` | Lists files inside a .zip file | +| rar | `unrar l` | Lists files inside a .rar file | +| tar | `tar tf` | Lists files inside a .tar file | +| tar.gz | `echo` | Lists files inside a .tar.gz file | +| ace | `unace l` | Lists files inside a .ace file | + +### Some other features + +- Opens urls in terminal using browser specified by the variable `$BROWSER` +- Opens C, C++, Tex and text files using editor specified by the variable `$EDITOR` +- Opens images using image viewer specified by the variable `$XIVIEWER` +- Opens videos and other media using mplayer From 59c1ec80aa9b018db34078e69a27e57aea5ad761 Mon Sep 17 00:00:00 2001 From: Rocky Date: Wed, 31 Jul 2019 01:23:50 -0600 Subject: [PATCH 013/302] agnoster: fix VIRTUAL_ENV_DISABLE_PROMPT logic (#8050) Fixes #7985 --- themes/agnoster.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme index 518a14a37..7e37440a4 100644 --- a/themes/agnoster.zsh-theme +++ b/themes/agnoster.zsh-theme @@ -204,7 +204,7 @@ prompt_dir() { # Virtualenv: current working virtualenv prompt_virtualenv() { local virtualenv_path="$VIRTUAL_ENV" - if [[ -n $virtualenv_path && -n $VIRTUAL_ENV_DISABLE_PROMPT ]]; then + if [[ -n $virtualenv_path && -z $VIRTUAL_ENV_DISABLE_PROMPT ]]; then prompt_segment blue black "(`basename $virtualenv_path`)" fi } From 6d2221e697ea4a2445202b1c32283610f84585ef Mon Sep 17 00:00:00 2001 From: Jack Brown Date: Wed, 31 Jul 2019 17:45:54 +1000 Subject: [PATCH 014/302] frontend-search: add duckduckgo as an option for fallback search (#7973) --- plugins/frontend-search/README.md | 4 +++ .../frontend-search.plugin.zsh | 31 +++++++++++++------ 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/plugins/frontend-search/README.md b/plugins/frontend-search/README.md index bf76902fd..ddcb3d72b 100644 --- a/plugins/frontend-search/README.md +++ b/plugins/frontend-search/README.md @@ -62,6 +62,10 @@ Available search contexts are: If you want to have another context, open an Issue and tell us! +## Fallback search behaviour + +The plugin will use Google as a fallback if the docs site for a search context does not have a search function. You can set the fallback search engine to DuckDuckGo by setting `FRONTEND_SEARCH_FALLBACK='duckduckgo'` in your `~/.zshrc` file before Oh My Zsh is sourced. + ## Author **Wilson Mendes (willmendesneto)** diff --git a/plugins/frontend-search/frontend-search.plugin.zsh b/plugins/frontend-search/frontend-search.plugin.zsh index 87243be13..ed19280c4 100644 --- a/plugins/frontend-search/frontend-search.plugin.zsh +++ b/plugins/frontend-search/frontend-search.plugin.zsh @@ -27,6 +27,17 @@ alias typescript='frontend typescript' alias unheap='frontend unheap' alias vuejs='frontend vuejs' +function _frontend_fallback() { + local url + if [[ "$FRONTEND_SEARCH_FALLBACK" == duckduckgo ]]; then + url="https://duckduckgo.com/?sites=$1&q=" + else + url="https://google.com/search?as_sitesearch=$1&as_q=" + fi + + echo "$url" +} + function frontend() { emulate -L zsh @@ -34,8 +45,8 @@ function frontend() { typeset -A urls urls=( angular 'https://angular.io/?search=' - angularjs 'https://google.com/search?as_sitesearch=angularjs.org&as_q=' - bem 'https://google.com/search?as_sitesearch=bem.info&as_q=' + angularjs $(_frontend_fallback 'angularjs.org') + bem $(_frontend_fallback 'bem.info') bootsnipp 'https://bootsnipp.com/search?q=' bundlephobia 'https://bundlephobia.com/result?p=' caniuse 'https://caniuse.com/#search=' @@ -43,24 +54,24 @@ function frontend() { compassdoc 'http://compass-style.org/search?q=' cssflow 'http://www.cssflow.com/search?q=' dartlang 'https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart:' - emberjs 'https://www.google.com/search?as_sitesearch=emberjs.com/&as_q=' - flowtype 'https://google.com/search?as_sitesearch=flow.org/en/docs/&as_q=' + emberjs $(_frontend_fallback 'emberjs.com/') + flowtype $(_frontend_fallback 'flow.org/en/docs/') fontello 'http://fontello.com/#search=' github 'https://github.com/search?q=' html5please 'https://html5please.com/#' - jestjs 'https://www.google.com/search?as_sitesearch=jestjs.io&as_q=' + jestjs $(_frontend_fallback 'jestjs.io') jquery 'https://api.jquery.com/?s=' lodash 'https://devdocs.io/lodash/index#' mdn 'https://developer.mozilla.org/search?q=' - nodejs 'https://www.google.com/search?as_sitesearch=nodejs.org/en/docs/&as_q=' + nodejs $(_frontend_fallback 'nodejs.org/en/docs/') npmjs 'https://www.npmjs.com/search?q=' qunit 'https://api.qunitjs.com/?s=' - reactjs 'https://google.com/search?as_sitesearch=facebook.github.io/react&as_q=' - smacss 'https://google.com/search?as_sitesearch=smacss.com&as_q=' + reactjs $(_frontend_fallback 'reactjs.org/') + smacss $(_frontend_fallback 'smacss.com') stackoverflow 'https://stackoverflow.com/search?q=' - typescript 'https://google.com/search?as_sitesearch=www.typescriptlang.org/docs&as_q=' + typescript $(_frontend_fallback 'www.typescriptlang.org/docs') unheap 'http://www.unheap.com/?s=' - vuejs 'https://www.google.com/search?as_sitesearch=vuejs.org&as_q=' + vuejs $(_frontend_fallback 'vuejs.org') ) # show help for command list From 26aad59779b2cd7ce313798a4e6b76a29b9f2347 Mon Sep 17 00:00:00 2001 From: Iulian Onofrei Date: Sun, 4 Aug 2019 00:33:40 +0300 Subject: [PATCH 015/302] Add README file --- plugins/colored-man-pages/README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 plugins/colored-man-pages/README.md diff --git a/plugins/colored-man-pages/README.md b/plugins/colored-man-pages/README.md new file mode 100644 index 000000000..d9f6acb2a --- /dev/null +++ b/plugins/colored-man-pages/README.md @@ -0,0 +1,15 @@ +# Colored man pages plugin + +This plugin adds colors to man pages. + +To use it, add `colored-man-pages` to the plugins array in your zshrc file: + +```zsh +plugins=(... colored-man-pages) +``` + +You can also try to color other pages by prefixing the respective command with `colored`: + +```zsh +colored git help clone +``` From 89366be43fd6ceff52a9da2f2edef654ab619514 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 6 Aug 2019 18:01:32 +0200 Subject: [PATCH 016/302] Revert "agnoster: fix VIRTUAL_ENV_DISABLE_PROMPT logic (#8050)" (#8061) This reverts commit 59c1ec80aa9b018db34078e69a27e57aea5ad761. --- themes/agnoster.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme index 7e37440a4..518a14a37 100644 --- a/themes/agnoster.zsh-theme +++ b/themes/agnoster.zsh-theme @@ -204,7 +204,7 @@ prompt_dir() { # Virtualenv: current working virtualenv prompt_virtualenv() { local virtualenv_path="$VIRTUAL_ENV" - if [[ -n $virtualenv_path && -z $VIRTUAL_ENV_DISABLE_PROMPT ]]; then + if [[ -n $virtualenv_path && -n $VIRTUAL_ENV_DISABLE_PROMPT ]]; then prompt_segment blue black "(`basename $virtualenv_path`)" fi } From 40fafe0f59371d1a9d83b83c614acfd1d740aabb Mon Sep 17 00:00:00 2001 From: Jisse Reitsma Date: Wed, 7 Aug 2019 20:16:25 +0200 Subject: [PATCH 017/302] n98-magerun: support magerun for Magento 2 (#7950) --- plugins/n98-magerun/n98-magerun.plugin.zsh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/plugins/n98-magerun/n98-magerun.plugin.zsh b/plugins/n98-magerun/n98-magerun.plugin.zsh index bfcf27b98..d79aee7eb 100644 --- a/plugins/n98-magerun/n98-magerun.plugin.zsh +++ b/plugins/n98-magerun/n98-magerun.plugin.zsh @@ -2,7 +2,8 @@ # FILE: n98-magerun.plugin.zsh # DESCRIPTION: oh-my-zsh n98-magerun plugin file. Adapted from composer plugin # AUTHOR: Andrew Dwyer (andrewrdwyer at gmail dot com) -# VERSION: 1.0.0 +# AUTHOR: Jisse Reitsma (jisse at yireo dot com) +# VERSION: 1.1.0 # ------------------------------------------------------------------------------ # n98-magerun basic command completion @@ -24,11 +25,18 @@ _n98_magerun () { compdef _n98_magerun n98-magerun.phar compdef _n98_magerun n98-magerun +compdef _n98_magerun n98-magerun2.phar +compdef _n98_magerun n98-magerun2 # Aliases alias n98='n98-magerun.phar' alias mage='n98-magerun.phar' -alias magefl='n98-magerun.phar cache:flush' +alias magerun='n98-magerun.phar' + +alias n98-2='n98-magerun2.phar' +alias mage2='n98-magerun2.phar' +alias magerun2='n98-magerun2.phar' # Install n98-magerun into the current directory -alias mage-get='wget https://raw.github.com/netz98/n98-magerun/master/n98-magerun.phar' +alias mage-get='wget https://files.magerun.net/n98-magerun.phar' +alias mage2-get='wget https://files.magerun.net/n98-magerun2.phar' From d8ad4e902cd359cf0a58cc8fc759377ec3d3c026 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 13 Aug 2019 14:15:14 +0200 Subject: [PATCH 018/302] meta: convert workflow file to GitHub Actions v2 yml syntax --- .github/main.workflow | 17 ----------------- .github/workflows/pull_request_triage.yml | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 17 deletions(-) delete mode 100644 .github/main.workflow create mode 100644 .github/workflows/pull_request_triage.yml diff --git a/.github/main.workflow b/.github/main.workflow deleted file mode 100644 index 0dbb0247a..000000000 --- a/.github/main.workflow +++ /dev/null @@ -1,17 +0,0 @@ -workflow "Triage Pull Request" { - on = "pull_request" - resolves = ["Triage"] -} - -# Only act if there are code changes: if the pull_request -# event's action is either 'opened' (new PR) or 'synchronize' (new commits) -action "Filter actions" { - uses = "actions/bin/filter@0ac6d44" - args = "action 'opened|synchronize'" -} - -action "Triage" { - needs = ["Filter actions"] - uses = "ohmyzsh/github-actions/pull-request-triage@master" - secrets = ["GITHUB_TOKEN"] -} diff --git a/.github/workflows/pull_request_triage.yml b/.github/workflows/pull_request_triage.yml new file mode 100644 index 000000000..341298a0f --- /dev/null +++ b/.github/workflows/pull_request_triage.yml @@ -0,0 +1,14 @@ +on: pull_request +name: Triage Pull Request +jobs: + mainJob: + name: Triage + if: github.event.action == 'opened' || github.event.action == 'synchronize' + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@master + - name: Analyze and triage + uses: ohmyzsh/github-actions/pull-request-triage@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 4974143745360bfbfde535eab23df27daa8e3c8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 13 Aug 2019 15:10:15 +0200 Subject: [PATCH 019/302] meta: move if condition on workflow to steps Provisional measure due to "Unexpected value 'if'" error. See https://github.community/t5/GitHub-API-Development-and/jobs-lt-job-id-gt-if-not-working/m-p/28980 --- .github/workflows/pull_request_triage.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pull_request_triage.yml b/.github/workflows/pull_request_triage.yml index 341298a0f..a27392a92 100644 --- a/.github/workflows/pull_request_triage.yml +++ b/.github/workflows/pull_request_triage.yml @@ -1,13 +1,13 @@ on: pull_request name: Triage Pull Request jobs: - mainJob: + triage: name: Triage - if: github.event.action == 'opened' || github.event.action == 'synchronize' runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@master + if: github.event.action == 'opened' || github.event.action == 'synchronize' - name: Analyze and triage uses: ohmyzsh/github-actions/pull-request-triage@master env: From 28232904bec1e8e15da52ae048a8a31ef7fac67b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 13 Aug 2019 18:19:07 +0200 Subject: [PATCH 020/302] git-auto-fetch: override zle-line-init only if it exists --- .../git-auto-fetch/git-auto-fetch.plugin.zsh | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh b/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh index 745c669b5..56ab86dbe 100644 --- a/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh +++ b/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh @@ -18,10 +18,18 @@ function git-auto-fetch { echo "${fg_bold[red]}disabled${reset_color}") } -eval "override-git-auto-fetch-$(declare -f zle-line-init)" - -function zle-line-init () { - git-fetch-all - override-git-auto-fetch-zle-line-init -} +# Override zle-line-init if it exists +if (( $+functions[zle-line-init] )); then + eval "override-git-auto-fetch-$(declare -f zle-line-init)" + + function zle-line-init () { + git-fetch-all + override-git-auto-fetch-zle-line-init + } +else + function zle-line-init () { + git-fetch-all + } +fi + zle -N zle-line-init From c4c620adcd0dadf8f3f0d6aa331780291b5bdacd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sun, 18 Aug 2019 15:13:46 +0200 Subject: [PATCH 021/302] meta: add DEBUG_ACTIONS flag to PR triage action --- .github/workflows/pull_request_triage.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pull_request_triage.yml b/.github/workflows/pull_request_triage.yml index a27392a92..77ec4ce79 100644 --- a/.github/workflows/pull_request_triage.yml +++ b/.github/workflows/pull_request_triage.yml @@ -12,3 +12,4 @@ jobs: uses: ohmyzsh/github-actions/pull-request-triage@master env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + DEBUG_ACTIONS: ${{ secrets.DEBUG_ACTIONS }} From 97c0d0a563d2303adc64e94c78544bb4d2dbf83c Mon Sep 17 00:00:00 2001 From: SomeDer <48731521+SomeDer@users.noreply.github.com> Date: Mon, 19 Aug 2019 11:14:22 +0100 Subject: [PATCH 022/302] Allow plugins sudo and thefuck to be loaded before vi-mode (#8087) --- plugins/sudo/sudo.plugin.zsh | 4 +++- plugins/thefuck/thefuck.plugin.zsh | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/sudo/sudo.plugin.zsh b/plugins/sudo/sudo.plugin.zsh index 0b843822e..f405b025f 100644 --- a/plugins/sudo/sudo.plugin.zsh +++ b/plugins/sudo/sudo.plugin.zsh @@ -28,4 +28,6 @@ sudo-command-line() { } zle -N sudo-command-line # Defined shortcut keys: [Esc] [Esc] -bindkey "\e\e" sudo-command-line +bindkey -M emacs '\e\e' sudo-command-line +bindkey -M vicmd '\e\e' sudo-command-line +bindkey -M viins '\e\e' sudo-command-line diff --git a/plugins/thefuck/thefuck.plugin.zsh b/plugins/thefuck/thefuck.plugin.zsh index ac88e67de..b8586c70d 100644 --- a/plugins/thefuck/thefuck.plugin.zsh +++ b/plugins/thefuck/thefuck.plugin.zsh @@ -15,4 +15,6 @@ fuck-command-line() { } zle -N fuck-command-line # Defined shortcut keys: [Esc] [Esc] -bindkey "\e\e" fuck-command-line +bindkey -M emacs '\e\e' fuck-command-line +bindkey -M vicmd '\e\e' fuck-command-line +bindkey -M viins '\e\e' fuck-command-line From 90a0de4698d8ec4300bf6aa3d6847e299a05b1f5 Mon Sep 17 00:00:00 2001 From: SomeDer <48731521+SomeDer@users.noreply.github.com> Date: Mon, 19 Aug 2019 16:53:13 +0100 Subject: [PATCH 023/302] Add alias-finder plugin (#7768) --- plugins/alias-finder/README.md | 46 ++++++++++++++++++++ plugins/alias-finder/alias-finder.plugin.zsh | 46 ++++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 plugins/alias-finder/README.md create mode 100644 plugins/alias-finder/alias-finder.plugin.zsh diff --git a/plugins/alias-finder/README.md b/plugins/alias-finder/README.md new file mode 100644 index 000000000..409f4b653 --- /dev/null +++ b/plugins/alias-finder/README.md @@ -0,0 +1,46 @@ +# alias-finder plugin + +This plugin searches the defined aliases and outputs any that match the command inputted. This makes learning new aliases easier. + +To use it, add `alias-finder` to the `plugins` array of your zshrc file: +``` +plugins=(... alias-finder) +``` + +## Usage +To see if there is an alias defined for the command, pass it as an argument to `alias-finder`. This can also run automatically before each command you input - add `ZSH_ALIAS_FINDER_AUTOMATIC=true` to your zshrc if you want this. + +## Options + +- Use `--longer` or `-l` to allow the aliases to be longer than the input (match aliases if they contain the input). +- Use `--exact` or `-e` to avoid matching aliases that are shorter than the input. + +## Examples +``` +$ alias-finder "git pull" +gl='git pull' +g=git +``` +``` +$ alias-finder "web_search google oh my zsh" +google='web_search google' +``` +``` +$ alias-finder "git commit -v" +gc="git commit -v" +g=git +``` +``` +$ alias-finder -e "git commit -v" +gc='git commit -v' +``` +``` +$ alias-finder -l "git commit -v" +gc='git commit -v' +'gc!'='git commit -v --amend' +gca='git commit -v -a' +'gca!'='git commit -v -a --amend' +'gcan!'='git commit -v -a --no-edit --amend' +'gcans!'='git commit -v -a -s --no-edit --amend' +'gcn!'='git commit -v --no-edit --amend' +``` diff --git a/plugins/alias-finder/alias-finder.plugin.zsh b/plugins/alias-finder/alias-finder.plugin.zsh new file mode 100644 index 000000000..2bfaad597 --- /dev/null +++ b/plugins/alias-finder/alias-finder.plugin.zsh @@ -0,0 +1,46 @@ +alias-finder() { + local cmd="" exact="" longer="" wordStart="" wordEnd="" multiWordEnd="" + for i in $@; do + case $i in + -e|--exact) exact=true;; + -l|--longer) longer=true;; + *) + if [[ -z $cmd ]]; then + cmd=$i + else + cmd="$cmd $i" + fi + ;; + esac + done + cmd=$(sed 's/[].\|$(){}?+*^[]/\\&/g' <<< $cmd) # adds escaping for grep + if [[ $(wc -l <<< $cmd) == 1 ]]; then + while [[ $cmd != "" ]]; do + if [[ $longer = true ]]; then + wordStart="'{0,1}" + else + wordEnd="$" + multiWordEnd="'$" + fi + if [[ $cmd == *" "* ]]; then + local finder="'$cmd$multiWordEnd" + else + local finder=$wordStart$cmd$wordEnd + fi + alias | grep -E "=$finder" + if [[ $exact = true || $longer = true ]]; then + break + else + cmd=$(sed -E 's/ {0,1}[^ ]*$//' <<< $cmd) # removes last word + fi + done + fi +} + +preexec_alias-finder() { + if [[ $ZSH_ALIAS_FINDER_AUTOMATIC = true ]]; then + alias-finder $1 + fi +} + +preexec_functions+=(preexec_alias-finder) From 8634d9542a974ce4700ca14c3d3bc410945cc20a Mon Sep 17 00:00:00 2001 From: Matthew Turney Date: Mon, 19 Aug 2019 10:57:19 -0500 Subject: [PATCH 024/302] Add git-escape-magic plugin (#2847) --- plugins/git-escape-magic/README.md | 17 +++ plugins/git-escape-magic/git-escape-magic | 135 ++++++++++++++++++ .../git-escape-magic.plugin.zsh | 9 ++ 3 files changed, 161 insertions(+) create mode 100644 plugins/git-escape-magic/README.md create mode 100644 plugins/git-escape-magic/git-escape-magic create mode 100644 plugins/git-escape-magic/git-escape-magic.plugin.zsh diff --git a/plugins/git-escape-magic/README.md b/plugins/git-escape-magic/README.md new file mode 100644 index 000000000..a14364f22 --- /dev/null +++ b/plugins/git-escape-magic/README.md @@ -0,0 +1,17 @@ +# Git Escape Magic + +This plugin is copied from the original at +https://github.com/knu/zsh-git-escape-magic. All credit for the +functionality enabled by this plugin should go to @knu. + +An excerpt from that project's readme explains it's purpose. + +> It eliminates the need for manually escaping those meta-characters. The zle function it provides is context aware and recognizes the characteristics of each subcommand of git. Every time you type one of these meta-characters on a git command line, it automatically escapes the meta-character with a backslash as necessary and as appropriate. + +## Useage + +To use this plugin add it to your list of plugins in your `.zshrc` file. + +**NOTE**: If you use url-quote-magic it must be included before this +plugin runs to prevent any conflicts. + diff --git a/plugins/git-escape-magic/git-escape-magic b/plugins/git-escape-magic/git-escape-magic new file mode 100644 index 000000000..94a8d7b0f --- /dev/null +++ b/plugins/git-escape-magic/git-escape-magic @@ -0,0 +1,135 @@ +# -*- mode: sh -*- +# +# git-escape-magic - zle tweak for git command line arguments +# +# Copyright (c) 2011, 2012, 2014 Akinori MUSHA +# Licensed under the 2-clause BSD license. +# +# This tweak eliminates the need for manually escaping shell +# meta-characters such as [~^{}] that are used for specifying a git +# object (commit or tree). Every time you type one of these +# characters on a git command line, it is automatically escaped with a +# backslash as necessary and as appropriate. +# +# If you want to use this with url-quote-magic, make sure to enable it +# first. +# +# Usage: +# autoload -Uz git-escape-magic +# git-escape-magic +# + +git-escape-magic.self-insert() { + emulate -L zsh + setopt extendedglob + local self_insert_function + zstyle -s ':git-escape-magic' self-insert-function self_insert_function + + if [[ "$KEYS" == [{}~^]* ]] && { + local qkey="${(q)KEYS}" + [[ "$KEYS" != "$qkey" ]] + } && { + local lbuf="$LBUFFER$qkey" + [[ "${(Q)LBUFFER}$KEYS" == "${(Q)lbuf}" ]] + } && { + local -a words + words=("${(@Q)${(z)lbuf}}") + [[ "$words[(i)(*/|)git(|-[^/]##)]" -le $#words ]] + } + then + local i + i="$words[(I)([;(){\&]|\&[\&\!]|\|\||[=<>]\(*)]" + if [[ $i -gt 0 ]]; then + shift $((i-1)) words + if [[ "$words[1]" == [\=\<\>]\(* ]]; then + words[1]="${words[1]#[=<>]\(}" + else + [[ "$words[1]" == \; && $words[2] == (then|else|elif|do) ]] && shift words + shift words + fi + fi + while [[ "$words[1]" == (if|while|until|\!) ]]; do + shift words + done + while [[ "$words[1]" == [A-Za-z_][A-Za-z0-9_]#=* ]]; do + shift words + done + [[ "$words[1]" == (*/|)git(|-[^/]##) ]] && { + local subcommand + subcommand="${words[1]##*/git-}" + if [[ -z "$subcommand" ]]; then + shift words + subcommand="$words[1]" + fi + [[ $#words -ge 2 ]] + } && + case "$subcommand" in + # commands that may take pathspec but never take refspec with [{}~^] + (add|rm|am|apply|check-attr|checkout-index|clean|clone|config|diff-files|hash-object|help|index-pack|mailinfo|mailsplit|merge-file|merge-index|mergetool|mktag|mv|pack-objects|pack-redundant|relink|send-email|show-index|show-ref|stage|status|verify-pack) + false ;; + # commands that may take pathspec but rarely take refspec with [{}~^] + (for-each-ref|grep|ls-files|update-index) + false ;; + (archive|ls-tree) + ! [[ $#words -ge 3 && + "$words[-2]" == [^-]* ]] ;; + (diff-tree) + ! [[ $#words -ge 4 && + "$words[-2]" == [^-]* && + "$words[-3]" == [^-]* ]] ;; + (*) + [[ $words[(i)--] -gt $#words ]] ;; + esac && + case "${words[-1]%%"$KEYS"}" in + (*[@^]) + [[ "$KEYS" == [{~^]* ]] ;; + (*[@^]\{[^}]##) + [[ "$KEYS" == \}* ]] ;; + (?*) + [[ "$KEYS" == [~^]* ]] ;; + (*) + false ;; + esac && + LBUFFER="$LBUFFER\\" + fi + + zle "$self_insert_function" +} + +git-escape-magic.on() { + emulate -L zsh + local self_insert_function="${$(zle -lL | awk \ + '$1=="zle"&&$2=="-N"&&$3=="self-insert"{print $4;exit}'):-.self-insert}" + + [[ "$self_insert_function" == git-escape-magic.self-insert ]] && + return 0 + + # For url-quote-magic which does not zle -N itself + zle -la "$self_insert_function" || zle -N "$self_insert_function" + + zstyle ':git-escape-magic' self-insert-function "$self_insert_function" + + zle -A git-escape-magic.self-insert self-insert + return 0 +} + +git-escape-magic.off() { + emulate -L zsh + local self_insert_function + zstyle -s ':git-escape-magic' self-insert-function self_insert_function + + [[ -n "$self_insert_function" ]] && + zle -A "$self_insert_function" self-insert + return 0 +} + +zle -N git-escape-magic.self-insert +zle -N git-escape-magic.on +zle -N git-escape-magic.off + +git-escape-magic() { + git-escape-magic.on +} + +[[ -o kshautoload ]] || git-escape-magic "$@" + diff --git a/plugins/git-escape-magic/git-escape-magic.plugin.zsh b/plugins/git-escape-magic/git-escape-magic.plugin.zsh new file mode 100644 index 000000000..c021ea707 --- /dev/null +++ b/plugins/git-escape-magic/git-escape-magic.plugin.zsh @@ -0,0 +1,9 @@ +# Automatically detect and escape zsh globbing meta-characters when used with +# git refspec characters like `[^~{}]`. NOTE: This must be loaded _after_ +# url-quote-magic. +# +# This trick is detailed at https://github.com/knu/zsh-git-escape-magic and is +# what allowed this plugin to exist. + +autoload -Uz git-escape-magic +git-escape-magic From 1908f7bddcacdfb18a5a4b1c883f0c405d1660a8 Mon Sep 17 00:00:00 2001 From: Kirill Pinchuk Date: Mon, 19 Aug 2019 19:12:53 +0300 Subject: [PATCH 025/302] fabric: support fabric 2+ completion (#8010) --- plugins/fabric/_fab | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/fabric/_fab b/plugins/fabric/_fab index 9628e1224..4c2e61306 100644 --- a/plugins/fabric/_fab +++ b/plugins/fabric/_fab @@ -5,7 +5,7 @@ local curcontext=$curcontext state line declare -A opt_args declare target_list -target_list=(`fab --shortlist 2>/dev/null`) +target_list=(`fab --shortlist 2>/dev/null || fab --complete 2>/dev/null`) _targets() { _describe -t commands "fabric targets" target_list From e604eaf55e1c5b19035778c0e0adb0dd6e344b94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Mon, 19 Aug 2019 18:17:17 +0200 Subject: [PATCH 026/302] lib: delete LC_CTYPE locale setting which causes problems Fixes #7942 --- lib/misc.zsh | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lib/misc.zsh b/lib/misc.zsh index 40ffa479d..36c3ae2e5 100644 --- a/lib/misc.zsh +++ b/lib/misc.zsh @@ -31,10 +31,5 @@ else alias afind='ack -il' fi -# only define LC_CTYPE if undefined -if [[ -z "$LC_CTYPE" && -z "$LC_ALL" ]]; then - export LC_CTYPE=${LANG%%:*} # pick the first entry from LANG -fi - # recognize comments setopt interactivecomments From 43ed0b455ed5bbf66ef3e604c3d9845eb90f0078 Mon Sep 17 00:00:00 2001 From: Matthew Armand Date: Mon, 19 Aug 2019 12:54:49 -0400 Subject: [PATCH 027/302] af-magic: add hg prompt and tweak virtualenv info (#8056) - Add mercurial support to af-magic, so now the vcs prompt will show up in either a git or hg repository - The virtualenv prompt was white and bumped up against the user@hostname output - Fixed that so its green (which I thought highlighted it more thematically) and has a space before user@hostname --- themes/af-magic.zsh-theme | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/themes/af-magic.zsh-theme b/themes/af-magic.zsh-theme index 2a6595a71..d185fa1ab 100644 --- a/themes/af-magic.zsh-theme +++ b/themes/af-magic.zsh-theme @@ -8,7 +8,7 @@ local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" # primary prompt PROMPT='$FG[237]${(l.COLUMNS..-.)}%{$reset_color%} $FG[032]%~\ -$(git_prompt_info) \ +$(git_prompt_info)$(hg_prompt_info) \ $FG[105]%(!.#.»)%{$reset_color%} ' PROMPT2='%{$fg[red]%}\ %{$reset_color%}' RPS1='${return_code}' @@ -21,7 +21,7 @@ eval my_orange='$FG[214]' # right prompt if type "virtualenv_prompt_info" > /dev/null then - RPROMPT='$(virtualenv_prompt_info)$my_gray%n@%m%{$reset_color%}%' + RPROMPT='$FG[078]$(virtualenv_prompt_info)%{$reset_color%} $my_gray%n@%m%{$reset_color%}%' else RPROMPT='$my_gray%n@%m%{$reset_color%}%' fi @@ -31,3 +31,9 @@ ZSH_THEME_GIT_PROMPT_PREFIX="$FG[075]($FG[078]" ZSH_THEME_GIT_PROMPT_CLEAN="" ZSH_THEME_GIT_PROMPT_DIRTY="$my_orange*%{$reset_color%}" ZSH_THEME_GIT_PROMPT_SUFFIX="$FG[075])%{$reset_color%}" + +# hg settings +ZSH_THEME_HG_PROMPT_PREFIX="$FG[075]($FG[078]" +ZSH_THEME_HG_PROMPT_CLEAN="" +ZSH_THEME_HG_PROMPT_DIRTY="$my_orange*%{$reset_color%}" +ZSH_THEME_HG_PROMPT_SUFFIX="$FG[075])%{$reset_color%}" From de3b14cf69eeb43797bae8320af6972032b604ff Mon Sep 17 00:00:00 2001 From: Julien Janvier <3691804+jjanvier@users.noreply.github.com> Date: Tue, 20 Aug 2019 12:11:38 +0200 Subject: [PATCH 028/302] git: add aliases for git switch and restore (#8089) --- plugins/git/README.md | 4 ++++ plugins/git/git.plugin.zsh | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/plugins/git/README.md b/plugins/git/README.md index fc89b27e0..3311ccf55 100644 --- a/plugins/git/README.md +++ b/plugins/git/README.md @@ -131,7 +131,9 @@ plugins=(... git) | grmc | git rm --cached | | grmv | git remote rename | | grrm | git remote remove | +| grs | git restore | | grset | git remote set-url | +| grss | git restore --source | | grt | cd "$(git rev-parse --show-toplevel \|\| echo .)" | | gru | git reset -- | | grup | git remote update | @@ -154,6 +156,8 @@ plugins=(... git) | gsts | git stash show --text | | gstall | git stash --all | | gsu | git submodule update | +| gsw | git switch | +| gswc | git switch -c | | gts | git tag -s | | gtv | git tag \| sort -V | | gtl | gtl(){ git tag --sort=-v:refname -n -l ${1}* }; noglob gtl | diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index e0ce27fd4..9787392de 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -207,7 +207,9 @@ alias grm='git rm' alias grmc='git rm --cached' alias grmv='git remote rename' alias grrm='git remote remove' +alias grs='git restore' alias grset='git remote set-url' +alias grss='git restore --source' alias grt='cd "$(git rev-parse --show-toplevel || echo .)"' alias gru='git reset --' alias grup='git remote update' @@ -236,6 +238,8 @@ alias gstp='git stash pop' alias gsts='git stash show --text' alias gstall='git stash --all' alias gsu='git submodule update' +alias gsw='git switch' +alias gswc='git switch -c' alias gts='git tag -s' alias gtv='git tag | sort -V' From 246e7832ef6f4b77ae998508d0ba90c82961fd0a Mon Sep 17 00:00:00 2001 From: Pavel Omelchenko Date: Thu, 22 Aug 2019 12:00:31 +0300 Subject: [PATCH 029/302] feature: add condition for regular expression --- plugins/homestead/homestead.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/homestead/homestead.plugin.zsh b/plugins/homestead/homestead.plugin.zsh index f67a582f4..b9940dbcf 100644 --- a/plugins/homestead/homestead.plugin.zsh +++ b/plugins/homestead/homestead.plugin.zsh @@ -1,6 +1,6 @@ # Homestead basic command completion _homestead_get_command_list () { - homestead --no-ansi | sed "1,/Common commands/d" | awk '/^ +[a-z]+/ { print $1 }' + homestead --no-ansi | sed "1,/(Available|Common) commands/d" | awk '/^ +[a-z]+/ { print $1 }' } _homestead () { From caf0bfa0461d5d787ab4f336139aadffcea379a9 Mon Sep 17 00:00:00 2001 From: Vignesh Balasubramaniam Date: Fri, 23 Aug 2019 10:58:21 -0400 Subject: [PATCH 030/302] ubuntu: fix aglu to list available upgrades (#8082) --- plugins/ubuntu/ubuntu.plugin.zsh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/ubuntu/ubuntu.plugin.zsh b/plugins/ubuntu/ubuntu.plugin.zsh index d589096c3..a53752fb2 100644 --- a/plugins/ubuntu/ubuntu.plugin.zsh +++ b/plugins/ubuntu/ubuntu.plugin.zsh @@ -12,10 +12,10 @@ alias acp='apt-cache policy' #List all installed packages alias agli='apt list --installed' -# superuser operations ###################################################### - # List available updates only -alias aglu='sudo apt-get -u upgrade --assume-no' +alias aglu='apt list --upgradable' + +# superuser operations ###################################################### alias afu='sudo apt-file update' From df9cf723963e38d152b750d85f0907b57dde53bb Mon Sep 17 00:00:00 2001 From: Ryan Styrczula Date: Fri, 23 Aug 2019 11:05:11 -0400 Subject: [PATCH 031/302] plugins/git: Fix `gbda` trying to delete worktree branches Git learned to add a `+` in front of branches that are checked out in other worktrees. See: https://github.com/git/git/blob/745f6812895b31c02b29bdfe4ae8e5498f776c26/Documentation/RelNotes/2.23.0.txt#L252-L256 --- plugins/git/README.md | 2 +- plugins/git/git.plugin.zsh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/git/README.md b/plugins/git/README.md index 3311ccf55..7878f747b 100644 --- a/plugins/git/README.md +++ b/plugins/git/README.md @@ -22,7 +22,7 @@ plugins=(... git) | gb | git branch | | gba | git branch -a | | gbd | git branch -d | -| gbda | git branch --no-color --merged \| command grep -vE "^(\*\|\s*(master\|develop\|dev)\s*$)" \| command xargs -n 1 git branch -d | +| gbda | git branch --no-color --merged \| command grep -vE "^(\+|\*\|\s*(master\|develop\|dev)\s*$)" \| command xargs -n 1 git branch -d | | gbD | git branch -D | | gbl | git blame -b -w | | gbnm | git branch --no-merged | diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 9787392de..2edee0298 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -42,7 +42,7 @@ alias gap='git apply' alias gb='git branch' alias gba='git branch -a' alias gbd='git branch -d' -alias gbda='git branch --no-color --merged | command grep -vE "^(\*|\s*(master|develop|dev)\s*$)" | command xargs -n 1 git branch -d' +alias gbda='git branch --no-color --merged | command grep -vE "^(\+|\*|\s*(master|develop|dev)\s*$)" | command xargs -n 1 git branch -d' alias gbD='git branch -D' alias gbl='git blame -b -w' alias gbnm='git branch --no-merged' From 08beebd89f9eec956c126c732a287ec5a5a197a8 Mon Sep 17 00:00:00 2001 From: Pavel Omelchenko Date: Sat, 24 Aug 2019 01:00:08 +0300 Subject: [PATCH 032/302] homestead: repair sed regex (#8103) --- plugins/homestead/homestead.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/homestead/homestead.plugin.zsh b/plugins/homestead/homestead.plugin.zsh index b9940dbcf..ea2803d77 100644 --- a/plugins/homestead/homestead.plugin.zsh +++ b/plugins/homestead/homestead.plugin.zsh @@ -1,6 +1,6 @@ # Homestead basic command completion _homestead_get_command_list () { - homestead --no-ansi | sed "1,/(Available|Common) commands/d" | awk '/^ +[a-z]+/ { print $1 }' + homestead --no-ansi | sed -E "1,/(Available|Common) commands/d" | awk '/^ +[a-z]+/ { print $1 }' } _homestead () { From 2217a7c803f0db15e1d5d8465854e0277d4ca200 Mon Sep 17 00:00:00 2001 From: Jonathan Klimt Date: Tue, 27 Aug 2019 15:09:13 +0200 Subject: [PATCH 033/302] ripgrep: update completion to latest version (#8083) --- plugins/ripgrep/README.md | 4 +- plugins/ripgrep/_ripgrep | 187 +++++++++++++++++++++++++++++++++++++- 2 files changed, 185 insertions(+), 6 deletions(-) diff --git a/plugins/ripgrep/README.md b/plugins/ripgrep/README.md index 794b105ee..937f73c81 100644 --- a/plugins/ripgrep/README.md +++ b/plugins/ripgrep/README.md @@ -8,6 +8,6 @@ To use it, add `ripgrep` to the plugins array in your zshrc file: plugins=(... ripgrep) ``` -Completion is taken from the ripgrep release [`0.10.0`](https://github.com/BurntSushi/ripgrep/releases/tag/0.10.0). +Completion is taken from the ripgrep release [`11.0.2`](https://github.com/BurntSushi/ripgrep/releases/tag/11.0.2). -Updated on September 27th, 2018. +Updated on August 16th, 2019. diff --git a/plugins/ripgrep/_ripgrep b/plugins/ripgrep/_ripgrep index 53f135dde..d7dcfd64a 100644 --- a/plugins/ripgrep/_ripgrep +++ b/plugins/ripgrep/_ripgrep @@ -3,6 +3,12 @@ ## # zsh completion function for ripgrep # +# Run ci/test_complete.sh after building to ensure that the options supported by +# this function stay in synch with the `rg` binary. +# +# For convenience, a completion reference guide is included at the bottom of +# this file. +# # Originally based on code from the zsh-users project — see copyright notice # below. @@ -37,6 +43,7 @@ _rg() { + '(exclusive)' # Misc. fully exclusive options '(: * -)'{-h,--help}'[display help information]' '(: * -)'{-V,--version}'[display version information]' + '(: * -)'--pcre2-version'[print the version of PCRE2 used by ripgrep, if available]' + '(buffered)' # buffering options '--line-buffered[force line buffering]' @@ -79,7 +86,7 @@ _rg() { + '(file-name)' # File-name options {-H,--with-filename}'[show file name for matches]' - "--no-filename[don't show file name for matches]" + {-I,--no-filename}"[don't show file name for matches]" + '(file-system)' # File system options "--one-file-system[don't descend into directories on other file systems]" @@ -97,6 +104,10 @@ _rg() { '*'{-g+,--glob=}'[include/exclude files matching specified glob]:glob' '*--iglob=[include/exclude files matching specified case-insensitive glob]:glob' + + '(glob-case-insensitive)' # File-glob case sensitivity options + '--glob-case-insensitive[treat -g/--glob patterns case insensitively]' + $no'--no-glob-case-insensitive[treat -g/--glob patterns case sensitively]' + + '(heading)' # Heading options '(pretty-vimgrep)--heading[show matches grouped by file name]' "(pretty-vimgrep)--no-heading[don't show matches grouped by file name]" @@ -105,9 +116,17 @@ _rg() { '--hidden[search hidden files and directories]' $no"--no-hidden[don't search hidden files and directories]" + + '(hybrid)' # hybrid regex options + '--auto-hybrid-regex[dynamically use PCRE2 if necessary]' + $no"--no-auto-hybrid-regex[don't dynamically use PCRE2 if necessary]" + + '(ignore)' # Ignore-file options - "(--no-ignore-global --no-ignore-parent --no-ignore-vcs)--no-ignore[don't respect ignore files]" - $no'(--ignore-global --ignore-parent --ignore-vcs)--ignore[respect ignore files]' + "(--no-ignore-global --no-ignore-parent --no-ignore-vcs --no-ignore-dot)--no-ignore[don't respect ignore files]" + $no'(--ignore-global --ignore-parent --ignore-vcs --ignore-dot)--ignore[respect ignore files]' + + + '(ignore-file-case-insensitive)' # Ignore-file case sensitivity options + '--ignore-file-case-insensitive[process ignore files case insensitively]' + $no'--no-ignore-file-case-insensitive[process ignore files case sensitively]' + '(ignore-global)' # Global ignore-file options "--no-ignore-global[don't respect global ignore files]" @@ -121,6 +140,10 @@ _rg() { "--no-ignore-vcs[don't respect version control ignore files]" $no'--ignore-vcs[respect version control ignore files]' + + '(ignore-dot)' # .ignore-file options + "--no-ignore-dot[don't respect .ignore files]" + $no'--ignore-dot[respect .ignore files]' + + '(json)' # JSON options '--json[output results in JSON Lines format]' $no"--no-json[don't output results in JSON Lines format]" @@ -134,6 +157,10 @@ _rg() { $no"--no-crlf[don't use CRLF as line terminator]" '(text)--null-data[use NUL as line terminator]' + + '(max-columns-preview)' # max column preview options + '--max-columns-preview[show preview for long lines (with -M)]' + $no"--no-max-columns-preview[don't show preview for long lines (with -M)]" + + '(max-depth)' # Directory-depth options '--max-depth=[specify max number of directories to descend]:number of directories' '!--maxdepth=:number of directories' @@ -213,6 +240,8 @@ _rg() { + '(text)' # Binary-search options {-a,--text}'[search binary files as if they were text]' + "--binary[search binary files, don't print binary data]" + $no"--no-binary[don't search binary files]" $no"(--null-data)--no-text[don't search binary files as if they were text]" + '(threads)' # Thread-count options @@ -364,7 +393,7 @@ _rg_encodings() { shift{-,_}jis csshiftjis {,x-}sjis ms_kanji ms932 utf{,-}8 utf-16{,be,le} unicode-1-1-utf-8 windows-{31j,874,949,125{0..8}} dos-874 tis-620 ansi_x3.4-1968 - x-user-defined auto + x-user-defined auto none ) _wanted encodings expl encoding compadd -a "$@" - _encodings @@ -382,6 +411,156 @@ _rg_types() { _rg "$@" +################################################################################ +# ZSH COMPLETION REFERENCE +# +# For the convenience of developers who aren't especially familiar with zsh +# completion functions, a brief reference guide follows. This is in no way +# comprehensive; it covers just enough of the basic structure, syntax, and +# conventions to help someone make simple changes like adding new options. For +# more complete documentation regarding zsh completion functions, please see the +# following: +# +# * http://zsh.sourceforge.net/Doc/Release/Completion-System.html +# * https://github.com/zsh-users/zsh/blob/master/Etc/completion-style-guide +# +# OVERVIEW +# +# Most zsh completion functions are defined in terms of `_arguments`, which is a +# shell function that takes a series of argument specifications. The specs for +# `rg` are stored in an array, which is common for more complex functions; the +# elements of the array are passed to `_arguments` on invocation. +# +# ARGUMENT-SPECIFICATION SYNTAX +# +# The following is a contrived example of the argument specs for a simple tool: +# +# '(: * -)'{-h,--help}'[display help information]' +# '(-q -v --quiet --verbose)'{-q,--quiet}'[decrease output verbosity]' +# '!(-q -v --quiet --verbose)--silent' +# '(-q -v --quiet --verbose)'{-v,--verbose}'[increase output verbosity]' +# '--color=[specify when to use colors]:when:(always never auto)' +# '*:example file:_files' +# +# Although there may appear to be six specs here, there are actually nine; we +# use brace expansion to combine specs for options that go by multiple names, +# like `-q` and `--quiet`. This is customary, and ties in with the fact that zsh +# merges completion possibilities together when they have the same description. +# +# The first line defines the option `-h`/`--help`. With most tools, it isn't +# useful to complete anything after `--help` because it effectively overrides +# all others; the `(: * -)` at the beginning of the spec tells zsh not to +# complete any other operands (`:` and `*`) or options (`-`) after this one has +# been used. The `[...]` at the end associates a description with `-h`/`--help`; +# as mentioned, zsh will see the identical descriptions and merge these options +# together when offering completion possibilities. +# +# The next line defines `-q`/`--quiet`. Here we don't want to suppress further +# completions entirely, but we don't want to offer `-q` if `--quiet` has been +# given (since they do the same thing), nor do we want to offer `-v` (since it +# doesn't make sense to be quiet and verbose at the same time). We don't need to +# tell zsh not to offer `--quiet` a second time, since that's the default +# behaviour, but since this line expands to two specs describing `-q` *and* +# `--quiet` we do need to explicitly list all of them here. +# +# The next line defines a hidden option `--silent` — maybe it's a deprecated +# synonym for `--quiet`. The leading `!` indicates that zsh shouldn't offer this +# option during completion. The benefit of providing a spec for an option that +# shouldn't be completed is that, if someone *does* use it, we can correctly +# suppress completion of other options afterwards. +# +# The next line defines `-v`/`--verbose`; this works just like `-q`/`--quiet`. +# +# The next line defines `--color`. In this example, `--color` doesn't have a +# corresponding short option, so we don't need to use brace expansion. Further, +# there are no other options it's exclusive with (just itself), so we don't need +# to define those at the beginning. However, it does take a mandatory argument. +# The `=` at the end of `--color=` indicates that the argument may appear either +# like `--color always` or like `--color=always`; this is how most GNU-style +# command-line tools work. The corresponding short option would normally use `+` +# — for example, `-c+` would allow either `-c always` or `-calways`. For this +# option, the arguments are known ahead of time, so we can simply list them in +# parentheses at the end (`when` is used as the description for the argument). +# +# The last line defines an operand (a non-option argument). In this example, the +# operand can be used any number of times (the leading `*`), and it should be a +# file path, so we tell zsh to call the `_files` function to complete it. The +# `example file` in the middle is the description to use for this operand; we +# could use a space instead to accept the default provided by `_files`. +# +# GROUPING ARGUMENT SPECIFICATIONS +# +# Newer versions of zsh support grouping argument specs together. All specs +# following a `+` and then a group name are considered to be members of the +# named group. Grouping is useful mostly for organisational purposes; it makes +# the relationship between different options more obvious, and makes it easier +# to specify exclusions. +# +# We could rewrite our example above using grouping as follows: +# +# '(: * -)'{-h,--help}'[display help information]' +# '--color=[specify when to use colors]:when:(always never auto)' +# '*:example file:_files' +# + '(verbosity)' +# {-q,--quiet}'[decrease output verbosity]' +# '!--silent' +# {-v,--verbose}'[increase output verbosity]' +# +# Here we take advantage of a useful feature of spec grouping — when the group +# name is surrounded by parentheses, as in `(verbosity)`, it tells zsh that all +# of the options in that group are exclusive with each other. As a result, we +# don't need to manually list out the exclusions at the beginning of each +# option. +# +# Groups can also be referred to by name in other argument specs; for example: +# +# '(xyz)--aaa' '*: :_files' +# + xyz --xxx --yyy --zzz +# +# Here we use the group name `xyz` to tell zsh that `--xxx`, `--yyy`, and +# `--zzz` are not to be completed after `--aaa`. This makes the exclusion list +# much more compact and reusable. +# +# CONVENTIONS +# +# zsh completion functions generally adhere to the following conventions: +# +# * Use two spaces for indentation +# * Combine specs for options with different names using brace expansion +# * In combined specs, list the short option first (as in `{-a,--text}`) +# * Use `+` or `=` as described above for options that take arguments +# * Provide a description for all options, option-arguments, and operands +# * Capitalise/punctuate argument descriptions as phrases, not complete +# sentences — 'display help information', never 'Display help information.' +# (but still capitalise acronyms and proper names) +# * Write argument descriptions as verb phrases — 'display x', 'enable y', +# 'use z' +# * Word descriptions to make it clear when an option expects an argument; +# usually this is done with the word 'specify', as in 'specify x' or +# 'use specified x') +# * Write argument descriptions as tersely as possible — for example, articles +# like 'a' and 'the' should be omitted unless it would be confusing +# +# Other conventions currently used by this function: +# +# * Order argument specs alphabetically by group name, then option name +# * Group options that are directly related, mutually exclusive, or frequently +# referenced by other argument specs +# * Use only characters in the set [a-z0-9_-] in group names +# * Order exclusion lists as follows: short options, long options, groups +# * Use American English in descriptions +# * Use 'don't' in descriptions instead of 'do not' +# * Word descriptions for related options as similarly as possible. For example, +# `--foo[enable foo]` and `--no-foo[disable foo]`, or `--foo[use foo]` and +# `--no-foo[don't use foo]` +# * Word descriptions to make it clear when an option only makes sense with +# another option, usually by adding '(with -x)' to the end +# * Don't quote strings or variables unnecessarily. When quotes are required, +# prefer single-quotes to double-quotes +# * Prefix option specs with `$no` when the option serves only to negate the +# behaviour of another option that must be provided explicitly by the user. +# This prevents rarely used options from cluttering up the completion menu +################################################################################ # ------------------------------------------------------------------------------ # Copyright (c) 2011 Github zsh-users - http://github.com/zsh-users From 9524db7398f405b26091f58fa8e2125d4e440a24 Mon Sep 17 00:00:00 2001 From: mapshen Date: Tue, 27 Aug 2019 15:41:44 -0400 Subject: [PATCH 034/302] autojump: fix loading when autojump is not in $PATH (#8074) The `commands[autojump]` block errs out when autojump is not found, and the rest, which is intended to be used for loading `autojump`, does not get executed. --- plugins/autojump/autojump.plugin.zsh | 5 ----- 1 file changed, 5 deletions(-) diff --git a/plugins/autojump/autojump.plugin.zsh b/plugins/autojump/autojump.plugin.zsh index 13c1d00ed..d80c88822 100644 --- a/plugins/autojump/autojump.plugin.zsh +++ b/plugins/autojump/autojump.plugin.zsh @@ -1,8 +1,3 @@ -(( $+commands[autojump] )) || { - echo '[oh-my-zsh] Please install autojump first (https://github.com/wting/autojump)' - return -} - declare -a autojump_paths autojump_paths=( $HOME/.autojump/etc/profile.d/autojump.zsh # manual installation From a331063a04fff829805e3731b2ef75835d4243b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ing=2E=20Jan=20Kal=C3=A1b?= Date: Mon, 2 Sep 2019 13:30:26 +0200 Subject: [PATCH 035/302] git-escape-magic: fix typo (#8113) --- plugins/git-escape-magic/README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/git-escape-magic/README.md b/plugins/git-escape-magic/README.md index a14364f22..c3e3898f5 100644 --- a/plugins/git-escape-magic/README.md +++ b/plugins/git-escape-magic/README.md @@ -8,10 +8,9 @@ An excerpt from that project's readme explains it's purpose. > It eliminates the need for manually escaping those meta-characters. The zle function it provides is context aware and recognizes the characteristics of each subcommand of git. Every time you type one of these meta-characters on a git command line, it automatically escapes the meta-character with a backslash as necessary and as appropriate. -## Useage +## Usage To use this plugin add it to your list of plugins in your `.zshrc` file. **NOTE**: If you use url-quote-magic it must be included before this plugin runs to prevent any conflicts. - From 15dd77055e2b4a931d50ad3e05f823893aac66af Mon Sep 17 00:00:00 2001 From: Salomon Smeke Date: Mon, 2 Sep 2019 06:40:39 -0500 Subject: [PATCH 036/302] wd: point to the correct directory even if installed with antibody (#8116) --- plugins/wd/wd.plugin.zsh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/plugins/wd/wd.plugin.zsh b/plugins/wd/wd.plugin.zsh index c0559293d..4b7cd3c19 100644 --- a/plugins/wd/wd.plugin.zsh +++ b/plugins/wd/wd.plugin.zsh @@ -1,11 +1,7 @@ -#!/bin/zsh - # WARP DIRECTORY # ============== # oh-my-zsh plugin # # @github.com/mfaerevaag/wd -wd() { - . $ZSH/plugins/wd/wd.sh -} +eval "wd() { source '${0:A:h}/wd.sh' }" From b3d3ce8aa604aecc52c132a9d67e075b0ca64722 Mon Sep 17 00:00:00 2001 From: Braxton Schafer Date: Tue, 3 Sep 2019 14:15:13 -0500 Subject: [PATCH 037/302] Fix bad function definitions in Debian plugin There appears to be a definition issue for some functions/aliases which result in the following errors when sourcing .zshrc: ``` /home/username/.oh-my-zsh/plugins/debian/debian.plugin.zsh:75: defining function based on alias `abd' /home/username/.oh-my-zsh/plugins/debian/debian.plugin.zsh:75: parse error near `()' ``` Fixes #7986 --- plugins/debian/debian.plugin.zsh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/debian/debian.plugin.zsh b/plugins/debian/debian.plugin.zsh index be4062ebf..dd80485d0 100644 --- a/plugins/debian/debian.plugin.zsh +++ b/plugins/debian/debian.plugin.zsh @@ -72,7 +72,7 @@ if [[ $use_sudo -eq 1 ]]; then # commands using su ######### else alias aac="su -ls '$apt_pref autoclean' root" - abd() { + function abd() { cmd="su -lc '$apt_pref build-dep $@' root" print "$cmd" eval "$cmd" @@ -83,17 +83,17 @@ else alias adu="su -lc '$apt_pref update && aptitude dist-upgrade' root" alias afu="su -lc '$apt-file update'" alias au="su -lc '$apt_pref $apt_upgr' root" - ai() { + function ai() { cmd="su -lc 'aptitude -P install $@' root" print "$cmd" eval "$cmd" } - ap() { + function ap() { cmd="su -lc '$apt_pref -P purge $@' root" print "$cmd" eval "$cmd" } - ar() { + function ar() { cmd="su -lc '$apt_pref -P remove $@' root" print "$cmd" eval "$cmd" From a4f6a9964ceec3d222a8caa8eb3e5cf6027cfbab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 3 Sep 2019 21:19:38 +0200 Subject: [PATCH 038/302] meta: remove PR triage GitHub action :cry: We do this because the GitHub Actions behavior was changed recently so as to not pass secrets to action runs started from forks, therefore the API token passed cannot be used to change PR labels. There may be an alternative in the future. --- .github/workflows/pull_request_triage.yml | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 .github/workflows/pull_request_triage.yml diff --git a/.github/workflows/pull_request_triage.yml b/.github/workflows/pull_request_triage.yml deleted file mode 100644 index 77ec4ce79..000000000 --- a/.github/workflows/pull_request_triage.yml +++ /dev/null @@ -1,15 +0,0 @@ -on: pull_request -name: Triage Pull Request -jobs: - triage: - name: Triage - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@master - if: github.event.action == 'opened' || github.event.action == 'synchronize' - - name: Analyze and triage - uses: ohmyzsh/github-actions/pull-request-triage@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - DEBUG_ACTIONS: ${{ secrets.DEBUG_ACTIONS }} From 1f58cd92ddb94fb75e4fb45f231eebfd55aa19dd Mon Sep 17 00:00:00 2001 From: Addison G Date: Fri, 6 Sep 2019 14:12:56 +1000 Subject: [PATCH 039/302] Updated git-prompt.sh to quote variables An error was thrown (`bash: [: =: unary operator expected`) when using the __git_ps1_colorize_gitstring function outside of the one place it's called (line 512), because the "detached" variable was not quoted, and was unset. --- plugins/gitfast/git-prompt.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/plugins/gitfast/git-prompt.sh b/plugins/gitfast/git-prompt.sh index fd2b049db..3e86e9cca 100644 --- a/plugins/gitfast/git-prompt.sh +++ b/plugins/gitfast/git-prompt.sh @@ -219,7 +219,7 @@ __git_ps1_show_upstream () if [[ -n "$count" && -n "$name" ]]; then __git_ps1_upstream_name=$(git rev-parse \ --abbrev-ref "$upstream" 2>/dev/null) - if [ $pcmode = yes ] && [ $ps1_expanded = yes ]; then + if [ "$pcmode" = "yes" ] && [ "$ps1_expanded" = "yes" ]; then p="$p \${__git_ps1_upstream_name}" else p="$p ${__git_ps1_upstream_name}" @@ -237,7 +237,7 @@ __git_ps1_show_upstream () # to build a gitstring. __git_ps1_colorize_gitstring () { - if [[ -n ${ZSH_VERSION-} ]]; then + if [[ -n "${ZSH_VERSION-}" ]]; then local c_red='%F{red}' local c_green='%F{green}' local c_lblue='%F{blue}' @@ -255,7 +255,7 @@ __git_ps1_colorize_gitstring () local flags_color="$c_lblue" local branch_color="" - if [ $detached = no ]; then + if [ "$detached" = no ]; then branch_color="$ok_color" else branch_color="$bad_color" @@ -508,13 +508,13 @@ __git_ps1 () # NO color option unless in PROMPT_COMMAND mode or it's Zsh if [ -n "${GIT_PS1_SHOWCOLORHINTS-}" ]; then - if [ $pcmode = yes ] || [ -n "${ZSH_VERSION-}" ]; then + if [ "$pcmode" = "yes" ] || [ -n "${ZSH_VERSION-}" ]; then __git_ps1_colorize_gitstring fi fi b=${b##refs/heads/} - if [ $pcmode = yes ] && [ $ps1_expanded = yes ]; then + if [ "$pcmode" = "yes" ] && [ "$ps1_expanded" = "yes" ]; then __git_ps1_branch_name=$b b="\${__git_ps1_branch_name}" fi @@ -522,8 +522,8 @@ __git_ps1 () local f="$w$i$s$u" local gitstring="$c$b${f:+$z$f}$r$p" - if [ $pcmode = yes ]; then - if [ "${__git_printf_supports_v-}" != yes ]; then + if [ "$pcmode" = "yes" ]; then + if [ "${__git_printf_supports_v-}" != "yes" ]; then gitstring=$(printf -- "$printf_format" "$gitstring") else printf -v gitstring -- "$printf_format" "$gitstring" From a870fee6a7cb6783e85abe42a222c7d5f4e89676 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sun, 8 Sep 2019 14:58:46 +0200 Subject: [PATCH 040/302] Update syntax on the remaining functions --- plugins/debian/debian.plugin.zsh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/plugins/debian/debian.plugin.zsh b/plugins/debian/debian.plugin.zsh index dd80485d0..68c6df1ae 100644 --- a/plugins/debian/debian.plugin.zsh +++ b/plugins/debian/debian.plugin.zsh @@ -114,7 +114,7 @@ fi # Registers a compdef for $1 that calls $apt_pref with the commands $2 # To do that it creates a new completion function called _apt_pref_$2 # -apt_pref_compdef() { +function apt_pref_compdef() { local f fb f="_apt_pref_${2}" @@ -151,7 +151,7 @@ alias mydeb='time dpkg-buildpackage -rfakeroot -us -uc' # Functions ################################################################# # create a simple script that can be used to 'duplicate' a system -apt-copy() { +function apt-copy() { print '#!/bin/sh'"\n" > apt-copy.sh cmd='$apt_pref install' @@ -173,7 +173,7 @@ apt-copy() { # apt-history rollback # apt-history list # Based On: https://linuxcommando.blogspot.com/2008/08/how-to-show-apt-log-history.html -apt-history () { +function apt-history() { case "$1" in install) zgrep --no-filename 'install ' $(ls -rt /var/log/dpkg*) @@ -202,7 +202,7 @@ apt-history () { } # Kernel-package building shortcut -kerndeb () { +function kerndeb() { # temporarily unset MAKEFLAGS ( '-j3' will fail ) MAKEFLAGS=$( print - $MAKEFLAGS | perl -pe 's/-j\s*[\d]+//g' ) print '$MAKEFLAGS set to '"'$MAKEFLAGS'" @@ -216,10 +216,9 @@ kerndeb () { } # List packages by size -function apt-list-packages { +function apt-list-packages() { dpkg-query -W --showformat='${Installed-Size} ${Package} ${Status}\n' | \ grep -v deinstall | \ sort -n | \ awk '{print $1" "$2}' } - From 9c3e3ae5e451637873ae74da1732e98f3df3784c Mon Sep 17 00:00:00 2001 From: Sean Collins Date: Sun, 8 Sep 2019 07:05:20 -0600 Subject: [PATCH 041/302] Change description for Evan's theme to something neutral (#6304) --- themes/evan.zsh-theme | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/evan.zsh-theme b/themes/evan.zsh-theme index 5ef1f40dd..02ca22d4c 100644 --- a/themes/evan.zsh-theme +++ b/themes/evan.zsh-theme @@ -1,2 +1,2 @@ -# Evan describes this sexy prompt as: "a skinny, topless prompt" -PROMPT='%m :: %2~ %B»%b ' \ No newline at end of file +# Evan's minimal prompt +PROMPT='%m :: %2~ %B»%b ' From c44569f06eef2a3b4a1666686e7040c33e59e49c Mon Sep 17 00:00:00 2001 From: Hanjiang Yu <42531996+de1acr0ix@users.noreply.github.com> Date: Sun, 8 Sep 2019 21:07:33 +0800 Subject: [PATCH 042/302] robbyrussell: remove local variable (#8131) Now it can be sourced in a function, like zplug. --- themes/robbyrussell.zsh-theme | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/robbyrussell.zsh-theme b/themes/robbyrussell.zsh-theme index f9eca6a87..4df8433e3 100644 --- a/themes/robbyrussell.zsh-theme +++ b/themes/robbyrussell.zsh-theme @@ -1,5 +1,5 @@ -local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )" -PROMPT='${ret_status} %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)' +PROMPT="%(?:%{$fg_bold[green]%}➜:%{$fg_bold[red]%}➜)" +PROMPT+=' %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)' ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " From 101ea872326211830e90d2bd01bd8506673f9d11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sun, 8 Sep 2019 16:07:06 +0200 Subject: [PATCH 043/302] ssh-agent: check if `ssh-add -l` was successful --- plugins/ssh-agent/ssh-agent.plugin.zsh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/plugins/ssh-agent/ssh-agent.plugin.zsh b/plugins/ssh-agent/ssh-agent.plugin.zsh index 9471ff49c..6ab041c21 100644 --- a/plugins/ssh-agent/ssh-agent.plugin.zsh +++ b/plugins/ssh-agent/ssh-agent.plugin.zsh @@ -12,7 +12,7 @@ function _start_agent() { } function _add_identities() { - local id line sig + local id line sig lines local -a identities loaded_sigs loaded_ids not_loaded zstyle -a :omz:plugins:ssh-agent identities identities @@ -32,10 +32,12 @@ function _add_identities() { fi # get list of loaded identities' signatures and filenames - for line in ${(f)"$(ssh-add -l)"}; do - loaded_sigs+=${${(z)line}[2]} - loaded_ids+=${${(z)line}[3]} - done + if lines=$(ssh-add -l); then + for line in ${(f)lines}; do + loaded_sigs+=${${(z)line}[2]} + loaded_ids+=${${(z)line}[3]} + done + fi # add identities if not already loaded for id in $identities; do From 229a1c971903aaae0bebf73dfda41cb71c25560c Mon Sep 17 00:00:00 2001 From: Prajjwal Singh Date: Sun, 8 Sep 2019 19:46:00 +0530 Subject: [PATCH 044/302] gitfast: update completions (#8130) Includes completions for `git switch`. --- plugins/gitfast/_git | 19 +- plugins/gitfast/git-completion.bash | 1353 ++++++++++++--------------- 2 files changed, 605 insertions(+), 767 deletions(-) diff --git a/plugins/gitfast/_git b/plugins/gitfast/_git index 78a6dbb3d..886bf95d1 100644 --- a/plugins/gitfast/_git +++ b/plugins/gitfast/_git @@ -30,7 +30,7 @@ if [ -z "$script" ]; then local -a locations local e locations=( - "$(dirname ${funcsourcetrace[1]%:*})/git-completion.bash" + $(dirname ${funcsourcetrace[1]%:*})/git-completion.bash '/etc/bash_completion.d/git' # fedora, old debian '/usr/share/bash-completion/completions/git' # arch, ubuntu, new debian '/usr/share/bash-completion/git' # gentoo @@ -39,7 +39,7 @@ if [ -z "$script" ]; then test -f $e && script="$e" && break done fi -ZSH_VERSION='' . "$script" +GIT_SOURCING_ZSH_COMPLETION=y . "$script" __gitcomp () { @@ -93,13 +93,22 @@ __gitcomp_nl_append () compadd -Q -S "${4- }" -p "${2-}" -- ${=1} && _ret=0 } +__gitcomp_file_direct () +{ + emulate -L zsh + + local IFS=$'\n' + compset -P '*[=:]' + compadd -f -- ${=1} && _ret=0 +} + __gitcomp_file () { emulate -L zsh local IFS=$'\n' compset -P '*[=:]' - compadd -Q -p "${2-}" -f -- ${=1} && _ret=0 + compadd -p "${2-}" -f -- ${=1} && _ret=0 } __git_zsh_bash_func () @@ -223,10 +232,8 @@ _git () if (( $+functions[__${service}_zsh_main] )); then __${service}_zsh_main - elif (( $+functions[__${service}_main] )); then + else emulate ksh -c __${service}_main - elif (( $+functions[_${service}] )); then - emulate ksh -c _${service} fi let _ret && _default && _ret=0 diff --git a/plugins/gitfast/git-completion.bash b/plugins/gitfast/git-completion.bash index b6ff5dc08..e087c4bf0 100644 --- a/plugins/gitfast/git-completion.bash +++ b/plugins/gitfast/git-completion.bash @@ -29,13 +29,16 @@ # tell the completion to use commit completion. This also works with aliases # of form "!sh -c '...'". For example, "!sh -c ': git commit ; ... '". # +# Compatible with bash 3.2.57. +# # You can set the following environment variables to influence the behavior of # the completion routines: # # GIT_COMPLETION_CHECKOUT_NO_GUESS # # When set to "1", do not include "DWIM" suggestions in git-checkout -# completion (e.g., completing "foo" when "origin/foo" exists). +# and git-switch completion (e.g., completing "foo" when "origin/foo" +# exists). case "$COMP_WORDBREAKS" in *:*) : great ;; @@ -92,6 +95,70 @@ __git () ${__git_dir:+--git-dir="$__git_dir"} "$@" 2>/dev/null } +# Removes backslash escaping, single quotes and double quotes from a word, +# stores the result in the variable $dequoted_word. +# 1: The word to dequote. +__git_dequote () +{ + local rest="$1" len ch + + dequoted_word="" + + while test -n "$rest"; do + len=${#dequoted_word} + dequoted_word="$dequoted_word${rest%%[\\\'\"]*}" + rest="${rest:$((${#dequoted_word}-$len))}" + + case "${rest:0:1}" in + \\) + ch="${rest:1:1}" + case "$ch" in + $'\n') + ;; + *) + dequoted_word="$dequoted_word$ch" + ;; + esac + rest="${rest:2}" + ;; + \') + rest="${rest:1}" + len=${#dequoted_word} + dequoted_word="$dequoted_word${rest%%\'*}" + rest="${rest:$((${#dequoted_word}-$len+1))}" + ;; + \") + rest="${rest:1}" + while test -n "$rest" ; do + len=${#dequoted_word} + dequoted_word="$dequoted_word${rest%%[\\\"]*}" + rest="${rest:$((${#dequoted_word}-$len))}" + case "${rest:0:1}" in + \\) + ch="${rest:1:1}" + case "$ch" in + \"|\\|\$|\`) + dequoted_word="$dequoted_word$ch" + ;; + $'\n') + ;; + *) + dequoted_word="$dequoted_word\\$ch" + ;; + esac + rest="${rest:2}" + ;; + \") + rest="${rest:1}" + break + ;; + esac + done + ;; + esac + done +} + # The following function is based on code from: # # bash_completion - programmable completion functions for bash 3.2+ @@ -264,9 +331,32 @@ __gitcomp () case "$cur_" in --*=) ;; + --no-*) + local c i=0 IFS=$' \t\n' + for c in $1; do + if [[ $c == "--" ]]; then + continue + fi + c="$c${4-}" + if [[ $c == "$cur_"* ]]; then + case $c in + --*=*|*.) ;; + *) c="$c " ;; + esac + COMPREPLY[i++]="${2-}$c" + fi + done + ;; *) local c i=0 IFS=$' \t\n' for c in $1; do + if [[ $c == "--" ]]; then + c="--no-...${4-}" + if [[ $c == "$cur_"* ]]; then + COMPREPLY[i++]="${2-}$c " + fi + break + fi c="$c${4-}" if [[ $c == "$cur_"* ]]; then case $c in @@ -280,6 +370,48 @@ __gitcomp () esac } +# Clear the variables caching builtins' options when (re-)sourcing +# the completion script. +if [[ -n ${ZSH_VERSION-} ]]; then + unset $(set |sed -ne 's/^\(__gitcomp_builtin_[a-zA-Z0-9_][a-zA-Z0-9_]*\)=.*/\1/p') 2>/dev/null +else + unset $(compgen -v __gitcomp_builtin_) +fi + +# This function is equivalent to +# +# __gitcomp "$(git xxx --git-completion-helper) ..." +# +# except that the output is cached. Accept 1-3 arguments: +# 1: the git command to execute, this is also the cache key +# 2: extra options to be added on top (e.g. negative forms) +# 3: options to be excluded +__gitcomp_builtin () +{ + # spaces must be replaced with underscore for multi-word + # commands, e.g. "git remote add" becomes remote_add. + local cmd="$1" + local incl="$2" + local excl="$3" + + local var=__gitcomp_builtin_"${cmd/-/_}" + local options + eval "options=\$$var" + + if [ -z "$options" ]; then + # leading and trailing spaces are significant to make + # option removal work correctly. + options=" $incl $(__git ${cmd/_/ } --git-completion-helper) " || return + + for i in $excl; do + options="${options/ $i / }" + done + eval "$var=\"$options\"" + fi + + __gitcomp "$options" +} + # Variation of __gitcomp_nl () that appends to the existing list of # completion candidates, COMPREPLY. __gitcomp_nl_append () @@ -303,6 +435,24 @@ __gitcomp_nl () __gitcomp_nl_append "$@" } +# Fills the COMPREPLY array with prefiltered paths without any additional +# processing. +# Callers must take care of providing only paths that match the current path +# to be completed and adding any prefix path components, if necessary. +# 1: List of newline-separated matching paths, complete with all prefix +# path components. +__gitcomp_file_direct () +{ + local IFS=$'\n' + + COMPREPLY=($1) + + # use a hack to enable file mode in bash < 4 + compopt -o filenames +o nospace 2>/dev/null || + compgen -f /non-existing-dir/ >/dev/null || + true +} + # Generates completion reply with compgen from newline-separated possible # completion filenames. # It accepts 1 to 3 arguments: @@ -322,7 +472,8 @@ __gitcomp_file () # use a hack to enable file mode in bash < 4 compopt -o filenames +o nospace 2>/dev/null || - compgen -f /non-existing-dir/ > /dev/null + compgen -f /non-existing-dir/ >/dev/null || + true } # Execute 'git ls-files', unless the --committable option is specified, in @@ -332,10 +483,12 @@ __gitcomp_file () __git_ls_files_helper () { if [ "$2" == "--committable" ]; then - __git -C "$1" diff-index --name-only --relative HEAD + __git -C "$1" -c core.quotePath=false diff-index \ + --name-only --relative HEAD -- "${3//\\/\\\\}*" else # NOTE: $2 is not quoted in order to support multiple options - __git -C "$1" ls-files --exclude-standard $2 + __git -C "$1" -c core.quotePath=false ls-files \ + --exclude-standard $2 -- "${3//\\/\\\\}*" fi } @@ -346,17 +499,103 @@ __git_ls_files_helper () # If provided, only files within the specified directory are listed. # Sub directories are never recursed. Path must have a trailing # slash. +# 3: List only paths matching this path component (optional). __git_index_files () { - local root="${2-.}" file + local root="$2" match="$3" - __git_ls_files_helper "$root" "$1" | - while read -r file; do - case "$file" in - ?*/*) echo "${file%%/*}" ;; - *) echo "$file" ;; - esac - done | sort | uniq + __git_ls_files_helper "$root" "$1" "$match" | + awk -F / -v pfx="${2//\\/\\\\}" '{ + paths[$1] = 1 + } + END { + for (p in paths) { + if (substr(p, 1, 1) != "\"") { + # No special characters, easy! + print pfx p + continue + } + + # The path is quoted. + p = dequote(p) + if (p == "") + continue + + # Even when a directory name itself does not contain + # any special characters, it will still be quoted if + # any of its (stripped) trailing path components do. + # Because of this we may have seen the same direcory + # both quoted and unquoted. + if (p in paths) + # We have seen the same directory unquoted, + # skip it. + continue + else + print pfx p + } + } + function dequote(p, bs_idx, out, esc, esc_idx, dec) { + # Skip opening double quote. + p = substr(p, 2) + + # Interpret backslash escape sequences. + while ((bs_idx = index(p, "\\")) != 0) { + out = out substr(p, 1, bs_idx - 1) + esc = substr(p, bs_idx + 1, 1) + p = substr(p, bs_idx + 2) + + if ((esc_idx = index("abtvfr\"\\", esc)) != 0) { + # C-style one-character escape sequence. + out = out substr("\a\b\t\v\f\r\"\\", + esc_idx, 1) + } else if (esc == "n") { + # Uh-oh, a newline character. + # We cant reliably put a pathname + # containing a newline into COMPREPLY, + # and the newline would create a mess. + # Skip this path. + return "" + } else { + # Must be a \nnn octal value, then. + dec = esc * 64 + \ + substr(p, 1, 1) * 8 + \ + substr(p, 2, 1) + out = out sprintf("%c", dec) + p = substr(p, 3) + } + } + # Drop closing double quote, if there is one. + # (There isnt any if this is a directory, as it was + # already stripped with the trailing path components.) + if (substr(p, length(p), 1) == "\"") + out = out substr(p, 1, length(p) - 1) + else + out = out p + + return out + }' +} + +# __git_complete_index_file requires 1 argument: +# 1: the options to pass to ls-file +# +# The exception is --committable, which finds the files appropriate commit. +__git_complete_index_file () +{ + local dequoted_word pfx="" cur_ + + __git_dequote "$cur" + + case "$dequoted_word" in + ?*/*) + pfx="${dequoted_word%/*}/" + cur_="${dequoted_word##*/}" + ;; + *) + cur_="$dequoted_word" + esac + + __gitcomp_file_direct "$(__git_index_files "$1" "$pfx" "$cur_")" } # Lists branches from the local repository. @@ -439,7 +678,7 @@ __git_refs () track="" ;; *) - for i in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD; do + for i in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD REBASE_HEAD; do case "$i" in $match*) if [ -e "$dir/$i" ]; then @@ -594,7 +833,7 @@ __git_is_configured_remote () __git_list_merge_strategies () { - git merge -s help 2>&1 | + LANG=C LC_ALL=C git merge -s help 2>&1 | sed -n -e '/[Aa]vailable strategies are: /,/^$/{ s/\.$// s/.*:// @@ -616,9 +855,14 @@ __git_compute_merge_strategies () __git_merge_strategies=$(__git_list_merge_strategies) } +__git_merge_strategy_options="ours theirs subtree subtree= patience + histogram diff-algorithm= ignore-space-change ignore-all-space + ignore-space-at-eol renormalize no-renormalize no-renames + find-renames find-renames= rename-threshold=" + __git_complete_revlist_file () { - local pfx ls ref cur_="$cur" + local dequoted_word pfx ls ref cur_="$cur" case "$cur_" in *..?*:*) return @@ -626,14 +870,18 @@ __git_complete_revlist_file () ?*:*) ref="${cur_%%:*}" cur_="${cur_#*:}" - case "$cur_" in + + __git_dequote "$cur_" + + case "$dequoted_word" in ?*/*) - pfx="${cur_%/*}" - cur_="${cur_##*/}" + pfx="${dequoted_word%/*}" + cur_="${dequoted_word##*/}" ls="$ref:$pfx" pfx="$pfx/" ;; *) + cur_="$dequoted_word" ls="$ref" ;; esac @@ -643,21 +891,10 @@ __git_complete_revlist_file () *) pfx="$ref:$pfx" ;; esac - __gitcomp_nl "$(__git ls-tree "$ls" \ - | sed '/^100... blob /{ - s,^.* ,, - s,$, , - } - /^120000 blob /{ - s,^.* ,, - s,$, , - } - /^040000 tree /{ - s,^.* ,, - s,$,/, - } - s/^.* //')" \ - "$pfx" "$cur_" "" + __gitcomp_file "$(__git ls-tree "$ls" \ + | sed 's/^.* // + s/$//')" \ + "$pfx" "$cur_" ;; *...*) pfx="${cur_%...*}..." @@ -675,26 +912,6 @@ __git_complete_revlist_file () esac } - -# __git_complete_index_file requires 1 argument: -# 1: the options to pass to ls-file -# -# The exception is --committable, which finds the files appropriate commit. -__git_complete_index_file () -{ - local pfx="" cur_="$cur" - - case "$cur_" in - ?*/*) - pfx="${cur_%/*}" - cur_="${cur_##*/}" - pfx="${pfx}/" - ;; - esac - - __gitcomp_file "$(__git_index_files "$1" ${pfx:+"$pfx"})" "$pfx" "$cur_" -} - __git_complete_file () { __git_complete_revlist_file @@ -726,6 +943,7 @@ __git_complete_remote_or_refspec () *) ;; esac ;; + --multiple) no_complete_refspec=1; break ;; -*) ;; *) remote="$i"; break ;; esac @@ -785,136 +1003,30 @@ __git_complete_strategy () -s|--strategy) __gitcomp "$__git_merge_strategies" return 0 + ;; + -X) + __gitcomp "$__git_merge_strategy_options" + return 0 + ;; esac case "$cur" in --strategy=*) __gitcomp "$__git_merge_strategies" "" "${cur##--strategy=}" return 0 ;; + --strategy-option=*) + __gitcomp "$__git_merge_strategy_options" "" "${cur##--strategy-option=}" + return 0 + ;; esac return 1 } -__git_commands () { - if test -n "${GIT_TESTING_COMMAND_COMPLETION:-}" - then - printf "%s" "${GIT_TESTING_COMMAND_COMPLETION}" - else - git help -a|egrep '^ [a-zA-Z0-9]' - fi -} - -__git_list_all_commands () -{ - local i IFS=" "$'\n' - for i in $(__git_commands) - do - case $i in - *--*) : helper pattern;; - *) echo $i;; - esac - done -} - __git_all_commands= __git_compute_all_commands () { test -n "$__git_all_commands" || - __git_all_commands=$(__git_list_all_commands) -} - -__git_list_porcelain_commands () -{ - local i IFS=" "$'\n' - __git_compute_all_commands - for i in $__git_all_commands - do - case $i in - *--*) : helper pattern;; - applymbox) : ask gittus;; - applypatch) : ask gittus;; - archimport) : import;; - cat-file) : plumbing;; - check-attr) : plumbing;; - check-ignore) : plumbing;; - check-mailmap) : plumbing;; - check-ref-format) : plumbing;; - checkout-index) : plumbing;; - column) : internal helper;; - commit-tree) : plumbing;; - count-objects) : infrequent;; - credential) : credentials;; - credential-*) : credentials helper;; - cvsexportcommit) : export;; - cvsimport) : import;; - cvsserver) : daemon;; - daemon) : daemon;; - diff-files) : plumbing;; - diff-index) : plumbing;; - diff-tree) : plumbing;; - fast-import) : import;; - fast-export) : export;; - fsck-objects) : plumbing;; - fetch-pack) : plumbing;; - fmt-merge-msg) : plumbing;; - for-each-ref) : plumbing;; - hash-object) : plumbing;; - http-*) : transport;; - index-pack) : plumbing;; - init-db) : deprecated;; - local-fetch) : plumbing;; - ls-files) : plumbing;; - ls-remote) : plumbing;; - ls-tree) : plumbing;; - mailinfo) : plumbing;; - mailsplit) : plumbing;; - merge-*) : plumbing;; - mktree) : plumbing;; - mktag) : plumbing;; - pack-objects) : plumbing;; - pack-redundant) : plumbing;; - pack-refs) : plumbing;; - parse-remote) : plumbing;; - patch-id) : plumbing;; - prune) : plumbing;; - prune-packed) : plumbing;; - quiltimport) : import;; - read-tree) : plumbing;; - receive-pack) : plumbing;; - remote-*) : transport;; - rerere) : plumbing;; - rev-list) : plumbing;; - rev-parse) : plumbing;; - runstatus) : plumbing;; - sh-setup) : internal;; - shell) : daemon;; - show-ref) : plumbing;; - send-pack) : plumbing;; - show-index) : plumbing;; - ssh-*) : transport;; - stripspace) : plumbing;; - symbolic-ref) : plumbing;; - unpack-file) : plumbing;; - unpack-objects) : plumbing;; - update-index) : plumbing;; - update-ref) : plumbing;; - update-server-info) : daemon;; - upload-archive) : plumbing;; - upload-pack) : plumbing;; - write-tree) : plumbing;; - var) : infrequent;; - verify-pack) : infrequent;; - verify-tag) : plumbing;; - *) echo $i;; - esac - done -} - -__git_porcelain_commands= -__git_compute_porcelain_commands () -{ - test -n "$__git_porcelain_commands" || - __git_porcelain_commands=$(__git_list_porcelain_commands) + __git_all_commands=$(__git --list-cmds=main,others,alias,nohelpers) } # Lists all set config variables starting with the given section prefix, @@ -932,11 +1044,6 @@ __git_pretty_aliases () __git_get_config_variables "pretty" } -__git_aliases () -{ - __git_get_config_variables "alias" -} - # __git_aliased_command requires 1 argument __git_aliased_command () { @@ -1072,12 +1179,14 @@ __git_count_arguments () } __git_whitespacelist="nowarn warn error error-all fix" +__git_patchformat="mbox stgit stgit-series hg mboxrd" +__git_am_inprogress_options="--skip --continue --resolved --abort --quit --show-current-patch" _git_am () { __git_find_repo_path if [ -d "$__git_repo_path"/rebase-apply ]; then - __gitcomp "--skip --continue --resolved --abort" + __gitcomp "$__git_am_inprogress_options" return fi case "$cur" in @@ -1085,13 +1194,13 @@ _git_am () __gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}" return ;; + --patch-format=*) + __gitcomp "$__git_patchformat" "" "${cur##--patch-format=}" + return + ;; --*) - __gitcomp " - --3way --committer-date-is-author-date --ignore-date - --ignore-whitespace --ignore-space-change - --interactive --keep --no-utf8 --signoff --utf8 - --whitespace= --scissors - " + __gitcomp_builtin am "" \ + "$__git_am_inprogress_options" return esac } @@ -1104,14 +1213,7 @@ _git_apply () return ;; --*) - __gitcomp " - --stat --numstat --summary --check --index - --cached --index-info --reverse --reject --unidiff-zero - --apply --no-add --exclude= - --ignore-whitespace --ignore-space-change - --whitespace= --inaccurate-eof --verbose - --recount --directory= - " + __gitcomp_builtin apply return esac } @@ -1119,11 +1221,12 @@ _git_apply () _git_add () { case "$cur" in + --chmod=*) + __gitcomp "+x -x" "" "${cur##--chmod=}" + return + ;; --*) - __gitcomp " - --interactive --refresh --patch --update --dry-run - --ignore-errors --intent-to-add --force --edit --chmod= - " + __gitcomp_builtin add return esac @@ -1182,6 +1285,8 @@ _git_bisect () esac } +__git_ref_fieldlist="refname objecttype objectsize objectname upstream push HEAD symref" + _git_branch () { local i c=1 only_local_ref="n" has_r="n" @@ -1200,13 +1305,7 @@ _git_branch () __git_complete_refs --cur="${cur##--set-upstream-to=}" ;; --*) - __gitcomp " - --color --no-color --verbose --abbrev= --no-abbrev - --track --no-track --contains --no-contains --merged --no-merged - --set-upstream-to= --edit-description --list - --unset-upstream --delete --move --copy --remotes - --column --no-column --sort= --points-at - " + __gitcomp_builtin branch ;; *) if [ $only_local_ref = "y" -a $has_r = "n" ]; then @@ -1247,11 +1346,7 @@ _git_checkout () __gitcomp "diff3 merge" "" "${cur##--conflict=}" ;; --*) - __gitcomp " - --quiet --ours --theirs --track --no-track --merge - --conflict= --orphan --patch --detach --ignore-skip-worktree-bits - --recurse-submodules --no-recurse-submodules - " + __gitcomp_builtin checkout ;; *) # check if --track, --no-track, or --no-guess was specified @@ -1266,21 +1361,22 @@ _git_checkout () esac } -_git_cherry () -{ - __git_complete_refs -} +__git_cherry_pick_inprogress_options="--continue --quit --abort" _git_cherry_pick () { __git_find_repo_path if [ -f "$__git_repo_path"/CHERRY_PICK_HEAD ]; then - __gitcomp "--continue --quit --abort" + __gitcomp "$__git_cherry_pick_inprogress_options" return fi + + __git_complete_strategy && return + case "$cur" in --*) - __gitcomp "--edit --no-commit --signoff --strategy= --mainline" + __gitcomp_builtin cherry-pick "" \ + "$__git_cherry_pick_inprogress_options" ;; *) __git_complete_refs @@ -1292,7 +1388,7 @@ _git_clean () { case "$cur" in --*) - __gitcomp "--dry-run --quiet" + __gitcomp_builtin clean return ;; esac @@ -1305,26 +1401,7 @@ _git_clone () { case "$cur" in --*) - __gitcomp " - --local - --no-hardlinks - --shared - --reference - --quiet - --no-checkout - --bare - --mirror - --origin - --upload-pack - --template= - --depth - --single-branch - --no-tags - --branch - --recurse-submodules - --no-single-branch - --shallow-submodules - " + __gitcomp_builtin clone return ;; esac @@ -1357,16 +1434,7 @@ _git_commit () return ;; --*) - __gitcomp " - --all --author= --signoff --verify --no-verify - --edit --no-edit - --amend --include --only --interactive - --dry-run --reuse-message= --reedit-message= - --reset-author --file= --message= --template= - --cleanup= --untracked-files --untracked-files= - --verbose --quiet --fixup= --squash= - --patch --short --date --allow-empty - " + __gitcomp_builtin commit return esac @@ -1382,11 +1450,7 @@ _git_describe () { case "$cur" in --*) - __gitcomp " - --all --tags --contains --abbrev= --candidates= - --exact-match --debug --long --match --always --first-parent - --exclude --dirty --broken - " + __gitcomp_builtin describe return esac __git_complete_refs @@ -1411,7 +1475,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --dirstat --dirstat= --dirstat-by-file --dirstat-by-file= --cumulative --diff-algorithm= - --submodule --submodule= + --submodule --submodule= --ignore-submodules " _git_diff () @@ -1439,7 +1503,8 @@ _git_diff () } __git_mergetools_common="diffuse diffmerge ecmerge emerge kdiff3 meld opendiff - tkdiff vimdiff gvimdiff xxdiff araxis p4merge bc codecompare + tkdiff vimdiff gvimdiff xxdiff araxis p4merge bc + codecompare smerge " _git_difftool () @@ -1452,11 +1517,11 @@ _git_difftool () return ;; --*) - __gitcomp "--cached --staged --pickaxe-all --pickaxe-regex - --base --ours --theirs - --no-renames --diff-filter= --find-copies-harder - --relative --ignore-submodules - --tool=" + __gitcomp_builtin difftool "$__git_diff_common_options + --base --cached --ours --theirs + --pickaxe-all --pickaxe-regex + --relative --staged + " return ;; esac @@ -1465,12 +1530,6 @@ _git_difftool () __git_fetch_recurse_submodules="yes on-demand no" -__git_fetch_options=" - --quiet --verbose --append --upload-pack --force --keep --depth= - --tags --no-tags --all --prune --dry-run --recurse-submodules= - --unshallow --update-shallow -" - _git_fetch () { case "$cur" in @@ -1478,21 +1537,21 @@ _git_fetch () __gitcomp "$__git_fetch_recurse_submodules" "" "${cur##--recurse-submodules=}" return ;; + --filter=*) + __gitcomp "blob:none blob:limit= sparse:oid=" "" "${cur##--filter=}" + return + ;; --*) - __gitcomp "$__git_fetch_options" + __gitcomp_builtin fetch return ;; esac __git_complete_remote_or_refspec } -__git_format_patch_options=" - --stdout --attach --no-attach --thread --thread= --no-thread - --numbered --start-number --numbered-files --keep-subject --signoff - --signature --no-signature --in-reply-to= --cc= --full-index --binary - --not --all --cover-letter --no-prefix --src-prefix= --dst-prefix= - --inline --suffix= --ignore-if-in-upstream --subject-prefix= - --output-directory --reroll-count --to= --quiet --notes +__git_format_patch_extra_options=" + --full-index --not --all --no-prefix --src-prefix= + --dst-prefix= --notes " _git_format_patch () @@ -1505,7 +1564,7 @@ _git_format_patch () return ;; --*) - __gitcomp "$__git_format_patch_options" + __gitcomp_builtin format-patch "$__git_format_patch_extra_options" return ;; esac @@ -1516,20 +1575,7 @@ _git_fsck () { case "$cur" in --*) - __gitcomp " - --tags --root --unreachable --cache --no-reflogs --full - --strict --verbose --lost-found --name-objects - " - return - ;; - esac -} - -_git_gc () -{ - case "$cur" in - --*) - __gitcomp "--prune --aggressive" + __gitcomp_builtin fsck return ;; esac @@ -1585,21 +1631,7 @@ _git_grep () case "$cur" in --*) - __gitcomp " - --cached - --text --ignore-case --word-regexp --invert-match - --full-name --line-number - --extended-regexp --basic-regexp --fixed-strings - --perl-regexp - --threads - --files-with-matches --name-only - --files-without-match - --max-depth - --count - --and --or --not --all-match - --break --heading --show-function --function-context - --untracked --no-index - " + __gitcomp_builtin grep return ;; esac @@ -1617,17 +1649,16 @@ _git_help () { case "$cur" in --*) - __gitcomp "--all --guides --info --man --web" + __gitcomp_builtin help return ;; esac - __git_compute_all_commands - __gitcomp "$__git_all_commands $(__git_aliases) - attributes cli core-tutorial cvs-migration - diffcore everyday gitk glossary hooks ignore modules - namespaces repository-layout revisions tutorial tutorial-2 - workflows - " + if test -n "$GIT_TESTING_ALL_COMMAND_LIST" + then + __gitcomp "$GIT_TESTING_ALL_COMMAND_LIST $(__git --list-cmds=alias,list-guide) gitk" + else + __gitcomp "$(__git --list-cmds=main,nohelpers,alias,list-guide) gitk" + fi } _git_init () @@ -1640,7 +1671,7 @@ _git_init () return ;; --*) - __gitcomp "--quiet --bare --template= --shared --shared=" + __gitcomp_builtin init return ;; esac @@ -1650,13 +1681,7 @@ _git_ls_files () { case "$cur" in --*) - __gitcomp "--cached --deleted --modified --others --ignored - --stage --directory --no-empty-directory --unmerged - --killed --exclude= --exclude-from= - --exclude-per-directory= --exclude-standard - --error-unmatch --with-tree= --full-name - --abbrev --ignored --exclude-per-directory - " + __gitcomp_builtin ls-files return ;; esac @@ -1670,7 +1695,7 @@ _git_ls_remote () { case "$cur" in --*) - __gitcomp "--heads --tags --refs --get-url --symref" + __gitcomp_builtin ls-remote return ;; esac @@ -1679,6 +1704,13 @@ _git_ls_remote () _git_ls_tree () { + case "$cur" in + --*) + __gitcomp_builtin ls-tree + return + ;; + esac + __git_complete_file } @@ -1705,8 +1737,8 @@ __git_log_shortlog_options=" --all-match --invert-grep " -__git_log_pretty_formats="oneline short medium full fuller email raw format:" -__git_log_date_formats="relative iso8601 rfc2822 short local default raw" +__git_log_pretty_formats="oneline short medium full fuller email raw format: mboxrd" +__git_log_date_formats="relative iso8601 iso8601-strict rfc2822 short local default raw unix format:" _git_log () { @@ -1794,22 +1826,13 @@ _git_log () __git_complete_revlist } -# Common merge options shared by git-merge(1) and git-pull(1). -__git_merge_options=" - --no-commit --no-stat --log --no-log --squash --strategy - --commit --stat --no-squash --ff --no-ff --ff-only --edit --no-edit - --verify-signatures --no-verify-signatures --gpg-sign - --quiet --verbose --progress --no-progress -" - _git_merge () { __git_complete_strategy && return case "$cur" in --*) - __gitcomp "$__git_merge_options - --rerere-autoupdate --no-rerere-autoupdate --abort --continue" + __gitcomp_builtin merge return esac __git_complete_refs @@ -1823,7 +1846,7 @@ _git_mergetool () return ;; --*) - __gitcomp "--tool= --prompt --no-prompt" + __gitcomp "--tool= --prompt --no-prompt --gui --no-gui" return ;; esac @@ -1833,7 +1856,7 @@ _git_merge_base () { case "$cur" in --*) - __gitcomp "--octopus --independent --is-ancestor --fork-point" + __gitcomp_builtin merge-base return ;; esac @@ -1844,7 +1867,7 @@ _git_mv () { case "$cur" in --*) - __gitcomp "--dry-run" + __gitcomp_builtin mv return ;; esac @@ -1858,19 +1881,14 @@ _git_mv () fi } -_git_name_rev () -{ - __gitcomp "--tags --all --stdin" -} - _git_notes () { - local subcommands='add append copy edit list prune remove show' + local subcommands='add append copy edit get-ref list merge prune remove show' local subcommand="$(__git_find_on_cmdline "$subcommands")" case "$subcommand,$cur" in ,--*) - __gitcomp '--ref' + __gitcomp_builtin notes ;; ,*) case "$prev" in @@ -1882,21 +1900,14 @@ _git_notes () ;; esac ;; - add,--reuse-message=*|append,--reuse-message=*|\ - add,--reedit-message=*|append,--reedit-message=*) + *,--reuse-message=*|*,--reedit-message=*) __git_complete_refs --cur="${cur#*=}" ;; - add,--*|append,--*) - __gitcomp '--file= --message= --reedit-message= - --reuse-message=' + *,--*) + __gitcomp_builtin notes_$subcommand ;; - copy,--*) - __gitcomp '--stdin' - ;; - prune,--*) - __gitcomp '--dry-run --verbose' - ;; - prune,*) + prune,*|get-ref,*) + # this command does not take a ref, do not complete it ;; *) case "$prev" in @@ -1920,12 +1931,8 @@ _git_pull () return ;; --*) - __gitcomp " - --rebase --no-rebase - --autostash --no-autostash - $__git_merge_options - $__git_fetch_options - " + __gitcomp_builtin pull + return ;; esac @@ -1976,27 +1983,36 @@ _git_push () return ;; --*) - __gitcomp " - --all --mirror --tags --dry-run --force --verbose - --quiet --prune --delete --follow-tags - --receive-pack= --repo= --set-upstream - --force-with-lease --force-with-lease= --recurse-submodules= - " + __gitcomp_builtin push return ;; esac __git_complete_remote_or_refspec } +_git_range_diff () +{ + case "$cur" in + --*) + __gitcomp " + --creation-factor= --no-dual-color + $__git_diff_common_options + " + return + ;; + esac + __git_complete_revlist +} + _git_rebase () { __git_find_repo_path if [ -f "$__git_repo_path"/rebase-merge/interactive ]; then - __gitcomp "--continue --skip --abort --quit --edit-todo" + __gitcomp "--continue --skip --abort --quit --edit-todo --show-current-patch" return elif [ -d "$__git_repo_path"/rebase-apply ] || \ [ -d "$__git_repo_path"/rebase-merge ]; then - __gitcomp "--continue --skip --abort --quit" + __gitcomp "--continue --skip --abort --quit --show-current-patch" return fi __git_complete_strategy && return @@ -2008,7 +2024,7 @@ _git_rebase () --*) __gitcomp " --onto --merge --strategy --interactive - --preserve-merges --stat --no-stat + --rebase-merges --preserve-merges --stat --no-stat --committer-date-is-author-date --ignore-date --ignore-whitespace --whitespace= --autosquash --no-autosquash @@ -2016,6 +2032,7 @@ _git_rebase () --autostash --no-autostash --verify --no-verify --keep-empty --root --force-rebase --no-ff + --rerere-autoupdate --exec " @@ -2077,16 +2094,16 @@ _git_send_email () return ;; --*) - __gitcomp "--annotate --bcc --cc --cc-cmd --chain-reply-to + __gitcomp_builtin send-email "--annotate --bcc --cc --cc-cmd --chain-reply-to --compose --confirm= --dry-run --envelope-sender --from --identity --in-reply-to --no-chain-reply-to --no-signed-off-by-cc - --no-suppress-from --no-thread --quiet + --no-suppress-from --no-thread --quiet --reply-to --signed-off-by-cc --smtp-pass --smtp-server --smtp-server-port --smtp-encryption= --smtp-user --subject --suppress-cc= --suppress-from --thread --to --validate --no-validate - $__git_format_patch_options" + $__git_format_patch_extra_options" return ;; esac @@ -2119,11 +2136,7 @@ _git_status () return ;; --*) - __gitcomp " - --short --branch --porcelain --long --verbose - --untracked-files= --ignore-submodules= --ignored - --column= --no-column - " + __gitcomp_builtin status return ;; esac @@ -2148,6 +2161,44 @@ _git_status () __git_complete_index_file "$complete_opt" } +_git_switch () +{ + case "$cur" in + --conflict=*) + __gitcomp "diff3 merge" "" "${cur##--conflict=}" + ;; + --*) + __gitcomp_builtin switch + ;; + *) + # check if --track, --no-track, or --no-guess was specified + # if so, disable DWIM mode + local track_opt="--track" only_local_ref=n + if [ "$GIT_COMPLETION_CHECKOUT_NO_GUESS" = "1" ] || + [ -n "$(__git_find_on_cmdline "--track --no-track --no-guess")" ]; then + track_opt='' + fi + # explicit --guess enables DWIM mode regardless of + # $GIT_COMPLETION_CHECKOUT_NO_GUESS + if [ -n "$(__git_find_on_cmdline "--guess")" ]; then + track_opt='--track' + fi + if [ -z "$(__git_find_on_cmdline "-d --detach")" ]; then + only_local_ref=y + else + # --guess --detach is invalid combination, no + # dwim will be done when --detach is specified + track_opt= + fi + if [ $only_local_ref = y -a -z "$track_opt" ]; then + __gitcomp_direct "$(__git_heads "" "$cur" " ")" + else + __git_complete_refs $track_opt + fi + ;; + esac +} + __git_config_get_set_variables () { local prevword word config_file= c=$cword @@ -2170,9 +2221,24 @@ __git_config_get_set_variables () __git config $config_file --name-only --list } +__git_config_vars= +__git_compute_config_vars () +{ + test -n "$__git_config_vars" || + __git_config_vars="$(git help --config-for-completion | sort | uniq)" +} + _git_config () { - case "$prev" in + local varname + + if [ "${BASH_VERSINFO[0]:-0}" -ge 4 ]; then + varname="${prev,,}" + else + varname="$(echo "$prev" |tr A-Z a-z)" + fi + + case "$varname" in branch.*.remote|branch.*.pushremote) __gitcomp_nl "$(__git_remotes)" return @@ -2182,7 +2248,7 @@ _git_config () return ;; branch.*.rebase) - __gitcomp "false true preserve interactive" + __gitcomp "false true merges preserve interactive" return ;; remote.pushdefault) @@ -2228,7 +2294,7 @@ _git_config () return ;; diff.submodule) - __gitcomp "log short" + __gitcomp "$__git_diff_submodule_formats" return ;; help.format) @@ -2239,7 +2305,7 @@ _git_config () __gitcomp "$__git_log_date_formats" return ;; - sendemail.aliasesfiletype) + sendemail.aliasfiletype) __gitcomp "mutt mailrc pine elm gnus" return ;; @@ -2265,32 +2331,25 @@ _git_config () esac case "$cur" in --*) - __gitcomp " - --system --global --local --file= - --list --replace-all - --get --get-all --get-regexp - --add --unset --unset-all - --remove-section --rename-section - --name-only - " + __gitcomp_builtin config return ;; branch.*.*) local pfx="${cur%.*}." cur_="${cur##*.}" - __gitcomp "remote pushremote merge mergeoptions rebase" "$pfx" "$cur_" + __gitcomp "remote pushRemote merge mergeOptions rebase" "$pfx" "$cur_" return ;; branch.*) local pfx="${cur%.*}." cur_="${cur#*.}" __gitcomp_direct "$(__git_heads "$pfx" "$cur_" ".")" - __gitcomp_nl_append $'autosetupmerge\nautosetuprebase\n' "$pfx" "$cur_" + __gitcomp_nl_append $'autoSetupMerge\nautoSetupRebase\n' "$pfx" "$cur_" return ;; guitool.*.*) local pfx="${cur%.*}." cur_="${cur##*.}" __gitcomp " - argprompt cmd confirm needsfile noconsole norescan - prompt revprompt revunmerged title + argPrompt cmd confirm needsFile noConsole noRescan + prompt revPrompt revUnmerged title " "$pfx" "$cur_" return ;; @@ -2319,14 +2378,14 @@ _git_config () local pfx="${cur%.*}." cur_="${cur##*.}" __gitcomp " url proxy fetch push mirror skipDefaultUpdate - receivepack uploadpack tagopt pushurl + receivepack uploadpack tagOpt pushurl " "$pfx" "$cur_" return ;; remote.*) local pfx="${cur%.*}." cur_="${cur#*.}" __gitcomp_nl "$(__git_remotes)" "$pfx" "$cur_" "." - __gitcomp_nl_append "pushdefault" "$pfx" "$cur_" + __gitcomp_nl_append "pushDefault" "$pfx" "$cur_" return ;; url.*.*) @@ -2334,332 +2393,14 @@ _git_config () __gitcomp "insteadOf pushInsteadOf" "$pfx" "$cur_" return ;; + *.*) + __git_compute_config_vars + __gitcomp "$__git_config_vars" + ;; + *) + __git_compute_config_vars + __gitcomp "$(echo "$__git_config_vars" | sed 's/\.[^ ]*/./g')" esac - __gitcomp " - add.ignoreErrors - advice.amWorkDir - advice.commitBeforeMerge - advice.detachedHead - advice.implicitIdentity - advice.pushAlreadyExists - advice.pushFetchFirst - advice.pushNeedsForce - advice.pushNonFFCurrent - advice.pushNonFFMatching - advice.pushUpdateRejected - advice.resolveConflict - advice.rmHints - advice.statusHints - advice.statusUoption - advice.ignoredHook - alias. - am.keepcr - am.threeWay - apply.ignorewhitespace - apply.whitespace - branch.autosetupmerge - branch.autosetuprebase - browser. - clean.requireForce - color.branch - color.branch.current - color.branch.local - color.branch.plain - color.branch.remote - color.decorate.HEAD - color.decorate.branch - color.decorate.remoteBranch - color.decorate.stash - color.decorate.tag - color.diff - color.diff.commit - color.diff.frag - color.diff.func - color.diff.meta - color.diff.new - color.diff.old - color.diff.plain - color.diff.whitespace - color.grep - color.grep.context - color.grep.filename - color.grep.function - color.grep.linenumber - color.grep.match - color.grep.selected - color.grep.separator - color.interactive - color.interactive.error - color.interactive.header - color.interactive.help - color.interactive.prompt - color.pager - color.showbranch - color.status - color.status.added - color.status.changed - color.status.header - color.status.localBranch - color.status.nobranch - color.status.remoteBranch - color.status.unmerged - color.status.untracked - color.status.updated - color.ui - commit.cleanup - commit.gpgSign - commit.status - commit.template - commit.verbose - core.abbrev - core.askpass - core.attributesfile - core.autocrlf - core.bare - core.bigFileThreshold - core.checkStat - core.commentChar - core.compression - core.createObject - core.deltaBaseCacheLimit - core.editor - core.eol - core.excludesfile - core.fileMode - core.fsyncobjectfiles - core.gitProxy - core.hideDotFiles - core.hooksPath - core.ignoreStat - core.ignorecase - core.logAllRefUpdates - core.loosecompression - core.notesRef - core.packedGitLimit - core.packedGitWindowSize - core.packedRefsTimeout - core.pager - core.precomposeUnicode - core.preferSymlinkRefs - core.preloadindex - core.protectHFS - core.protectNTFS - core.quotepath - core.repositoryFormatVersion - core.safecrlf - core.sharedRepository - core.sparseCheckout - core.splitIndex - core.sshCommand - core.symlinks - core.trustctime - core.untrackedCache - core.warnAmbiguousRefs - core.whitespace - core.worktree - credential.helper - credential.useHttpPath - credential.username - credentialCache.ignoreSIGHUP - diff.autorefreshindex - diff.external - diff.ignoreSubmodules - diff.mnemonicprefix - diff.noprefix - diff.renameLimit - diff.renames - diff.statGraphWidth - diff.submodule - diff.suppressBlankEmpty - diff.tool - diff.wordRegex - diff.algorithm - difftool. - difftool.prompt - fetch.recurseSubmodules - fetch.unpackLimit - format.attach - format.cc - format.coverLetter - format.from - format.headers - format.numbered - format.pretty - format.signature - format.signoff - format.subjectprefix - format.suffix - format.thread - format.to - gc. - gc.aggressiveDepth - gc.aggressiveWindow - gc.auto - gc.autoDetach - gc.autopacklimit - gc.logExpiry - gc.packrefs - gc.pruneexpire - gc.reflogexpire - gc.reflogexpireunreachable - gc.rerereresolved - gc.rerereunresolved - gc.worktreePruneExpire - gitcvs.allbinary - gitcvs.commitmsgannotation - gitcvs.dbTableNamePrefix - gitcvs.dbdriver - gitcvs.dbname - gitcvs.dbpass - gitcvs.dbuser - gitcvs.enabled - gitcvs.logfile - gitcvs.usecrlfattr - guitool. - gui.blamehistoryctx - gui.commitmsgwidth - gui.copyblamethreshold - gui.diffcontext - gui.encoding - gui.fastcopyblame - gui.matchtrackingbranch - gui.newbranchtemplate - gui.pruneduringfetch - gui.spellingdictionary - gui.trustmtime - help.autocorrect - help.browser - help.format - http.lowSpeedLimit - http.lowSpeedTime - http.maxRequests - http.minSessions - http.noEPSV - http.postBuffer - http.proxy - http.sslCipherList - http.sslVersion - http.sslCAInfo - http.sslCAPath - http.sslCert - http.sslCertPasswordProtected - http.sslKey - http.sslVerify - http.useragent - i18n.commitEncoding - i18n.logOutputEncoding - imap.authMethod - imap.folder - imap.host - imap.pass - imap.port - imap.preformattedHTML - imap.sslverify - imap.tunnel - imap.user - init.templatedir - instaweb.browser - instaweb.httpd - instaweb.local - instaweb.modulepath - instaweb.port - interactive.singlekey - log.date - log.decorate - log.showroot - mailmap.file - man. - man.viewer - merge. - merge.conflictstyle - merge.log - merge.renameLimit - merge.renormalize - merge.stat - merge.tool - merge.verbosity - mergetool. - mergetool.keepBackup - mergetool.keepTemporaries - mergetool.prompt - notes.displayRef - notes.rewrite. - notes.rewrite.amend - notes.rewrite.rebase - notes.rewriteMode - notes.rewriteRef - pack.compression - pack.deltaCacheLimit - pack.deltaCacheSize - pack.depth - pack.indexVersion - pack.packSizeLimit - pack.threads - pack.window - pack.windowMemory - pager. - pretty. - pull.octopus - pull.twohead - push.default - push.followTags - rebase.autosquash - rebase.stat - receive.autogc - receive.denyCurrentBranch - receive.denyDeleteCurrent - receive.denyDeletes - receive.denyNonFastForwards - receive.fsckObjects - receive.unpackLimit - receive.updateserverinfo - remote.pushdefault - remotes. - repack.usedeltabaseoffset - rerere.autoupdate - rerere.enabled - sendemail. - sendemail.aliasesfile - sendemail.aliasfiletype - sendemail.bcc - sendemail.cc - sendemail.cccmd - sendemail.chainreplyto - sendemail.confirm - sendemail.envelopesender - sendemail.from - sendemail.identity - sendemail.multiedit - sendemail.signedoffbycc - sendemail.smtpdomain - sendemail.smtpencryption - sendemail.smtppass - sendemail.smtpserver - sendemail.smtpserveroption - sendemail.smtpserverport - sendemail.smtpuser - sendemail.suppresscc - sendemail.suppressfrom - sendemail.thread - sendemail.to - sendemail.tocmd - sendemail.validate - sendemail.smtpbatchsize - sendemail.smtprelogindelay - showbranch.default - status.relativePaths - status.showUntrackedFiles - status.submodulesummary - submodule. - tar.umask - transfer.unpackLimit - url. - user.email - user.name - user.signingkey - web.browser - branch. remote. - " } _git_remote () @@ -2672,7 +2413,7 @@ _git_remote () if [ -z "$subcommand" ]; then case "$cur" in --*) - __gitcomp "--verbose" + __gitcomp_builtin remote ;; *) __gitcomp "$subcommands" @@ -2683,33 +2424,33 @@ _git_remote () case "$subcommand,$cur" in add,--*) - __gitcomp "--track --master --fetch --tags --no-tags --mirror=" + __gitcomp_builtin remote_add ;; add,*) ;; set-head,--*) - __gitcomp "--auto --delete" + __gitcomp_builtin remote_set-head ;; set-branches,--*) - __gitcomp "--add" + __gitcomp_builtin remote_set-branches ;; set-head,*|set-branches,*) __git_complete_remote_or_refspec ;; update,--*) - __gitcomp "--prune" + __gitcomp_builtin remote_update ;; update,*) - __gitcomp "$(__git_get_config_variables "remotes")" + __gitcomp "$(__git_remotes) $(__git_get_config_variables "remotes")" ;; set-url,--*) - __gitcomp "--push --add --delete" + __gitcomp_builtin remote_set-url ;; get-url,--*) - __gitcomp "--push --all" + __gitcomp_builtin remote_get-url ;; prune,--*) - __gitcomp "--dry-run" + __gitcomp_builtin remote_prune ;; *) __gitcomp_nl "$(__git_remotes)" @@ -2720,8 +2461,12 @@ _git_remote () _git_replace () { case "$cur" in + --format=*) + __gitcomp "short medium long" "" "${cur##--format=}" + return + ;; --*) - __gitcomp "--edit --graft --format= --list --delete" + __gitcomp_builtin replace return ;; esac @@ -2745,26 +2490,42 @@ _git_reset () case "$cur" in --*) - __gitcomp "--merge --mixed --hard --soft --patch --keep" + __gitcomp_builtin reset return ;; esac __git_complete_refs } +_git_restore () +{ + case "$cur" in + --conflict=*) + __gitcomp "diff3 merge" "" "${cur##--conflict=}" + ;; + --source=*) + __git_complete_refs --cur="${cur##--source=}" + ;; + --*) + __gitcomp_builtin restore + ;; + esac +} + +__git_revert_inprogress_options="--continue --quit --abort" + _git_revert () { __git_find_repo_path if [ -f "$__git_repo_path"/REVERT_HEAD ]; then - __gitcomp "--continue --quit --abort" + __gitcomp "$__git_revert_inprogress_options" return fi + __git_complete_strategy && return case "$cur" in --*) - __gitcomp " - --edit --mainline --no-edit --no-commit --signoff - --strategy= --strategy-option= - " + __gitcomp_builtin revert "" \ + "$__git_revert_inprogress_options" return ;; esac @@ -2775,7 +2536,7 @@ _git_rm () { case "$cur" in --*) - __gitcomp "--cached --dry-run --ignore-unmatch --quiet" + __gitcomp_builtin rm return ;; esac @@ -2833,12 +2594,7 @@ _git_show_branch () { case "$cur" in --*) - __gitcomp " - --all --remotes --topo-order --date-order --current --more= - --list --independent --merge-base --no-name - --color --no-color - --sha1-name --sparse --topics --reflog - " + __gitcomp_builtin show-branch return ;; esac @@ -2848,13 +2604,21 @@ _git_show_branch () _git_stash () { local save_opts='--all --keep-index --no-keep-index --quiet --patch --include-untracked' - local subcommands='push save list show apply clear drop pop create branch' - local subcommand="$(__git_find_on_cmdline "$subcommands")" + local subcommands='push list show apply clear drop pop create branch' + local subcommand="$(__git_find_on_cmdline "$subcommands save")" + if [ -n "$(__git_find_on_cmdline "-p")" ]; then + subcommand="push" + fi if [ -z "$subcommand" ]; then case "$cur" in --*) __gitcomp "$save_opts" ;; + sa*) + if [ -z "$(__git_find_on_cmdline "$save_opts")" ]; then + __gitcomp "save" + fi + ;; *) if [ -z "$(__git_find_on_cmdline "$save_opts")" ]; then __gitcomp "$subcommands" @@ -2875,6 +2639,9 @@ _git_stash () drop,--*) __gitcomp "--quiet" ;; + list,--*) + __gitcomp "--name-status --oneline --patch-with-stat" + ;; show,--*|branch,--*) ;; branch,*) @@ -2899,7 +2666,7 @@ _git_submodule () { __git_has_doubledash && return - local subcommands="add status init deinit update summary foreach sync" + local subcommands="add status init deinit update set-branch summary foreach sync absorbgitdirs" local subcommand="$(__git_find_on_cmdline "$subcommands")" if [ -z "$subcommand" ]; then case "$cur" in @@ -2930,6 +2697,9 @@ _git_submodule () --force --rebase --merge --reference --depth --recursive --jobs " ;; + set-branch,--*) + __gitcomp "--default --branch" + ;; summary,--*) __gitcomp "--cached --files --summary-limit" ;; @@ -3045,7 +2815,7 @@ _git_tag () while [ $c -lt $cword ]; do i="${words[c]}" case "$i" in - -d|-v) + -d|--delete|-v|--verify) __gitcomp_direct "$(__git_tags "" "$cur" " ")" return ;; @@ -3071,11 +2841,7 @@ _git_tag () case "$cur" in --*) - __gitcomp " - --list --delete --verify --annotate --message --file - --sign --cleanup --local-user --force --column --sort= - --contains --no-contains --points-at --merged --no-merged --create-reflog - " + __gitcomp_builtin tag ;; esac } @@ -3087,23 +2853,26 @@ _git_whatchanged () _git_worktree () { - local subcommands="add list lock prune unlock" + local subcommands="add list lock move prune remove unlock" local subcommand="$(__git_find_on_cmdline "$subcommands")" if [ -z "$subcommand" ]; then __gitcomp "$subcommands" else case "$subcommand,$cur" in add,--*) - __gitcomp "--detach" + __gitcomp_builtin worktree_add ;; list,--*) - __gitcomp "--porcelain" + __gitcomp_builtin worktree_list ;; lock,--*) - __gitcomp "--reason" + __gitcomp_builtin worktree_lock ;; prune,--*) - __gitcomp "--dry-run --expire --verbose" + __gitcomp_builtin worktree_prune + ;; + remove,--*) + __gitcomp "--force" ;; *) ;; @@ -3111,6 +2880,52 @@ _git_worktree () fi } +__git_complete_common () { + local command="$1" + + case "$cur" in + --*) + __gitcomp_builtin "$command" + ;; + esac +} + +__git_cmds_with_parseopt_helper= +__git_support_parseopt_helper () { + test -n "$__git_cmds_with_parseopt_helper" || + __git_cmds_with_parseopt_helper="$(__git --list-cmds=parseopt)" + + case " $__git_cmds_with_parseopt_helper " in + *" $1 "*) + return 0 + ;; + *) + return 1 + ;; + esac +} + +__git_complete_command () { + local command="$1" + local completion_func="_git_${command//-/_}" + if ! declare -f $completion_func >/dev/null 2>/dev/null && + declare -f _completion_loader >/dev/null 2>/dev/null + then + _completion_loader "git-$command" + fi + if declare -f $completion_func >/dev/null 2>/dev/null + then + $completion_func + return 0 + elif __git_support_parseopt_helper "$command" + then + __git_complete_common "$command" + return 0 + else + return 1 + fi +} + __git_main () { local i c=1 command __git_dir __git_repo_path @@ -3164,20 +2979,24 @@ __git_main () --help " ;; - *) __git_compute_porcelain_commands - __gitcomp "$__git_porcelain_commands $(__git_aliases)" ;; + *) + if test -n "$GIT_TESTING_PORCELAIN_COMMAND_LIST" + then + __gitcomp "$GIT_TESTING_PORCELAIN_COMMAND_LIST" + else + __gitcomp "$(__git --list-cmds=list-mainporcelain,others,nohelpers,alias,list-complete,config)" + fi + ;; esac return fi - local completion_func="_git_${command//-/_}" - declare -f $completion_func >/dev/null 2>/dev/null && $completion_func && return + __git_complete_command "$command" && return local expansion=$(__git_aliased_command "$command") if [ -n "$expansion" ]; then words[1]=$expansion - completion_func="_git_${expansion//-/_}" - declare -f $completion_func >/dev/null 2>/dev/null && $completion_func + __git_complete_command "$expansion" fi } @@ -3205,7 +3024,10 @@ __gitk_main () __git_complete_revlist } -if [[ -n ${ZSH_VERSION-} ]]; then +if [[ -n ${ZSH_VERSION-} ]] && + # Don't define these functions when sourced from 'git-completion.zsh', + # it has its own implementations. + [[ -z ${GIT_SOURCING_ZSH_COMPLETION-} ]]; then echo "WARNING: this script is deprecated, please see git-completion.zsh" 1>&2 autoload -U +X compinit && compinit @@ -3254,13 +3076,22 @@ if [[ -n ${ZSH_VERSION-} ]]; then compadd -Q -S "${4- }" -p "${2-}" -- ${=1} && _ret=0 } + __gitcomp_file_direct () + { + emulate -L zsh + + local IFS=$'\n' + compset -P '*[=:]' + compadd -f -- ${=1} && _ret=0 + } + __gitcomp_file () { emulate -L zsh local IFS=$'\n' compset -P '*[=:]' - compadd -Q -p "${2-}" -f -- ${=1} && _ret=0 + compadd -p "${2-}" -f -- ${=1} && _ret=0 } _git () @@ -3315,6 +3146,6 @@ __git_complete gitk __gitk_main # when the user has tab-completed the executable name and consequently # included the '.exe' suffix. # -if [[ "$OSTYPE" = cygwin* ]]; then +if [ Cygwin = "$(uname -o 2>/dev/null)" ]; then __git_complete git.exe __git_main fi From 4fb50b3333ce8685ce3b6570ef5e075ce2633b6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sun, 8 Sep 2019 20:28:59 +0200 Subject: [PATCH 045/302] Unquote yes in conditional expressions for style consistency --- plugins/gitfast/git-prompt.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/gitfast/git-prompt.sh b/plugins/gitfast/git-prompt.sh index 3e86e9cca..f7009b063 100644 --- a/plugins/gitfast/git-prompt.sh +++ b/plugins/gitfast/git-prompt.sh @@ -219,7 +219,7 @@ __git_ps1_show_upstream () if [[ -n "$count" && -n "$name" ]]; then __git_ps1_upstream_name=$(git rev-parse \ --abbrev-ref "$upstream" 2>/dev/null) - if [ "$pcmode" = "yes" ] && [ "$ps1_expanded" = "yes" ]; then + if [ "$pcmode" = yes ] && [ "$ps1_expanded" = yes ]; then p="$p \${__git_ps1_upstream_name}" else p="$p ${__git_ps1_upstream_name}" @@ -508,13 +508,13 @@ __git_ps1 () # NO color option unless in PROMPT_COMMAND mode or it's Zsh if [ -n "${GIT_PS1_SHOWCOLORHINTS-}" ]; then - if [ "$pcmode" = "yes" ] || [ -n "${ZSH_VERSION-}" ]; then + if [ "$pcmode" = yes ] || [ -n "${ZSH_VERSION-}" ]; then __git_ps1_colorize_gitstring fi fi b=${b##refs/heads/} - if [ "$pcmode" = "yes" ] && [ "$ps1_expanded" = "yes" ]; then + if [ "$pcmode" = yes ] && [ "$ps1_expanded" = yes ]; then __git_ps1_branch_name=$b b="\${__git_ps1_branch_name}" fi @@ -522,8 +522,8 @@ __git_ps1 () local f="$w$i$s$u" local gitstring="$c$b${f:+$z$f}$r$p" - if [ "$pcmode" = "yes" ]; then - if [ "${__git_printf_supports_v-}" != "yes" ]; then + if [ "$pcmode" = yes ]; then + if [ "${__git_printf_supports_v-}" != yes ]; then gitstring=$(printf -- "$printf_format" "$gitstring") else printf -v gitstring -- "$printf_format" "$gitstring" From fd4571d1b02ac68833a5b5c166395434723b9128 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sun, 8 Sep 2019 20:45:06 +0200 Subject: [PATCH 046/302] installer: allow chsh to work in termux --- tools/install.sh | 42 +++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/tools/install.sh b/tools/install.sh index 17b70bfea..61010214e 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -165,29 +165,37 @@ setup_shell() { *) echo "Invalid choice. Shell change skipped."; return ;; esac - # Test for the right location of the "shells" file - if [ -f /etc/shells ]; then - shells_file=/etc/shells - elif [ -f /usr/share/defaults/etc/shells ]; then # Solus OS - shells_file=/usr/share/defaults/etc/shells - else - error "could not find /etc/shells file. Change your default shell manually." - return - fi + # Check if we're running on Termux + case "$PREFIX" in + *com.termux*) termux=true; zsh=zsh ;; + *) termux=false ;; + esac - # Get the path to the right zsh binary - # 1. Use the most preceding one based on $PATH, then check that it's in the shells file - # 2. If that fails, get a zsh path from the shells file, then check it actually exists - if ! zsh=$(which zsh) || ! grep -qx "$zsh" "$shells_file"; then - if ! zsh=$(grep '^/.*/zsh$' "$shells_file" | tail -1) || [ ! -f "$zsh" ]; then - error "no zsh binary found or not present in '$shells_file'" - error "change your default shell manually." + if [ "$termux" != true ]; then + # Test for the right location of the "shells" file + if [ -f /etc/shells ]; then + shells_file=/etc/shells + elif [ -f /usr/share/defaults/etc/shells ]; then # Solus OS + shells_file=/usr/share/defaults/etc/shells + else + error "could not find /etc/shells file. Change your default shell manually." return fi + + # Get the path to the right zsh binary + # 1. Use the most preceding one based on $PATH, then check that it's in the shells file + # 2. If that fails, get a zsh path from the shells file, then check it actually exists + if ! zsh=$(which zsh) || ! grep -qx "$zsh" "$shells_file"; then + if ! zsh=$(grep '^/.*/zsh$' "$shells_file" | tail -1) || [ ! -f "$zsh" ]; then + error "no zsh binary found or not present in '$shells_file'" + error "change your default shell manually." + return + fi + fi fi # We're going to change the default shell, so back up the current one - if [ -n $SHELL ]; then + if [ -n "$SHELL" ]; then echo $SHELL > ~/.shell.pre-oh-my-zsh else grep "^$USER:" /etc/passwd | awk -F: '{print $7}' > ~/.shell.pre-oh-my-zsh From ddd359dd668f448856438304bedfe952d1749efd Mon Sep 17 00:00:00 2001 From: Jonas Date: Wed, 11 Sep 2019 15:54:56 +0200 Subject: [PATCH 047/302] kube-ps1: add a note where to put the `PROMPT=...` line (#8142) --- plugins/kube-ps1/README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/kube-ps1/README.md b/plugins/kube-ps1/README.md index 19dac42e9..82c0a77e6 100644 --- a/plugins/kube-ps1/README.md +++ b/plugins/kube-ps1/README.md @@ -53,10 +53,11 @@ plugins=( kube-ps1 ) +# After the "source Oh My Zsh" line PROMPT=$PROMPT'$(kube_ps1) ' ``` -Note: the `PROMPT` example above was tested with the theme `robbyrussell` +Note: The `PROMPT` example above was tested with the theme `robbyrussell`. ## Enabling / Disabling on the current shell @@ -100,4 +101,4 @@ The default settings can be overridden in ~/.zshrc ## Contributors - Jared Yanovich -- Pedro Moranga \ No newline at end of file +- Pedro Moranga From 093b56a7d769d15bdcc2c5300bc4ebedc9d0a837 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Fri, 13 Sep 2019 11:20:20 +0200 Subject: [PATCH 048/302] git: fix gtl alias argument Fixes the error `no matches found` because the argument is not quoted. See https://github.com/robbyrussell/oh-my-zsh/pull/7629#issuecomment-531151821 --- plugins/git/git.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 2edee0298..d8c4cffd1 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -243,7 +243,7 @@ alias gswc='git switch -c' alias gts='git tag -s' alias gtv='git tag | sort -V' -alias gtl='gtl(){ git tag --sort=-v:refname -n -l ${1}* }; noglob gtl' +alias gtl='gtl(){ git tag --sort=-v:refname -n -l "${1}*" }; noglob gtl' alias gunignore='git update-index --no-assume-unchanged' alias gunwip='git log -n 1 | grep -q -c "\-\-wip\-\-" && git reset HEAD~1' From 576e0992cac8a0cc4f824e20c0d60188578dd158 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Fri, 13 Sep 2019 11:41:13 +0200 Subject: [PATCH 049/302] z: update to latest version (e77e938) Closes #8145 Co-authored-by: GHPS --- plugins/z/z.sh | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/plugins/z/z.sh b/plugins/z/z.sh index 5fe6d5266..5c5771d62 100644 --- a/plugins/z/z.sh +++ b/plugins/z/z.sh @@ -89,7 +89,7 @@ _z() { if [ $? -ne 0 -a -f "$datafile" ]; then env rm -f "$tempfile" else - [ "$_Z_OWNER" ] && chown $_Z_OWNER:$(id -ng $_Z_OWNER) "$tempfile" + [ "$_Z_OWNER" ] && chown $_Z_OWNER:"$(id -ng $_Z_OWNER)" "$tempfile" env mv -f "$tempfile" "$datafile" || env rm -f "$tempfile" fi @@ -110,20 +110,21 @@ _z() { else # list/go + local echo fnd last list opt typ while [ "$1" ]; do case "$1" in - --) while [ "$1" ]; do shift; local fnd="$fnd${fnd:+ }$1";done;; - -*) local opt=${1:1}; while [ "$opt" ]; do case ${opt:0:1} in - c) local fnd="^$PWD $fnd";; - e) local echo=1;; + --) while [ "$1" ]; do shift; fnd="$fnd${fnd:+ }$1";done;; + -*) opt=${1:1}; while [ "$opt" ]; do case ${opt:0:1} in + c) fnd="^$PWD $fnd";; + e) echo=1;; h) echo "${_Z_CMD:-z} [-cehlrtx] args" >&2; return;; - l) local list=1;; - r) local typ="rank";; - t) local typ="recent";; + l) list=1;; + r) typ="rank";; + t) typ="recent";; x) sed -i -e "\:^${PWD}|.*:d" "$datafile";; esac; opt=${opt:1}; done;; - *) local fnd="$fnd${fnd:+ }$1";; - esac; local last=$1; [ "$#" -gt 0 ] && shift; done - [ "$fnd" -a "$fnd" != "^$PWD " ] || local list=1 + *) fnd="$fnd${fnd:+ }$1";; + esac; last=$1; [ "$#" -gt 0 ] && shift; done + [ "$fnd" -a "$fnd" != "^$PWD " ] || list=1 # if we hit enter on a completion just go there case "$last" in @@ -147,7 +148,7 @@ _z() { function output(matches, best_match, common) { # list or return the desired directory if( list ) { - cmd = "sort -n >&2" + cmd = "sort -g >&2" for( x in matches ) { if( matches[x] ) { printf "%-10s %s\n", matches[x], x | cmd From 32338fd40cae45c775dadc34ae05476811a3834b Mon Sep 17 00:00:00 2001 From: nv035674 <37336037+nv035674@users.noreply.github.com> Date: Fri, 13 Sep 2019 16:30:17 -0500 Subject: [PATCH 050/302] robbyrussell: restore prompt spacing (#8148) --- themes/robbyrussell.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/robbyrussell.zsh-theme b/themes/robbyrussell.zsh-theme index 4df8433e3..2fd5f2cdc 100644 --- a/themes/robbyrussell.zsh-theme +++ b/themes/robbyrussell.zsh-theme @@ -1,4 +1,4 @@ -PROMPT="%(?:%{$fg_bold[green]%}➜:%{$fg_bold[red]%}➜)" +PROMPT="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )" PROMPT+=' %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)' ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}" From 095d56b5ea44988c83d0be501e70f37df3d5066b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 19 Sep 2019 16:20:02 +0200 Subject: [PATCH 051/302] Fix WSL check for WSL 2 and simplify nohup in open_command WSL 2 changes the output of `uname -r`. For instance, WSL 1: 4.4.0-18980-Microsoft WSL 2: 4.19.67-microsoft-standard Since WSL 2 lowercases the M, we can match for the rest of the string which remains lowercase throughout both versions. Another option would be to match for both upper- and lower-case Ms, like that: $(uname -r) = *[Mm]icrosoft* Fixed use of nohup in open_command where it was only necessary for xdg-open (and actually harmful for cmd.exe in WSL 2). The current logic is simpler and more future-proof. --- lib/functions.zsh | 9 ++------- plugins/sublime/sublime.plugin.zsh | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/lib/functions.zsh b/lib/functions.zsh index 9f8736bd7..61dfa4780 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -21,7 +21,7 @@ function open_command() { case "$OSTYPE" in darwin*) open_cmd='open' ;; cygwin*) open_cmd='cygstart' ;; - linux*) ! [[ $(uname -a) =~ "Microsoft" ]] && open_cmd='xdg-open' || { + linux*) [[ "$(uname -r)" != *icrosoft* ]] && open_cmd='nohup xdg-open' || { open_cmd='cmd.exe /c start ""' [[ -e "$1" ]] && { 1="$(wslpath -w "${1:a}")" || return 1 } } ;; @@ -31,12 +31,7 @@ function open_command() { ;; esac - # don't use nohup on OSX - if [[ "$OSTYPE" == darwin* ]]; then - ${=open_cmd} "$@" &>/dev/null - else - nohup ${=open_cmd} "$@" &>/dev/null - fi + ${=open_cmd} "$@" &>/dev/null } # diff --git a/plugins/sublime/sublime.plugin.zsh b/plugins/sublime/sublime.plugin.zsh index 3a82d6c7f..69604ab4f 100644 --- a/plugins/sublime/sublime.plugin.zsh +++ b/plugins/sublime/sublime.plugin.zsh @@ -15,7 +15,7 @@ alias stn=create_project declare -a _sublime_paths if [[ "$OSTYPE" == linux* ]]; then - if [[ "$(uname -r)" = *Microsoft* ]]; then + if [[ "$(uname -r)" = *icrosoft* ]]; then _sublime_paths=( "$(wslpath -u 'C:\Program Files\Sublime Text 3\subl.exe')" "$(wslpath -u 'C:\Program Files\Sublime Text 2\subl.exe')" From 6cfaa076272e08b6a81b6358b78d020e48f8a4a6 Mon Sep 17 00:00:00 2001 From: Ian Chesal Date: Fri, 20 Sep 2019 04:58:35 -0700 Subject: [PATCH 052/302] Add gcloud plugin (#8144) * A gcloud plugin This PR addresses issue #6205 This adds support for loading completion for the Google Cloud SDK command line tools. It searches the known paths for an SDK and loads the provided completion if it is found. Users can supply a custom location for the SDK by setting `CLOUDSDK_HOME` in their `zshrc` before loading oh-my-zsh plugins. * Canoncial zsh and some safe guards Based on a PR review from mcornella. All off this has now been tested on the following variants: - macOS 10.14.6 - Homebrew - macOS 10.14.6 - Custom install - Ubuntu 16.04.6 LTS - apt install - Ubuntu 18.04.3 LTS - apt install - Ubuntu 18.04.3 LTS - snap classic install - CentOS 7 - yum install --- plugins/gcloud/README.md | 24 ++++++++++++++++++++++++ plugins/gcloud/gcloud.plugin.zsh | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 plugins/gcloud/README.md create mode 100644 plugins/gcloud/gcloud.plugin.zsh diff --git a/plugins/gcloud/README.md b/plugins/gcloud/README.md new file mode 100644 index 000000000..e7ce0e0f1 --- /dev/null +++ b/plugins/gcloud/README.md @@ -0,0 +1,24 @@ +# gcloud + +This plugin provides completion support for the +[Google Cloud SDK CLI](https://cloud.google.com/sdk/gcloud/). + +To use it, add `gcloud` to the plugins array in your zshrc file. + +```zsh +plugins=(... gcloud) +``` + +It relies on you having installed the SDK using one of the supported options +listed [here](https://cloud.google.com/sdk/install). + +## Plugin Options + +* Set `CLOUDSDK_HOME` in your `zshrc` file before you load oh-my-zsh if you have +your GCloud SDK installed in a non-standard location. The plugin will use this +as the base for your SDK if it finds it set already. + +* If you do not have a `python2` in your `PATH` you'll also need to set the +`CLOUDSDK_PYTHON` environment variable at the end of your `.zshrc`. This is +used by the SDK to call a compatible interpreter when you run one of the +SDK commands. diff --git a/plugins/gcloud/gcloud.plugin.zsh b/plugins/gcloud/gcloud.plugin.zsh new file mode 100644 index 000000000..6433a7252 --- /dev/null +++ b/plugins/gcloud/gcloud.plugin.zsh @@ -0,0 +1,32 @@ +##################################################### +# gcloud plugin for oh-my-zsh # +# Author: Ian Chesal (github.com/ianchesal) # +##################################################### + +if [[ -z "${CLOUDSDK_HOME}" ]]; then + search_locations=( + "$HOME/google-cloud-sdk" + "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk" + "/usr/share/google-cloud-sdk" + "/snap/google-cloud-sdk/current" + "/usr/lib64/google-cloud-sdk/" + ) + + for gcloud_sdk_location in $search_locations; do + if [[ -d "${gcloud_sdk_location}" ]]; then + CLOUDSDK_HOME="${gcloud_sdk_location}" + break + fi + done +fi + +if (( ${+CLOUDSDK_HOME} )); then + if (( ! $+commands[gcloud] )); then + # Only source this if GCloud isn't already on the path + if [[ -f "${CLOUDSDK_HOME}/path.zsh.inc" ]]; then + source "${CLOUDSDK_HOME}/path.zsh.inc" + fi + fi + source "${CLOUDSDK_HOME}/completion.zsh.inc" + export CLOUDSDK_HOME +fi From be9160ef90bd55bc4f19f94df548b728c64d87bf Mon Sep 17 00:00:00 2001 From: Franco Catena Date: Sat, 21 Sep 2019 18:11:25 -0300 Subject: [PATCH 053/302] gcloud: add search path for Arch Linux (#8164) --- plugins/gcloud/gcloud.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/gcloud/gcloud.plugin.zsh b/plugins/gcloud/gcloud.plugin.zsh index 6433a7252..c7aebe697 100644 --- a/plugins/gcloud/gcloud.plugin.zsh +++ b/plugins/gcloud/gcloud.plugin.zsh @@ -10,6 +10,7 @@ if [[ -z "${CLOUDSDK_HOME}" ]]; then "/usr/share/google-cloud-sdk" "/snap/google-cloud-sdk/current" "/usr/lib64/google-cloud-sdk/" + "/opt/google-cloud-sdk" ) for gcloud_sdk_location in $search_locations; do From f9e7c45a484723f693a77ab6128a1cc163f3704a Mon Sep 17 00:00:00 2001 From: Andrei Lesnitsky Date: Tue, 24 Sep 2019 15:46:38 +0300 Subject: [PATCH 054/302] Add flutter plugin (#8150) --- plugins/flutter/README.md | 21 +++++++++++++++++ plugins/flutter/_flutter | 37 ++++++++++++++++++++++++++++++ plugins/flutter/flutter.plugin.zsh | 7 ++++++ 3 files changed, 65 insertions(+) create mode 100644 plugins/flutter/README.md create mode 100644 plugins/flutter/_flutter create mode 100644 plugins/flutter/flutter.plugin.zsh diff --git a/plugins/flutter/README.md b/plugins/flutter/README.md new file mode 100644 index 000000000..be419144f --- /dev/null +++ b/plugins/flutter/README.md @@ -0,0 +1,21 @@ +## Flutter plugin + +The Flutter plugin provides completion and useful aliases + +To use it, add flutter to the plugins array of your zshrc file: + +``` +plugins=(... flutter) +``` + +## Aliases + +| Alias | Command | Description | +| :--------- | :--------------------- | :------------------------------------------------------------------------- | +| `fl` | `flutter` | Shorthand for flutter command | +| `flr` | `flutter run` | Runs flutter app | +| `fldoc` | `flutter doctor` | Runs flutter doctor | +| `flb` | `flutter build` | Build flutter application | +| `flattach` | `flutter attach` | Attaches flutter to a running flutter application with enabled observatory | +| `flget` | `flutter packages get` | Installs dependencies | +| `flc` | `flutter clean` | Cleans flutter porject | diff --git a/plugins/flutter/_flutter b/plugins/flutter/_flutter new file mode 100644 index 000000000..ab6ce4265 --- /dev/null +++ b/plugins/flutter/_flutter @@ -0,0 +1,37 @@ +#compdef flutter +#autoload + +local -a _1st_arguments +_1st_arguments=( + "analyze":"Analyze the project's Dart code." + "assemble":"Assemble and build flutter resources." + "attach":"Attach to a running application." + "build":"Flutter build commands." + "channel":"List or switch flutter channels." + "clean":"Delete the build/ and .dart_tool/ directories." + "config":"Configure Flutter settings." + "create":"Create a new Flutter project." + "devices":"List all connected devices." + "doctor":"Show information about the installed tooling." + "drive":"Runs Flutter Driver tests for the current project." + "emulators":"List, launch and create emulators." + "format":" Format one or more dart files." + "help":"Display help information for flutter." + "install":"Install a Flutter app on an attached device." + "logs":"Show log output for running Flutter apps." + "make-host-app-editable":"Moves host apps from generated directories to non-generated directories so that they can be edited by developers." + "precache":"Populates the Flutter tool's cache of binary artifacts." + "pub":"Commands for managing Flutter packages." + "run":"Run your Flutter app on an attached device." + "screenshot":"Take a screenshot from a connected device." + "test":"Run Flutter unit tests for the current project." + "upgrade":"Upgrade your copy of Flutter." + "version":"List or switch flutter versions." +) + +_arguments -C '*:: :->subcmds' + +if (( CURRENT == 1 )); then + _describe -t commands "flutter command" _1st_arguments + return +fi diff --git a/plugins/flutter/flutter.plugin.zsh b/plugins/flutter/flutter.plugin.zsh new file mode 100644 index 000000000..01c4c9f5f --- /dev/null +++ b/plugins/flutter/flutter.plugin.zsh @@ -0,0 +1,7 @@ +alias fl="flutter" +alias flr="flutter run" +alias fldoc="flutter doctor" +alias flb="flutter build" +alias flattach="flutter attach" +alias flget="flutter packages get" +alias flc="flutter clean" From ccee223aed6c280f207d02dd7e23f3a0d3cfcda1 Mon Sep 17 00:00:00 2001 From: KevinHu2014 Date: Wed, 25 Sep 2019 00:58:35 +0800 Subject: [PATCH 055/302] react-native: add aliases for newer iPhones Added aliases for iPhone 11, 11 Pro, 11 Pro Max --- plugins/react-native/react-native.plugin.zsh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/react-native/react-native.plugin.zsh b/plugins/react-native/react-native.plugin.zsh index f7695d15f..b33dedfed 100644 --- a/plugins/react-native/react-native.plugin.zsh +++ b/plugins/react-native/react-native.plugin.zsh @@ -24,6 +24,10 @@ alias rniosx='react-native run-ios --simulator "iPhone X"' alias rniosxs='react-native run-ios --simulator "iPhone Xs"' alias rniosxsm='react-native run-ios --simulator "iPhone Xs Max"' alias rniosxr='react-native run-ios --simulator "iPhone Xʀ"' +alias rnios11='react-native run-ios --simulator "iPhone 11"' +alias rnios11p='react-native run-ios --simulator "iPhone 11 Pro"' +alias rnios11pm='react-native run-ios --simulator "iPhone 11 Pro Max"' + # iPad alias rnipad2='react-native run-ios --simulator "iPad 2"' From 2004550a5890850505b29bda801dafdf3a94d0d7 Mon Sep 17 00:00:00 2001 From: Kevin Date: Wed, 25 Sep 2019 01:03:08 +0800 Subject: [PATCH 056/302] react-native: add aliases for newer iPhones to Doc Added aliases for iPhone 11, 11 Pro, 11 Pro Max to the Document. --- plugins/react-native/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/react-native/README.md b/plugins/react-native/README.md index dc0207184..a472ddb1c 100644 --- a/plugins/react-native/README.md +++ b/plugins/react-native/README.md @@ -39,6 +39,9 @@ plugins=(... react-native) | **rniosxs** | `react-native run-ios --simulator "iPhone Xs"` | | **rniosxsm** | `react-native run-ios --simulator "iPhone Xs Max"` | | **rniosxr** | `react-native run-ios --simulator "iPhone Xʀ"` | +| **rnios11** | `react-native run-ios --simulator "iPhone 11"` | +| **rnios11p** | `react-native run-ios --simulator "iPhone 11 Pro"` | +| **rnios11pm** | `react-native run-ios --simulator "iPhone 11 Pro Max"` | | _iPad_ | | | **rnipad2** | `react-native run-ios --simulator "iPad 2"` | | **rnipad5** | `react-native run-ios --simulator "iPad (5th generation)"` | From 487f0af412e9ef968175d290a606bd6c0717fc9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Mon, 30 Sep 2019 19:49:09 +0200 Subject: [PATCH 057/302] Fix table alignment --- plugins/react-native/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/react-native/README.md b/plugins/react-native/README.md index a472ddb1c..d0a53b8d7 100644 --- a/plugins/react-native/README.md +++ b/plugins/react-native/README.md @@ -40,8 +40,8 @@ plugins=(... react-native) | **rniosxsm** | `react-native run-ios --simulator "iPhone Xs Max"` | | **rniosxr** | `react-native run-ios --simulator "iPhone Xʀ"` | | **rnios11** | `react-native run-ios --simulator "iPhone 11"` | -| **rnios11p** | `react-native run-ios --simulator "iPhone 11 Pro"` | -| **rnios11pm** | `react-native run-ios --simulator "iPhone 11 Pro Max"` | +| **rnios11p** | `react-native run-ios --simulator "iPhone 11 Pro"` | +| **rnios11pm** | `react-native run-ios --simulator "iPhone 11 Pro Max"` | | _iPad_ | | | **rnipad2** | `react-native run-ios --simulator "iPad 2"` | | **rnipad5** | `react-native run-ios --simulator "iPad (5th generation)"` | From f763244e3b7f66bf2259c6e1bd16af08dd4b465e Mon Sep 17 00:00:00 2001 From: Rhuan Oliveira <43691332+lif3code@users.noreply.github.com> Date: Tue, 1 Oct 2019 07:56:41 -0300 Subject: [PATCH 058/302] autoenv: add README (#8184) --- plugins/autoenv/README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 plugins/autoenv/README.md diff --git a/plugins/autoenv/README.md b/plugins/autoenv/README.md new file mode 100644 index 000000000..de3881774 --- /dev/null +++ b/plugins/autoenv/README.md @@ -0,0 +1,14 @@ +# Autoenv plugin + +This plugin loads the [Autoenv](https://github.com/inishchith/autoenv). + +To use it, add `autoenv` to the plugins array in your zshrc file: + +```zsh +plugins=(... autoenv) +``` +## Requirements + +In order to make this work, you will need to have the autoenv installed. + +More info on the usage and install: https://github.com/inishchith/autoenv From 8bfeb3759c34a8e2e6a5795c3f40630a220e709b Mon Sep 17 00:00:00 2001 From: David Woodward Date: Tue, 1 Oct 2019 19:02:28 +0800 Subject: [PATCH 059/302] oc: add README (#8188) --- plugins/oc/README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 plugins/oc/README.md diff --git a/plugins/oc/README.md b/plugins/oc/README.md new file mode 100644 index 000000000..deae9b2d0 --- /dev/null +++ b/plugins/oc/README.md @@ -0,0 +1,13 @@ +# OC - OpenShift CLI + +This plugin provides autocompletion for [OC](https://docs.openshift.com/container-platform/3.7/cli_reference/index.html) commands, building, managing and updating operations. + +To use it, add `oc` to the plugins array of your zshrc file: + +```bash +plugins=(... oc) +``` + +## Contributors + ++ [kevinkirkup](https://github.com/kevinkirkup) - Plugin Author From 51f0eaad61d5870d990386ad8479bcd6a86108b6 Mon Sep 17 00:00:00 2001 From: Sukin Kumar K Date: Tue, 1 Oct 2019 16:43:18 +0530 Subject: [PATCH 060/302] Add README for thor and pip plugins (#8185) --- plugins/pip/README.md | 19 +++++++++++++++++++ plugins/thor/README.md | 10 ++++++++++ 2 files changed, 29 insertions(+) create mode 100644 plugins/pip/README.md create mode 100644 plugins/thor/README.md diff --git a/plugins/pip/README.md b/plugins/pip/README.md new file mode 100644 index 000000000..f07b5c058 --- /dev/null +++ b/plugins/pip/README.md @@ -0,0 +1,19 @@ +# pip plugin + +This plugin adds completion for [pip](https://pip.pypa.io/en/latest/), +the Python package manager. + +To use it, add `pip` to the plugins array in your zshrc file: + +```zsh +plugins=(... pip) +``` + +## pip cache + +The pip plugin caches the names of available pip packages from the PyPI index. +To trigger the caching process, try to complete `pip install`, +or you can run `zsh-pip-cache-packages` directly. + +To reset the cache, run `zsh-pip-clear-cache` and it will be rebuilt next +the next time you autocomplete `pip install`. diff --git a/plugins/thor/README.md b/plugins/thor/README.md new file mode 100644 index 000000000..09c705d9a --- /dev/null +++ b/plugins/thor/README.md @@ -0,0 +1,10 @@ +# Thor plugin + +This plugin adds completion for [Thor](http://whatisthor.com/), +a ruby toolkit for building powerful command-line interfaces. + +To use it, add `thor` to the plugins array in your zshrc file: + +```zsh +plugins=(... thor) +``` From ec7ef7eed15ceca8dabb2dc9269d9fe2a48f9cee Mon Sep 17 00:00:00 2001 From: Zach Whitten Date: Tue, 1 Oct 2019 14:10:11 -0400 Subject: [PATCH 061/302] lein: add README (#8189) --- plugins/lein/README.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 plugins/lein/README.md diff --git a/plugins/lein/README.md b/plugins/lein/README.md new file mode 100644 index 000000000..0c4119663 --- /dev/null +++ b/plugins/lein/README.md @@ -0,0 +1,9 @@ +# Leiningen plugin + +This plugin adds completions for the [Leiningen](https://leiningen.org/) Clojure build tool. + +To use it, add `lein` to the plugins array in your zshrc file: + +```zsh +plugins=(... lein) +``` From a6d71ddadb5c9c1f0ded8ecce228dcde1a23ad05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 1 Oct 2019 21:11:18 +0200 Subject: [PATCH 062/302] Update README with up-to-date platform requirements Co-authored-by: Emil Engler Closes #8157 --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 78a5b56bd..2f23febf5 100644 --- a/README.md +++ b/README.md @@ -18,10 +18,8 @@ To learn more, visit [ohmyz.sh](https://ohmyz.sh) and follow [@ohmyzsh](https:// ### Prerequisites -__Disclaimer:__ _Oh My Zsh works best on macOS and Linux._ - -* Unix-like operating system (macOS or Linux) -* [Zsh](https://www.zsh.org) should be installed (v4.3.9 or more recent). If not pre-installed (`zsh --version` to confirm), check the following instruction here: [Installing ZSH](https://github.com/robbyrussell/oh-my-zsh/wiki/Installing-ZSH) +* 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) * `curl` or `wget` should be installed * `git` should be installed From b8cfa0c77a68cb64c113b1f4a05b0d67d1bd7448 Mon Sep 17 00:00:00 2001 From: Caleb Williams Date: Tue, 1 Oct 2019 14:11:59 -0500 Subject: [PATCH 063/302] Update README: include Yarn workspace shortcuts --- plugins/yarn/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/yarn/README.md b/plugins/yarn/README.md index 671a272d9..e426053de 100644 --- a/plugins/yarn/README.md +++ b/plugins/yarn/README.md @@ -37,3 +37,5 @@ plugins=(... yarn) | yuc | `yarn global upgrade && yarn cache clean` | Upgrade global packages and clean yarn's global cache | | yui | `yarn upgrade-interactive` | Prompt for which outdated packages to upgrade | | yup | `yarn upgrade` | Upgrade packages to their latest version | +| yw | `yarn workspace` | Run a command within a single workspace. | +| yws | `yarn workspaces` | Run a command within all defined workspaces. | From 77ad69e0805d722e673ae3f3c655788188ec1751 Mon Sep 17 00:00:00 2001 From: Zach Whitten Date: Tue, 1 Oct 2019 15:21:05 -0400 Subject: [PATCH 064/302] jruby: add README (#8190) --- plugins/jruby/README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 plugins/jruby/README.md diff --git a/plugins/jruby/README.md b/plugins/jruby/README.md new file mode 100644 index 000000000..821a46d5e --- /dev/null +++ b/plugins/jruby/README.md @@ -0,0 +1,21 @@ +# JRuby plugin + +This plugin adds aliases for [JRuby](https://www.jruby.org/). + +To use it, add `jruby` to the plugins array in your zshrc file: + +```zsh +plugins=(... jruby) +``` + +## Requirements + +This plugin assumes you already have jruby installed and available in your [path](https://www.jruby.org/getting-started). + +## Aliases + +| Alias | Command | +| ------------ | ---------------------------------------------------------------- | +| `jrspec` | `jruby --debug -S rspec --debug` | +| `jprofile` | `jruby --profile.api -S rspec` | +| `jexec` | `jruby -S` | From f32b30277d2cc0e47d9426ab8610d9a8a32979d3 Mon Sep 17 00:00:00 2001 From: 14nrv <34603467+14nrv@users.noreply.github.com> Date: Tue, 1 Oct 2019 22:24:00 +0200 Subject: [PATCH 065/302] yarn: add yd as yarn dev alias (#7663) --- plugins/yarn/README.md | 1 + plugins/yarn/yarn.plugin.zsh | 1 + 2 files changed, 2 insertions(+) diff --git a/plugins/yarn/README.md b/plugins/yarn/README.md index 671a272d9..5a3da0723 100644 --- a/plugins/yarn/README.md +++ b/plugins/yarn/README.md @@ -19,6 +19,7 @@ plugins=(... yarn) | yap | `yarn add --peer` | Install a package in peerDependencies (`package.json`) | | yb | `yarn build` | Run the build script defined in `package.json` | | ycc | `yarn cache clean` | Clean yarn's global cache of packages | +| yd | `yarn dev` | Run the dev script defined in `package.json` | | yga | `yarn global add` | Install packages globally on your operating system | | ygls | `yarn global list` | Lists global installed packages | | ygrm | `yarn global remove` | Remove global installed packages from your OS | diff --git a/plugins/yarn/yarn.plugin.zsh b/plugins/yarn/yarn.plugin.zsh index 9ed8322cd..d00e1c897 100644 --- a/plugins/yarn/yarn.plugin.zsh +++ b/plugins/yarn/yarn.plugin.zsh @@ -4,6 +4,7 @@ alias yad="yarn add --dev" alias yap="yarn add --peer" alias yb="yarn build" alias ycc="yarn cache clean" +alias yd="yarn dev" alias yga="yarn global add" alias ygls="yarn global list" alias ygrm="yarn global remove" From e38099de96e8b62976354b468da1b21ec2d57f68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 2 Oct 2019 13:10:17 +0200 Subject: [PATCH 066/302] sublime: ignore wslpath errors if C drive is missing --- plugins/sublime/sublime.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/sublime/sublime.plugin.zsh b/plugins/sublime/sublime.plugin.zsh index 69604ab4f..dd5063360 100644 --- a/plugins/sublime/sublime.plugin.zsh +++ b/plugins/sublime/sublime.plugin.zsh @@ -17,8 +17,8 @@ alias stn=create_project if [[ "$OSTYPE" == linux* ]]; then if [[ "$(uname -r)" = *icrosoft* ]]; then _sublime_paths=( - "$(wslpath -u 'C:\Program Files\Sublime Text 3\subl.exe')" - "$(wslpath -u 'C:\Program Files\Sublime Text 2\subl.exe')" + "$(wslpath -u 'C:\Program Files\Sublime Text 3\subl.exe' 2>/dev/null)" + "$(wslpath -u 'C:\Program Files\Sublime Text 2\subl.exe' 2>/dev/null)" ) else _sublime_paths=( From fc9093b745096a970c8b87b2275a69ad13d665db Mon Sep 17 00:00:00 2001 From: David Shaffer Date: Thu, 26 Sep 2019 10:12:30 -0400 Subject: [PATCH 067/302] Add rubocop to bundled_commands --- plugins/bundler/bundler.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index 668e15d2f..c4a4fd40a 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -27,6 +27,7 @@ bundled_commands=( rainbows rake rspec + rubocop shotgun sidekiq spec From 372bb48cee7e1d2d20ebef660a86742a7e57756b Mon Sep 17 00:00:00 2001 From: David Shaffer Date: Wed, 2 Oct 2019 07:45:19 -0400 Subject: [PATCH 068/302] Add rubocop to bundler readme --- plugins/bundler/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/bundler/README.md b/plugins/bundler/README.md index dc2f17008..a7d40cd0a 100644 --- a/plugins/bundler/README.md +++ b/plugins/bundler/README.md @@ -2,7 +2,7 @@ - adds completion for basic bundler commands - adds short aliases for common bundler commands - - `be` aliased to `bundle exec`. + - `be` aliased to `bundle exec`. It also supports aliases (if `rs` is `rails server`, `be rs` will bundle-exec `rails server`). - `bl` aliased to `bundle list` - `bp` aliased to `bundle package` @@ -15,7 +15,7 @@ - calls `bundle exec ` otherwise Common gems wrapped by default (by name of the executable): -`annotate`, `cap`, `capify`, `cucumber`, `foodcritic`, `guard`, `hanami`, `irb`, `jekyll`, `kitchen`, `knife`, `middleman`, `nanoc`, `pry`, `puma`, `rackup`, `rainbows`, `rake`, `rspec`, `shotgun`, `sidekiq`, `spec`, `spork`, `spring`, `strainer`, `tailor`, `taps`, `thin`, `thor`, `unicorn` and `unicorn_rails`. +`annotate`, `cap`, `capify`, `cucumber`, `foodcritic`, `guard`, `hanami`, `irb`, `jekyll`, `kitchen`, `knife`, `middleman`, `nanoc`, `pry`, `puma`, `rackup`, `rainbows`, `rake`, `rspec`, `rubocop`, `shotgun`, `sidekiq`, `spec`, `spork`, `spring`, `strainer`, `tailor`, `taps`, `thin`, `thor`, `unicorn` and `unicorn_rails`. ## Configuration From 4b8f4d529ef1965a9f6a233579ea432374f817dd Mon Sep 17 00:00:00 2001 From: Ekunola Ezekiel Date: Wed, 2 Oct 2019 17:58:15 +0100 Subject: [PATCH 069/302] yii: add README (#8194) --- plugins/yii/README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 plugins/yii/README.md diff --git a/plugins/yii/README.md b/plugins/yii/README.md new file mode 100644 index 000000000..f1b72e916 --- /dev/null +++ b/plugins/yii/README.md @@ -0,0 +1,14 @@ +# Yii plugin + +The plugin adds autocomplete commands and subcommands for [yii](https://www.yiiframework.com/). + +To use it, add `yii` to the plugins array of your zshrc file: +``` +plugins=(... yii) +``` + +## Aliases + +| Alias | Command | +|--------|----------------------| +| yiic | `protected/yiic` | From ae0de1135dc96cfabe31d70f65112cbeadbfa3bf Mon Sep 17 00:00:00 2001 From: Rexben Date: Wed, 2 Oct 2019 21:31:28 +0100 Subject: [PATCH 070/302] cakephp3: add README (#8196) --- plugins/cakephp3/README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 plugins/cakephp3/README.md diff --git a/plugins/cakephp3/README.md b/plugins/cakephp3/README.md new file mode 100644 index 000000000..7e8f6640d --- /dev/null +++ b/plugins/cakephp3/README.md @@ -0,0 +1,16 @@ +# cakephp3 plugin + +The plugin adds aliases and autocompletion for [cakephp3](https://book.cakephp.org/3.0/en/index.html). + +To use it, add `cakephp3` to the plugins array of your zshrc file: +``` +plugins=(... cakephp3) +``` + +## Aliases + +| Alias | Command | +|-----------|-------------------------------| +| c3 | `bin/cake` | +| c3cache | `bin/cake orm_cache clear` | +| c3migrate | `bin/cake migrations migrate` | From 188eff0653a078ecf67e0a1c6b72de8d61384986 Mon Sep 17 00:00:00 2001 From: Zach Whitten Date: Wed, 2 Oct 2019 20:30:22 -0400 Subject: [PATCH 071/302] Adding README for rvm --- plugins/rvm/README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 plugins/rvm/README.md diff --git a/plugins/rvm/README.md b/plugins/rvm/README.md new file mode 100644 index 000000000..9d6fd8f85 --- /dev/null +++ b/plugins/rvm/README.md @@ -0,0 +1,19 @@ +# Ruby Version Manager plugin + +This plugin adds some utility functions and completions for [Ruby Version Manager](https://rvm.io/). + +To use it, add `rvm` to the plugins array in your zshrc file: + +```zsh +plugins=(... rvm) +``` + +## Functions +| Alias | Command | +|----------------|----------------------| +| `rb18` | `rvm use ruby-1.8.7` | +| `rb19` | `rvm use ruby-1.9.3` | +| `rb20` | `rvm use ruby-2.0.0` | +| `rb21` | `rvm use ruby-2.1.2` | +| `rvm-update` | `rvm get head` | +| `gems` | `gem list` | From ff23aa0bf9851c477b956c89882fdd04e143042e Mon Sep 17 00:00:00 2001 From: Nicholas Meriano Date: Thu, 3 Oct 2019 04:51:17 -0700 Subject: [PATCH 072/302] n98-magerun: add README (#8200) --- plugins/n98-magerun/README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 plugins/n98-magerun/README.md diff --git a/plugins/n98-magerun/README.md b/plugins/n98-magerun/README.md new file mode 100644 index 000000000..b0abe4747 --- /dev/null +++ b/plugins/n98-magerun/README.md @@ -0,0 +1,21 @@ +# n98-magerun plugin + +The swiss army knife for Magento developers, sysadmins and devops. The tool provides a huge set of well tested command line commands which save hours of work time. + +The [n98-magerun plugin](https://github.com/netz98/n98-magerun) provides many +[useful aliases](#aliases) as well as completion for the `n98-magerun` command. + +Enable it by adding `n98-magerun` to the plugins array in your zshrc file: + +```zsh +plugins=(... n98-magerun) +``` + +## Aliases + +| Alias | Command | Description | +| --------- | -------------------------------------------------- | --------------------------------------------------------------------------------- | +| n98 | `n98-magerun.phar` | The N98-Magerun phar-file (Version 1) | +| n98-2 | `n98-magerun2.phar` | The N98-Magerun phar-file (Version 2) | +| mage-get | `wget https://files.magerun.net/n98-magerun.phar` | Download the latest stable N98-Magerun phar-file from the file-server (Version 1) | +| mage2-get | `wget https://files.magerun.net/n98-magerun2.phar` | Download the latest stable N98-Magerun phar-file from the file-server (Version 2) | From c60371a829901cde3322c18c6d35e88ddd9bc1f3 Mon Sep 17 00:00:00 2001 From: Zach Whitten Date: Thu, 3 Oct 2019 07:52:50 -0400 Subject: [PATCH 073/302] rebar: add README (#8198) --- plugins/rebar/README.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 plugins/rebar/README.md diff --git a/plugins/rebar/README.md b/plugins/rebar/README.md new file mode 100644 index 000000000..456ba45c7 --- /dev/null +++ b/plugins/rebar/README.md @@ -0,0 +1,9 @@ +# rebar plugin + +This plugin adds completions for the [rebar](https://www.rebar3.org/) Erlang build tool. + +To use it, add `rebar` to the plugins array in your zshrc file: + +```zsh +plugins=(... rebar) +``` From 3848102a5ec8534cef935d594c6abcbfc0f419c8 Mon Sep 17 00:00:00 2001 From: Shubham Kamath <44347043+shubhaemk@users.noreply.github.com> Date: Thu, 3 Oct 2019 17:25:08 +0530 Subject: [PATCH 074/302] terminitor: add README (#8197) --- plugins/terminitor/README.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 plugins/terminitor/README.md diff --git a/plugins/terminitor/README.md b/plugins/terminitor/README.md new file mode 100644 index 000000000..8c0e02113 --- /dev/null +++ b/plugins/terminitor/README.md @@ -0,0 +1,9 @@ +# Terminitor plugin + +This plugin adds completions for the [Terminitor](https://github.com/achiurizo/terminitor) development workflow setup tool. + +To use it, add `terminitor` to the plugins array in your zshrc file: + +```zsh +plugins=(... terminitor) +``` From 1be840b8319b40c5608d18816031f6b2d6dc6849 Mon Sep 17 00:00:00 2001 From: Erwan ROUSSEL Date: Sat, 5 Oct 2019 11:05:46 +0200 Subject: [PATCH 075/302] Create README.md --- plugins/redis-cli/README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 plugins/redis-cli/README.md diff --git a/plugins/redis-cli/README.md b/plugins/redis-cli/README.md new file mode 100644 index 000000000..f6e947f4c --- /dev/null +++ b/plugins/redis-cli/README.md @@ -0,0 +1,14 @@ +# Redis-CLI + +This plugin adds [redis-cli](https://redis.io/topics/rediscli) completion, based off homebrew completion + +To use it, add `redis-cli` to the plugins array in your zshrc file: + +```zsh +plugins=(... redis-cli) +``` +## Requirements + +In order to make this work, you will need to have the redis installed. + +More info on the usage and install: https://redis.io/topics/quickstart From e1cb349ffe411b6de2fef696885ec687853d152f Mon Sep 17 00:00:00 2001 From: Erwan ROUSSEL Date: Sat, 5 Oct 2019 11:14:12 +0200 Subject: [PATCH 076/302] Update README.md --- plugins/redis-cli/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/redis-cli/README.md b/plugins/redis-cli/README.md index f6e947f4c..64956df13 100644 --- a/plugins/redis-cli/README.md +++ b/plugins/redis-cli/README.md @@ -9,6 +9,6 @@ plugins=(... redis-cli) ``` ## Requirements -In order to make this work, you will need to have the redis installed. +In order to make this work, you will need to have redis installed. More info on the usage and install: https://redis.io/topics/quickstart From 53d987346f4d465c100f3dab234953db48eed7a1 Mon Sep 17 00:00:00 2001 From: Erwan ROUSSEL Date: Sat, 5 Oct 2019 11:30:21 +0200 Subject: [PATCH 077/302] Create README.md --- plugins/perl/README.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 plugins/perl/README.md diff --git a/plugins/perl/README.md b/plugins/perl/README.md new file mode 100644 index 000000000..f2f4b79ec --- /dev/null +++ b/plugins/perl/README.md @@ -0,0 +1,36 @@ +# Perl + +This plugin adds [perl](https://www.perl.org/) useful aliases/functions. + +To use it, add `perl` to the plugins array in your zshrc file: + +```zsh +plugins=(... perl) +``` + +## Aliases + +| Aliases | Command | Description | +| :------------ | :-------------- | :----------------------------------- | +| pbi | perlbrew install|Install specific perl version | +| pbl | perlbrew list |List all perl version installed | +| pbo | perlbrew off |Go back to the system perl | +| pbs | perlbrew switch |Turn it back on | +| pbu | perlbrew use |Use specific version of perl | +| pd | perldoc |Show the perl documentation | +| ple | perl -wlne |Use perl like awk/sed | +| latest-perl | curl `...` |Show the latest stable release of Perl| + +## Functions + +`newpl` - creates a basic Perl script file and opens it with $EDITOR + +`pgs` - Perl Global Substitution (find pattern = 1st arg ; replace pattern = 2nd arg ; filename = 3rd arg) + +`prep` - Perl grep, because 'grep -P' is terrible. Lets you work with pipes or files. (pattern = 1st arg ; filename = 2nd arg) + +## Requirements + +In order to make this work, you will need to have perl installed. + +More info on the usage and install: https://www.perl.org/get.html From dd0ade161c0fc47ea4a9e43ce3787170db2f8f60 Mon Sep 17 00:00:00 2001 From: Alex Morozoff Date: Sun, 6 Oct 2019 15:24:25 -0400 Subject: [PATCH 078/302] Create README.md Added README for UFW plugin issue: [Good first PR] Add READMEs to undocumented plugins #7175 --- plugins/ufw/README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 plugins/ufw/README.md diff --git a/plugins/ufw/README.md b/plugins/ufw/README.md new file mode 100644 index 000000000..a27487a46 --- /dev/null +++ b/plugins/ufw/README.md @@ -0,0 +1,17 @@ +# UFW +This plugin adds support for managing everybody's favorite Uncomplicated Firewall (UFW). Learn more about [`UFW`](https://wiki.ubuntu.com/UncomplicatedFirewall). + +To use it, add ufw to the plugins array of your zshrc file: +``` +plugins=(... ufw) +``` +UFW is a simple Ubuntu interface for managing iptables. + +Some of the commands include: + +* `allow /` add an allow rule +* `default` set default policy +* `delete /` delete RULE +* `deny /` add deny rule +* `disable` disables the firewall +* `enable` enables the firewall From 4b65f439e2c92b7c839dd355f8701d72f3a8ea2b Mon Sep 17 00:00:00 2001 From: Michael C Date: Sun, 6 Oct 2019 15:33:06 +0200 Subject: [PATCH 079/302] docs: add README.md for Dash plugin --- plugins/dash/README.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 plugins/dash/README.md diff --git a/plugins/dash/README.md b/plugins/dash/README.md new file mode 100644 index 000000000..f69f834f3 --- /dev/null +++ b/plugins/dash/README.md @@ -0,0 +1,29 @@ +# Dash plugin + +This plugin adds command line functionality for [Dash](https://kapeli.com/dash), +an API Documentation Browser. + +This plugin requires Dash to be installed to work. + +To use it, add `dash` to the plugins array in your zshrc file: + +```zsh +plugins=(... dash) +``` + +Make sure to source your rc file: +``` +source ~/.zshrc +``` + +## Usage + +Open and switch to the dash application. +``` +dash +``` + +Query for something in dash app. +``` +dash golang +``` From 357336bfb399ac95db21ceed40dc7b18eea6779c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Mon, 7 Oct 2019 17:04:31 +0200 Subject: [PATCH 080/302] Remove redundant section and document keyword args --- plugins/dash/README.md | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/plugins/dash/README.md b/plugins/dash/README.md index f69f834f3..0ca3e4e44 100644 --- a/plugins/dash/README.md +++ b/plugins/dash/README.md @@ -1,9 +1,8 @@ # Dash plugin This plugin adds command line functionality for [Dash](https://kapeli.com/dash), -an API Documentation Browser. - -This plugin requires Dash to be installed to work. +an API Documentation Browser for macOS. This plugin requires Dash to be installed +to work. To use it, add `dash` to the plugins array in your zshrc file: @@ -11,19 +10,19 @@ To use it, add `dash` to the plugins array in your zshrc file: plugins=(... dash) ``` -Make sure to source your rc file: -``` -source ~/.zshrc -``` - ## Usage -Open and switch to the dash application. +- Open and switch to the dash application. ``` dash ``` -Query for something in dash app. +- Query for something in dash app: `dash query` ``` -dash golang +dash golang +``` + +- You can optionally provide a keyword: `dash [keyword:]query` +``` +dash python:tuple ``` From b45e0f4836d7b2a3b5fe2266d669d878ccd737e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Mon, 7 Oct 2019 17:08:38 +0200 Subject: [PATCH 081/302] dash: simplify completion logic --- plugins/dash/dash.plugin.zsh | 52 ++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 29 deletions(-) diff --git a/plugins/dash/dash.plugin.zsh b/plugins/dash/dash.plugin.zsh index b00d4877e..ace2e33c1 100644 --- a/plugins/dash/dash.plugin.zsh +++ b/plugins/dash/dash.plugin.zsh @@ -35,36 +35,30 @@ _dash() { if [[ "$locator" == "platform" ]]; then # Since these are the only special cases right now, let's not do the # expensive processing unless we have to - if [[ "$keyword" == "python" || "$keyword" == "java" || \ - "$keyword" == "qt" || "$keyword" == "cocs2d" ]]; then + if [[ "$keyword" = (python|java|qt|cocos2d) ]]; then docsetName=`echo $doc | grep -Eo "docsetName = .*?;" | sed -e "s/docsetName = \(.*\);/\1/" -e "s/[\":]//g"` - if [[ "$keyword" == "python" ]]; then - if [[ "$docsetName" == "Python 2" ]]; then - keyword="python2" - elif [[ "$docsetName" == "Python 3" ]]; then - keyword="python3" - fi - elif [[ "$keyword" == "java" ]]; then - if [[ "$docsetName" == "Java SE7" ]]; then - keyword="java7" - elif [[ "$docsetName" == "Java SE6" ]]; then - keyword="java6" - elif [[ "$docsetName" == "Java SE8" ]]; then - keyword="java8" - fi - elif [[ "$keyword" == "qt" ]]; then - if [[ "$docsetName" == "Qt 5" ]]; then - keyword="qt5" - elif [[ "$docsetName" == "Qt 4" ]]; then - keyword="qt4" - elif [[ "$docsetName" == "Qt" ]]; then - keyword="qt4" - fi - elif [[ "$keyword" == "cocos2d" ]]; then - if [[ "$docsetName" == "Cocos3D" ]]; then - keyword="cocos3d" - fi - fi + case "$keyword" in + python) + case "$docsetName" in + "Python 2") keyword="python2" ;; + "Python 3") keyword="python3" ;; + esac ;; + java) + case "$docsetName" in + "Java SE7") keyword="java7" ;; + "Java SE6") keyword="java6" ;; + "Java SE8") keyword="java8" ;; + esac ;; + qt) + case "$docsetName" in + "Qt 5") keyword="qt5" ;; + "Qt 4"|Qt) keyword="qt4" ;; + esac ;; + cocos2d) + case "$docsetName" in + Cocos3D) keyword="cocos3d" ;; + esac ;; + esac fi fi From 456814d8a61c644e59fdea8914e8dc7d2ba3dbf4 Mon Sep 17 00:00:00 2001 From: Aditya J Karia Date: Mon, 7 Oct 2019 20:53:00 +0530 Subject: [PATCH 082/302] mysql-macports: add README (#8210) --- plugins/mysql-macports/README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 plugins/mysql-macports/README.md diff --git a/plugins/mysql-macports/README.md b/plugins/mysql-macports/README.md new file mode 100644 index 000000000..a4224d9c0 --- /dev/null +++ b/plugins/mysql-macports/README.md @@ -0,0 +1,20 @@ +# MySQL-Macports plugin + +This plugin adds aliases for some of the commonly used [MySQL](https://www.mysql.com/) commands when installed using [MacPorts](https://www.macports.org/) on macOS. + +To use it, add `mysql-macports` to the plugins array in your zshrc file: + +```zsh +plugins=(... mysql-macports) +``` + +For instructions on how to install MySQL using MacPorts, read the [MacPorts wiki](https://trac.macports.org/wiki/howto/MySQL/). + +## Aliases + +| Alias | Command | Description | +| ------------ | --------------------------------------------------------- | ------------------------------------------ | +| mysqlstart | `sudo /opt/local/share/mysql5/mysql/mysql.server start` | Start the MySQL server. | +| mysqlstop | `sudo /opt/local/share/mysql5/mysql/mysql.server stop` | Stop the MySQL server. | +| mysqlrestart | `sudo /opt/local/share/mysql5/mysql/mysql.server restart` | Restart the MySQL server. | +| mysqlstatus | `mysqladmin5 -u root -p ping` | Check whether the MySQL server is running. | From a9d382a297560647be79070349ac34a66101b9c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Mon, 7 Oct 2019 17:25:44 +0200 Subject: [PATCH 083/302] Small changes --- plugins/redis-cli/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/redis-cli/README.md b/plugins/redis-cli/README.md index 64956df13..bb6e94a0f 100644 --- a/plugins/redis-cli/README.md +++ b/plugins/redis-cli/README.md @@ -1,12 +1,13 @@ # Redis-CLI -This plugin adds [redis-cli](https://redis.io/topics/rediscli) completion, based off homebrew completion +This plugin adds [redis-cli](https://redis.io/topics/rediscli) completion, based off of Homebrew completion. To use it, add `redis-cli` to the plugins array in your zshrc file: ```zsh plugins=(... redis-cli) ``` + ## Requirements In order to make this work, you will need to have redis installed. From 896dd271c8cadce8b8a618225cb4e79b9bca50f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Mon, 7 Oct 2019 17:40:51 +0200 Subject: [PATCH 084/302] Some syntax changes and more function docs --- plugins/perl/README.md | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/plugins/perl/README.md b/plugins/perl/README.md index f2f4b79ec..dd9b7dc75 100644 --- a/plugins/perl/README.md +++ b/plugins/perl/README.md @@ -10,27 +10,28 @@ plugins=(... perl) ## Aliases -| Aliases | Command | Description | -| :------------ | :-------------- | :----------------------------------- | -| pbi | perlbrew install|Install specific perl version | -| pbl | perlbrew list |List all perl version installed | -| pbo | perlbrew off |Go back to the system perl | -| pbs | perlbrew switch |Turn it back on | -| pbu | perlbrew use |Use specific version of perl | -| pd | perldoc |Show the perl documentation | -| ple | perl -wlne |Use perl like awk/sed | -| latest-perl | curl `...` |Show the latest stable release of Perl| +| Aliases | Command | Description | +| :------------ | :----------------- | :------------------------------------- | +| pbi | `perlbrew install` | Install specific perl version | +| pbl | `perlbrew list` | List all perl version installed | +| pbo | `perlbrew off` | Go back to the system perl | +| pbs | `perlbrew switch` | Turn it back on | +| pbu | `perlbrew use` | Use specific version of perl | +| pd | `perldoc` | Show the perl documentation | +| ple | `perl -wlne` | Use perl like awk/sed | +| latest-perl | `curl ...` | Show the latest stable release of Perl | ## Functions -`newpl` - creates a basic Perl script file and opens it with $EDITOR +* `newpl`: creates a basic Perl script file and opens it with $EDITOR. -`pgs` - Perl Global Substitution (find pattern = 1st arg ; replace pattern = 2nd arg ; filename = 3rd arg) +* `pgs`: Perl Global Substitution: `pgs ` + Looks for `` and replaces it with `` in ``. -`prep` - Perl grep, because 'grep -P' is terrible. Lets you work with pipes or files. (pattern = 1st arg ; filename = 2nd arg) +* `prep`: Perl grep, because 'grep -P' is terrible: `prep []` + Lets you work with pipes or files (if no `` provided, use stdin). ## Requirements In order to make this work, you will need to have perl installed. - More info on the usage and install: https://www.perl.org/get.html From d5e7040ebdfc9d9525b964c35ef1e704da632be2 Mon Sep 17 00:00:00 2001 From: Joe Rattazzi Date: Mon, 7 Oct 2019 10:53:18 -0500 Subject: [PATCH 085/302] pyenv: add README (#8224) --- plugins/pyenv/README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 plugins/pyenv/README.md diff --git a/plugins/pyenv/README.md b/plugins/pyenv/README.md new file mode 100644 index 000000000..d063b55b9 --- /dev/null +++ b/plugins/pyenv/README.md @@ -0,0 +1,16 @@ +# pyenv + +This plugin looks for [pyenv](https://github.com/pyenv/pyenv), a Simple Python version +management system, and loads it if it's found. It also loads pyenv-virtualenv, a pyenv +plugin to manage virtualenv, if it's found. + +To use it, add `pyenv` to the plugins array in your zshrc file: + +```zsh +plugins=(... pyenv) +``` + +## Functions + +- `pyenv_prompt_info`: displays the Python version in use by pyenv; or the global Python + version, if pyenv wasn't found. From 5f066dabc89b66479b36b5837ed11dc3c36a1d55 Mon Sep 17 00:00:00 2001 From: Denis Titusov Date: Mon, 7 Oct 2019 19:01:08 +0300 Subject: [PATCH 086/302] Add README for pow and powify plugins (#8225) --- plugins/pow/README.md | 21 +++++++++++++++++++++ plugins/powify/README.md | 10 ++++++++++ 2 files changed, 31 insertions(+) create mode 100644 plugins/pow/README.md create mode 100644 plugins/powify/README.md diff --git a/plugins/pow/README.md b/plugins/pow/README.md new file mode 100644 index 000000000..1f8a9d136 --- /dev/null +++ b/plugins/pow/README.md @@ -0,0 +1,21 @@ +# pow plugin + +This plugin adds completion and commands for [pow](http://pow.cx/), a +zero-configuration Rack server for macOS. + +To use it, add pow to the plugins array of your zshrc file: + +```sh +plugins=(... pow) +``` + +## Commands + +- `kapow` will restart an app. + + ```bash + kapow myapp + ``` + +- `kaput` will show the standard output from any pow app. +- `repow` will restart the pow process. diff --git a/plugins/powify/README.md b/plugins/powify/README.md new file mode 100644 index 000000000..fd58b860e --- /dev/null +++ b/plugins/powify/README.md @@ -0,0 +1,10 @@ +# powify plugin + +This plugin adds autocompletion for [powify](https://github.com/sethvargo/powify), +an easy-to-use wrapper for Basecamp's [pow](https://github.com/basecamp/pow). + +To use it, add powify to the plugins array of your zshrc file: + +```sh +plugins=(... powify) +``` From 5efe52d991ab1f2596c3aa7766c981412c621fd7 Mon Sep 17 00:00:00 2001 From: Michael C Date: Mon, 7 Oct 2019 18:04:49 +0200 Subject: [PATCH 087/302] virtualenvwrapper: add README (#8226) --- plugins/virtualenvwrapper/README.md | 38 +++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 plugins/virtualenvwrapper/README.md diff --git a/plugins/virtualenvwrapper/README.md b/plugins/virtualenvwrapper/README.md new file mode 100644 index 000000000..63eb58541 --- /dev/null +++ b/plugins/virtualenvwrapper/README.md @@ -0,0 +1,38 @@ +# Virtualenvwrapper plugin + +This plugin loads Python's [virtualenvwrapper](https://virtualenvwrapper.readthedocs.io/en/latest/) shell tools. + +To use it, add `virtualenvwrapper` to the plugins array in your zshrc file: + +```zsh +plugins=(... virtualenvwrapper) +``` + +## Usage + +The plugin allows to automatically activate virtualenvs on cd into git repositories with a matching name: + +``` +➜ github $ cd ansible +(ansible) ➜ ansible git:(devel) $ cd docs +(ansible) ➜ docs git:(devel) $ cd .. +(ansible) ➜ ansible git:(devel) $ cd .. +➜ github $ +``` + +We can override this by having a `.venv` file in the directory containing a differently named virtualenv: + +``` +➜ github $ cat ansible/.venv +myvirtualenv +➜ github $ cd ansible +(myvirtualenv) ➜ ansible git:(devel) $ cd .. +➜ github $ +``` + +We can disable this behaviour by setting `DISABLE_VENV_CD=1` before Oh My Zsh is sourced: +```zsh +DISABLE_VENV_CD=1 +plugins=(... virtualenvwrapper) +source $ZSH/oh-my-zsh.sh +``` From a3b63aa6ab948c1be278fbea6046cf09f69d3c42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Mon, 7 Oct 2019 18:08:14 +0200 Subject: [PATCH 088/302] Reword --- plugins/ufw/README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/ufw/README.md b/plugins/ufw/README.md index a27487a46..ac377cd17 100644 --- a/plugins/ufw/README.md +++ b/plugins/ufw/README.md @@ -1,11 +1,12 @@ -# UFW -This plugin adds support for managing everybody's favorite Uncomplicated Firewall (UFW). Learn more about [`UFW`](https://wiki.ubuntu.com/UncomplicatedFirewall). +# UFW plugin + +This plugin adds completion for managing everybody's favorite Uncomplicated Firewall (UFW), +a simple interface for managing iptables. Learn more about [`UFW`](https://wiki.ubuntu.com/UncomplicatedFirewall). To use it, add ufw to the plugins array of your zshrc file: ``` plugins=(... ufw) ``` -UFW is a simple Ubuntu interface for managing iptables. Some of the commands include: From fdebc2272e8789e9120ab9b195754e423990b317 Mon Sep 17 00:00:00 2001 From: Griffin J Rademacher Date: Mon, 7 Oct 2019 12:37:42 -0400 Subject: [PATCH 089/302] Add READMEs for tugboat and colemak plugins (#8207) --- plugins/colemak/README.md | 48 +++++++++++++++++++++++++++++++++++++++ plugins/tugboat/README.md | 12 ++++++++++ 2 files changed, 60 insertions(+) create mode 100644 plugins/colemak/README.md create mode 100644 plugins/tugboat/README.md diff --git a/plugins/colemak/README.md b/plugins/colemak/README.md new file mode 100644 index 000000000..4da4bc126 --- /dev/null +++ b/plugins/colemak/README.md @@ -0,0 +1,48 @@ +# Colemak plugin + +This plugin remaps keys in `zsh`'s [`vi`-style navigation mode](http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Keymaps) +for a [Colemak](https://colemak.com/) keyboard layout, to match the QWERTY position: + +![Colemak layout on a US keyboard](https://colemak.com/wiki/images/6/6c/Colemak2.png) + +To use it, add it to the plugins array in your `~/.zshrc` file: + +``` +plugins=(... colemak) +``` + +You will also need to enable `vi` mode, so add another line to `~/.zshrc`: +``` +bindkey -v +``` + +Restart your shell and hit the `` key to activate `vicmd` (navigation) mode, +and start navigating `zsh` with your new keybindings! + +## Key bindings for vicmd + +| Old | New | Binding | Description | +|------------|------------|---------------------------|----------------------------------------------------| +| `CTRL`+`j` | `CTRL`+`n` | accept-line | Insert new line | +| `j` | `n` | down-line-or-history | Move one line down or command history forwards | +| `k` | `e` | up-line-or-history | Move one line up or command history backwards | +| `l` | `i` | vi-forward-char | Move one character to the right | +| `n` | `k` | vi-repeat-search | Repeat command search forwards | +| `N` | `K` | vi-rev-repeat-search | Repeat command search backwards | +| `i` | `u` | vi-insert | Enter insert mode | +| `I` | `U` | vi-insert-bol | Move to first non-blank char and enter insert mode | +| `` | `l` | vi-undo-change | Undo change | +| `J` | `N` | vi-join | Join the current line with the next one | +| `e` | `j` | vi-forward-word-end | Move to the end of the next word | +| `E` | `J` | vi-forward-blank-word-end | Move to end of the current or next word | + +## Key bindings for less + +| Keyboard shortcut | `less` key binding | +|-------------------|--------------------| +| `n` | forw-line | +| `e` | back-line | +| `k` | repeat-search | +| `ESC`+`k` | repeat-search-all | +| `K` | reverse-search | +| `ESC`+`K` | reverse-search-all | diff --git a/plugins/tugboat/README.md b/plugins/tugboat/README.md new file mode 100644 index 000000000..14f828f85 --- /dev/null +++ b/plugins/tugboat/README.md @@ -0,0 +1,12 @@ +# Tugboat plugin + +This plugin adds autocompletion for Tugboat, a command line tool for interacting with your +[DigitalOcean droplets](https://www.digitalocean.com/products/droplets/). + +To use it, add it to the plugins array in your `~/.zshrc` file: + +```zsh +plugins=(... tugboat) +``` + +Further documentation for Tugboat can be found in the [Tugboat repository](https://github.com/petems/tugboat). From 7e842cddc45b8bdebe1b198e83eb96fd07b37787 Mon Sep 17 00:00:00 2001 From: Austin Ratcliff Date: Mon, 7 Oct 2019 11:50:01 -0500 Subject: [PATCH 090/302] cloudapp: add README (#8229) --- plugins/cloudapp/README.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 plugins/cloudapp/README.md diff --git a/plugins/cloudapp/README.md b/plugins/cloudapp/README.md new file mode 100644 index 000000000..62975a631 --- /dev/null +++ b/plugins/cloudapp/README.md @@ -0,0 +1,24 @@ +# CloudApp plugin + +[CloudApp](https://www.getcloudapp.com) brings screen recording, screenshots, and GIF creation to the cloud, in an easy-to-use enterprise-level app. The CloudApp plugin allows you to upload a file to your CloadApp account from the command line. + +To use it, add `cloudapp` to the plugins array of your `~/.zshrc` file: + +``` +plugins=(... dash) +``` + +## Requirements + +1. [Aaron Russell's `cloudapp_api` gem](https://github.com/aaronrussell/cloudapp_api#installation) + +2. That you set your CloudApp credentials in `~/.cloudapp` as a simple text file like below: + ``` + email + password + ``` + +## Usage + +- `cloudapp `: uploads `` to your CloudApp account, and if you're using + macOS, copies the URL to your clipboard. From 82bd8828eb243199fccea87f5489a21a5be9c89c Mon Sep 17 00:00:00 2001 From: Chaitanya Raj Date: Tue, 8 Oct 2019 14:01:57 +0530 Subject: [PATCH 091/302] Create README.md for compleat plugin --- plugins/compleat/README.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 plugins/compleat/README.md diff --git a/plugins/compleat/README.md b/plugins/compleat/README.md new file mode 100644 index 000000000..1d7f0492d --- /dev/null +++ b/plugins/compleat/README.md @@ -0,0 +1,9 @@ +# compleat + +This plugin runs [bashcompinit](https://github.com/zsh-users/zsh/blob/master/Completion/bashcompinit) which will allow zsh to read bash completion specifications and functions. + +To use it add compleat to the plugins array in your zshrc file. + + ``` +plugins=(... compleat) +``` \ No newline at end of file From c714d3fcedd2e729350b5f69f4a9312b9fc68a43 Mon Sep 17 00:00:00 2001 From: Qinfeng Chen Date: Tue, 8 Oct 2019 09:48:08 -0400 Subject: [PATCH 092/302] gradle: support gdub completion (#6135) --- plugins/gradle/gradle.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/gradle/gradle.plugin.zsh b/plugins/gradle/gradle.plugin.zsh index 8d578e27b..6be583179 100644 --- a/plugins/gradle/gradle.plugin.zsh +++ b/plugins/gradle/gradle.plugin.zsh @@ -181,3 +181,4 @@ _gradlew_tasks () { ############################################################################ compdef _gradle_tasks gradle compdef _gradlew_tasks gradlew +compdef _gradlew_tasks gw From b09aed9cc7e2099f3e7f2aa2632660bc510f3e35 Mon Sep 17 00:00:00 2001 From: 14nrv <34603467+14nrv@users.noreply.github.com> Date: Tue, 8 Oct 2019 20:38:25 +0200 Subject: [PATCH 093/302] yarn: add ytc alias for test with coverage (#7664) --- plugins/yarn/README.md | 1 + plugins/yarn/yarn.plugin.zsh | 1 + 2 files changed, 2 insertions(+) diff --git a/plugins/yarn/README.md b/plugins/yarn/README.md index 439a9355f..a94f183e4 100644 --- a/plugins/yarn/README.md +++ b/plugins/yarn/README.md @@ -35,6 +35,7 @@ plugins=(... yarn) | ys | `yarn serve` | Start the dev server | | yst | `yarn start` | Run the start script defined in `package.json` | | yt | `yarn test` | Run the test script defined in `package.json` | +| ytc | `yarn test --coverage` | Run the test script defined in `package.json` with coverage | | yuc | `yarn global upgrade && yarn cache clean` | Upgrade global packages and clean yarn's global cache | | yui | `yarn upgrade-interactive` | Prompt for which outdated packages to upgrade | | yup | `yarn upgrade` | Upgrade packages to their latest version | diff --git a/plugins/yarn/yarn.plugin.zsh b/plugins/yarn/yarn.plugin.zsh index 6dc4786de..e7b6ce0d1 100644 --- a/plugins/yarn/yarn.plugin.zsh +++ b/plugins/yarn/yarn.plugin.zsh @@ -20,6 +20,7 @@ alias yrun="yarn run" alias ys="yarn serve" alias yst="yarn start" alias yt="yarn test" +alias ytc="yarn test --coverage" alias yuc="yarn global upgrade && yarn cache clean" alias yui="yarn upgrade-interactive" alias yup="yarn upgrade" From 7d410549cdeb838c45db4225a3b7d63e7098866d Mon Sep 17 00:00:00 2001 From: Karolis Mazukna Date: Tue, 8 Oct 2019 22:42:18 +0100 Subject: [PATCH 094/302] Adds chruby plugib README.md --- plugins/chruby/README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 plugins/chruby/README.md diff --git a/plugins/chruby/README.md b/plugins/chruby/README.md new file mode 100644 index 000000000..c5e4b9332 --- /dev/null +++ b/plugins/chruby/README.md @@ -0,0 +1,19 @@ +# chruby plugin + +This plugin loads the [chruby](https://github.com/postmodern/chruby). Supports brew and manual installation of chruby. + +To use it, add `chruby` to the plugins array in your zshrc file: + +```zsh +plugins=(... chruby) +``` + +## Usage + +If you'd prefer to specify an explicit path to load chruby from +you can set variables like so: + +``` +zstyle :omz:plugins:chruby path /local/path/to/chruby.sh +zstyle :omz:plugins:chruby auto /local/path/to/auto.sh +``` From c9841f43b1a95c6cc5fcca8422b47f8df511ecf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 9 Oct 2019 15:11:34 +0200 Subject: [PATCH 095/302] yarn: use zsh-completions latest version (87e1313) Closes #7300 Closes #8115 Closes #8118 --- plugins/yarn/_yarn | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/plugins/yarn/_yarn b/plugins/yarn/_yarn index 382f58a0a..3689ae960 100644 --- a/plugins/yarn/_yarn +++ b/plugins/yarn/_yarn @@ -71,7 +71,7 @@ _global_commands=( 'bin:Displays the location of the yarn bin folder' 'remove:Remove installed package from dependencies updating package.json' 'upgrade:Upgrades packages to their latest version based on the specified range' - 'upgrade-interactive' + 'upgrade-interactive:Interactively upgrade packages' ) _yarn_commands_scripts() { @@ -81,9 +81,21 @@ _yarn_commands_scripts() { } _yarn_scripts() { - local -a scripts - scripts=($(yarn run --json 2>/dev/null | sed -E '/Commands available|possibleCommands/!d;s/.*Commands available from binary scripts: ([^"]+)".*/\1/;s/.*"items":\[([^]]+).*/\1/;s/[" ]//g' | tr , '\n' | sed -e 's/:/\\:/g')) - _describe 'script' scripts + local -a commands binaries scripts + local -a scriptNames scriptCommands + local i runJSON + + runJSON=$(yarn run --json 2>/dev/null) + binaries=($(sed -E '/Commands available/!d;s/.*Commands available from binary scripts: ([^"]+)".*/\1/;s/.*"items":\[([^]]+).*/\1/;s/[" ]//g;s/:/\\:/g;s/,/\n/g' <<< "$runJSON")) + scriptNames=($(sed -E '/possibleCommands/!d;s/.*"items":\[([^]]+).*/\1/;s/[" ]//g;s/:/\\:/g;s/,/\n/g' <<< "$runJSON")) + scriptCommands=("${(@f)$(sed -E '/possibleCommands/!d;s/.*"hints":\{([^}]+)\}.*/\1/;s/"[^"]+"://g;s/:/\\:/g;s/","/\n/g;s/(^"|"$)//g' <<< "$runJSON")}") + + for (( i=1; i <= $#scriptNames; i++ )); do + scripts+=("${scriptNames[$i]}:${scriptCommands[$i]}") + done + + commands=($scripts $binaries) + _describe 'command' commands } _yarn_global_commands() { @@ -240,7 +252,8 @@ _yarn() { run) _arguments \ - '1: :_yarn_scripts' + '1: :_yarn_scripts' \ + '*:: :_default' ;; tag) @@ -255,6 +268,11 @@ _yarn() { '*:: :->team_args' ;; + upgrade-interactive) + _arguments \ + '--latest:use the version tagged latest in the registry:' + ;; + version) _arguments \ '--new-version:version:' \ @@ -266,6 +284,10 @@ _yarn() { _arguments \ '1:query:_files' ;; + + *) + _default + ;; esac ;; esac From 79b2944a8ae19fc9d065d3b92c916345feb65fa4 Mon Sep 17 00:00:00 2001 From: Frani Date: Wed, 9 Oct 2019 10:17:05 -0300 Subject: [PATCH 096/302] yarn: add yarn version alias (#8138) --- plugins/yarn/README.md | 1 + plugins/yarn/yarn.plugin.zsh | 1 + 2 files changed, 2 insertions(+) diff --git a/plugins/yarn/README.md b/plugins/yarn/README.md index a94f183e4..e6daae44f 100644 --- a/plugins/yarn/README.md +++ b/plugins/yarn/README.md @@ -39,5 +39,6 @@ plugins=(... yarn) | yuc | `yarn global upgrade && yarn cache clean` | Upgrade global packages and clean yarn's global cache | | yui | `yarn upgrade-interactive` | Prompt for which outdated packages to upgrade | | yup | `yarn upgrade` | Upgrade packages to their latest version | +| yv | `yarn version` | Update the version of your package | | yw | `yarn workspace` | Run a command within a single workspace. | | yws | `yarn workspaces` | Run a command within all defined workspaces. | diff --git a/plugins/yarn/yarn.plugin.zsh b/plugins/yarn/yarn.plugin.zsh index e7b6ce0d1..18c5dcc89 100644 --- a/plugins/yarn/yarn.plugin.zsh +++ b/plugins/yarn/yarn.plugin.zsh @@ -24,5 +24,6 @@ alias ytc="yarn test --coverage" alias yuc="yarn global upgrade && yarn cache clean" alias yui="yarn upgrade-interactive" alias yup="yarn upgrade" +alias yv="yarn version" alias yw="yarn workspace" alias yws="yarn workspaces" From f5614d2b3a844305b363b50e6857ca064fdbbc84 Mon Sep 17 00:00:00 2001 From: otherpaco <27810032+otherpaco@users.noreply.github.com> Date: Wed, 9 Oct 2019 15:55:35 +0200 Subject: [PATCH 097/302] terminalapp: delete plugin deprecated since 2015 (#8230) --- plugins/terminalapp/terminalapp.plugin.zsh | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 plugins/terminalapp/terminalapp.plugin.zsh diff --git a/plugins/terminalapp/terminalapp.plugin.zsh b/plugins/terminalapp/terminalapp.plugin.zsh deleted file mode 100644 index 7c0c278b9..000000000 --- a/plugins/terminalapp/terminalapp.plugin.zsh +++ /dev/null @@ -1,6 +0,0 @@ -# This file is intentionally empty. -# -# The terminalapp plugin is deprecated and may be removed in a future release. -# Its functionality has been folded in to the core lib/termsupport.zsh, which -# is loaded for all users. You can remove terminalapp from your $plugins list -# once all your systems are updated to the current version of Oh My Zsh. From 8bb9b044699f5c96830c7fe2bb78de19854d4973 Mon Sep 17 00:00:00 2001 From: otherpaco <27810032+otherpaco@users.noreply.github.com> Date: Wed, 9 Oct 2019 16:58:58 +0200 Subject: [PATCH 098/302] singlechar: add README (#8232) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Marc Cornellà --- plugins/singlechar/README.md | 118 +++++++++++++++++++++++ plugins/singlechar/singlechar.plugin.zsh | 12 +-- 2 files changed, 119 insertions(+), 11 deletions(-) create mode 100644 plugins/singlechar/README.md diff --git a/plugins/singlechar/README.md b/plugins/singlechar/README.md new file mode 100644 index 000000000..d89029900 --- /dev/null +++ b/plugins/singlechar/README.md @@ -0,0 +1,118 @@ +# Singlechar plugin + +This plugin adds single char shortcuts (and combinations) for some commands. + +To use it, add `singlechar` to the plugins array of your zshrc file: +``` +plugins=(... singlechar) +``` + +## Aliases + +### CAT, GREP, CURL, WGET + +| Alias | Command | Description | +|-------|------------------|-------------| +| y | `grep -Ri` | Find case-insensitive string in all files and directories, recursively. Follows symlinks. | +| n | `grep -Rvi` | Same as above but only show lines that don't match the string. | +| f | `grep -Rli` | Same as 'y' but only print the filenames where the string is found. | +| fn | `grep -Rlvi` | Same as above but only show files that don't contain the string. | +| f. | `find . \| grep` | Grep list of files in current directory | +| f: | `find` | 'find' command | +| p | `less` | 'less' command | +| m | `man` | 'man' command | +| d | `wget` | 'wget' command | +| u | `curl` | 'curl' command | +| c | `cat` | 'cat' command | +| w | `echo >` | Write arguments to file, overwriting it if it exists. | +| a | `echo >>` | Write arguments to file, appending them if the file exists. | +| w: | `cat >` | Write stdin to file, overwriting if it exists. | +| a: | `cat >>` | Write stdin to file, appending it if the file exists. | + +### XARGS + +These aliases are versions of the aliases above but using xargs. This can be used +by piping the arguments to the xargs aliases. + +| Alias | Command | Description | +|-------|----------------------|---------------------------------| +| x | `xargs` | 'xargs' command | +| xy | `xargs grep -Ri` | Same as 'y' alias using xargs. | +| xn | `xargs grep -Rvi` | Same as 'n' alias using xargs. | +| xf | `xargs grep -Rli` | Same as 'f' alias using xargs. | +| xfn | `xargs grep -Rlvi` | Same as 'fn' alias using xargs. | +| xf. | `xargs find \| grep` | Same as 'f.' alias using xargs. | +| xf: | `xargs find` | Same as 'f:' alias using xargs. | +| xc | `xargs cat` | Same as 'c' alias using xargs. | +| xp | `xargs less` | Same as 'p' alias using xargs. | +| xm | `xargs man` | Same as 'm' alias using xargs. | +| xd | `xargs wget` | Same as 'd' alias using xargs. | +| xu | `xargs curl` | Same as 'u' alias using xargs. | +| xw | `xargs echo >` | Same as 'w' alias using xargs. | +| xa | `xargs echo >>` | Same as 'a' alias using xargs. | +| xw: | `xargs cat >` | Same as 'w:' alias using xargs. | +| xa: | `xargs >>` | Same as 'a:' alias using xargs. | + +### SUDO + +These aliases are versions of the aliases above in [CAT, GREP, CURL, WGET](#cat-grep-curl-wget) +but using sudo to run them with root permission. + +| Alias | Command | Description | +|-------|-----------------------|--------------------------------| +| s | `sudo` | 'sudo' command | +| sy | `sudo grep -Ri` | Same as 'y' alias using sudo. | +| sn | `sudo grep -Riv` | Same as 'n' alias using sudo. | +| sf | `sudo grep -Rli` | Same as 'f' alias using sudo. | +| sfn | `sudo grep -Rlvi` | Same as 'fn' alias using sudo. | +| sf. | `sudo find . \| grep` | Same as 'f.' alias using sudo. | +| sf: | `sudo find` | Same as 'f:' alias using sudo. | +| sp | `sudo less` | Same as 'p' alias using sudo. | +| sm | `sudo man` | Same as 'm' alias using sudo. | +| sd | `sudo wget` | Same as 'd' alias using sudo. | +| sc | `sudo cat` | Same as 'c' alias using sudo. | +| sw | `sudo echo >` | Same as 'w' alias using sudo. | +| sa | `sudo echo >>` | Same as 'a' alias using sudo. | +| sw: | `sudo cat >` | Same as 'w:' alias using sudo. | +| sa: | `sudo cat >>` | Same as 'a:' alias using sudo. | + +### SUDO-XARGS + +Same as above but using both sudo and xargs. + +| Alias | Command | Description | +|-------|---------------------------|---------------------------------| +| sx | `sudo xargs` | 'sudo xargs' command | +| sxy | `sudo xargs grep -Ri` | Same as 'xy' alias using sudo. | +| sxn | `sudo xargs grep -Riv` | Same as 'xn' alias using sudo. | +| sxf | `sudo xargs grep -li` | Same as 'xf' alias using sudo. | +| sxfn | `sudo xargs grep -lvi` | Same as 'xfn' alias using sudo. | +| sxf. | `sudo xargs find \| grep` | Same as 'xf.' alias using sudo. | +| sxf: | `sudo xargs find` | Same as 'xf:' alias using sudo. | +| sxp | `sudo xargs less` | Same as 'xp' alias using sudo. | +| sxm | `sudo xargs man` | Same as 'xm' alias using sudo. | +| sxd | `sudo xargs wget` | Same as 'xd' alias using sudo. | +| sxu | `sudo xargs curl` | Same as 'xu' alias using sudo. | +| sxc | `sudo xargs cat` | Same as 'xc' alias using sudo. | +| sxw | `sudo xargs echo >` | Same as 'xw' alias using sudo. | +| sxa | `sudo xargs echo >>` | Same as 'xa' alias using sudo. | +| sxw: | `sudo xargs cat >` | Same as 'xw:' alias using sudo. | +| sxa: | `sudo xargs cat >>` | Same as 'xa:' alias using sudo. | + +## Options + +The commands `grep`, `sudo`, `wget`, `curl`, and `less` can be configured to use other commands +via the setup variables below, before Oh My Zsh is sourced. If they are not set yet, they will +use their default values: + +| Setup variable | Default value | +|----------------|---------------| +| GREP | `grep` | +| ROOT | `sudo` | +| WGET | `wget` | +| CURL | `curl` | +| PAGER | `less` | + +## Author + +- [Karolin Varner](https://github.com/koraa) diff --git a/plugins/singlechar/singlechar.plugin.zsh b/plugins/singlechar/singlechar.plugin.zsh index 44bd998aa..d4b0b6735 100644 --- a/plugins/singlechar/singlechar.plugin.zsh +++ b/plugins/singlechar/singlechar.plugin.zsh @@ -1,13 +1,3 @@ -################################################################################ -# FILE: singlechar.plugin.zsh -# DESCRIPTION: oh-my-zsh plugin file. -# AUTHOR: Michael Varner (musikmichael@web.de) -# VERSION: 1.0.0 -# -# This plugin adds single char shortcuts (and combinations) for some commands. -# -################################################################################ - ########################### # Settings @@ -130,4 +120,4 @@ alias sxd='"$ROOT" xargs "$WGET"' alias sxu='"$ROOT" xargs "$CURL"' alias sxw:='"$ROOT" xargs cat >' -alias sxa:='"$ROOT" xargs cat >>' \ No newline at end of file +alias sxa:='"$ROOT" xargs cat >>' From abc05fa422a183e974df9faefc61a8512abe1db9 Mon Sep 17 00:00:00 2001 From: Noah Nichols Date: Wed, 9 Oct 2019 11:51:47 -0400 Subject: [PATCH 099/302] sprunge: add README and refactor (#8239) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Marc Cornellà --- plugins/sprunge/README.md | 31 ++++++++++++ plugins/sprunge/sprunge.plugin.zsh | 76 ++++++++++++++---------------- 2 files changed, 66 insertions(+), 41 deletions(-) create mode 100644 plugins/sprunge/README.md diff --git a/plugins/sprunge/README.md b/plugins/sprunge/README.md new file mode 100644 index 000000000..2a363d3bd --- /dev/null +++ b/plugins/sprunge/README.md @@ -0,0 +1,31 @@ +# Sprunge plugin + +This plugin uploads data and fetch URL from the pastebin http://sprunge.us + +To enable it, add 'sprunge' to your plugins: +``` +plugins=(... sprunge) +``` + +## Usage + +| Command | Description | +|------------------------------|-------------------------------------------| +| `sprunge filename.txt` | Uploads filename.txt | +| `sprunge "this is a string"` | Uploads plain text | +| `sprunge < filename.txt` | Redirects filename.txt content to sprunge | +| `echo data \| sprunge` | Any piped data will be uploaded | + +Once sprunge has processed the input it will give you a unique HTTP address: +``` +$ sprunge "hello" +http://sprunge.us/XxjnKz +``` + +## Notes + +- Sprunge accepts piped data, stdin redirection, text strings as input or filenames. + Only one of these can be used at a time. +- Argument precedence goes as follows: stdin > piped input > text strings. +- If a filename is mispelled or doesn't have the necessary path description, it will NOT + generate an error, but instead treat it as a text string. diff --git a/plugins/sprunge/sprunge.plugin.zsh b/plugins/sprunge/sprunge.plugin.zsh index e1c89b729..5d5687a82 100644 --- a/plugins/sprunge/sprunge.plugin.zsh +++ b/plugins/sprunge/sprunge.plugin.zsh @@ -2,12 +2,9 @@ # Created by the blogger at the URL below...I don't know where to find his/her name # Original found at https://www.shellperson.net/sprunge-pastebin-script/ -usage() { -description | fmt -s >&2 -} - -description() { -cat << HERE +sprunge() { + if [[ "$1" = --help ]]; then + fmt -s >&2 << EOF DESCRIPTION Upload data and fetch URL from the pastebin http://sprunge.us @@ -19,44 +16,41 @@ USAGE piped_data | $0 NOTES --------------------------------------------------------------------------- -* INPUT METHODS * -$0 can accept piped data, STDIN redirection [&2 - if [ "$*" ]; then - echo Arguments present... >&2 - if [ -f "$*" ]; then - echo Uploading the contents of "$*"... >&2 - cat "$*" - else - echo Uploading the text: \""$*"\"... >&2 - echo "$*" - fi | curl -F 'sprunge=<-' http://sprunge.us - else - echo No arguments found, printing USAGE and exiting. >&2 - usage - fi - else - echo Using input from a pipe or STDIN redirection... >&2 - curl -F 'sprunge=<-' http://sprunge.us - fi +EOF + return + fi + + if [ -t 0 ]; then + echo Running interactively, checking for arguments... >&2 + if [ "$*" ]; then + echo Arguments present... >&2 + if [ -f "$*" ]; then + echo Uploading the contents of "$*"... >&2 + cat "$*" + else + echo Uploading the text: \""$*"\"... >&2 + echo "$*" + fi | curl -F 'sprunge=<-' http://sprunge.us + else + echo No arguments found, printing USAGE and exiting. >&2 + sprunge --help + return 1 + fi + else + echo Using input from a pipe or STDIN redirection... >&2 + curl -F 'sprunge=<-' http://sprunge.us + fi } From 7ea05bd5003a1b7bd69b69fbcf3bfe3de4fcfe7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 9 Oct 2019 18:07:02 +0200 Subject: [PATCH 100/302] Change description --- plugins/compleat/README.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/plugins/compleat/README.md b/plugins/compleat/README.md index 1d7f0492d..630c91503 100644 --- a/plugins/compleat/README.md +++ b/plugins/compleat/README.md @@ -1,9 +1,8 @@ -# compleat +# compleat plugin -This plugin runs [bashcompinit](https://github.com/zsh-users/zsh/blob/master/Completion/bashcompinit) which will allow zsh to read bash completion specifications and functions. +This plugin looks for [compleat](https://github.com/mbrubeck/compleat) and loads its completion. -To use it add compleat to the plugins array in your zshrc file. - - ``` +To use it, add compleat to the plugins array in your zshrc file: +``` plugins=(... compleat) -``` \ No newline at end of file +``` From 11e23477527a0314ffbed74a3d061ae76034da15 Mon Sep 17 00:00:00 2001 From: Martin Mladenov <30376060+martinmladenov@users.noreply.github.com> Date: Wed, 9 Oct 2019 19:09:29 +0300 Subject: [PATCH 101/302] git-escape-magic: fix typos in README (#8234) --- plugins/git-escape-magic/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/git-escape-magic/README.md b/plugins/git-escape-magic/README.md index c3e3898f5..7fefed39d 100644 --- a/plugins/git-escape-magic/README.md +++ b/plugins/git-escape-magic/README.md @@ -4,13 +4,13 @@ This plugin is copied from the original at https://github.com/knu/zsh-git-escape-magic. All credit for the functionality enabled by this plugin should go to @knu. -An excerpt from that project's readme explains it's purpose. +An excerpt from that project's readme explains its purpose. > It eliminates the need for manually escaping those meta-characters. The zle function it provides is context aware and recognizes the characteristics of each subcommand of git. Every time you type one of these meta-characters on a git command line, it automatically escapes the meta-character with a backslash as necessary and as appropriate. ## Usage -To use this plugin add it to your list of plugins in your `.zshrc` file. +To use this plugin, add it to your list of plugins in your `.zshrc` file. -**NOTE**: If you use url-quote-magic it must be included before this +**NOTE**: If you use url-quote-magic, it must be included before this plugin runs to prevent any conflicts. From 98cd133c4d15c1a147679cc00c0bd924fd91f11c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 9 Oct 2019 18:12:58 +0200 Subject: [PATCH 102/302] Reword and add extra information --- plugins/chruby/README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/chruby/README.md b/plugins/chruby/README.md index c5e4b9332..d373006a5 100644 --- a/plugins/chruby/README.md +++ b/plugins/chruby/README.md @@ -1,9 +1,10 @@ # chruby plugin -This plugin loads the [chruby](https://github.com/postmodern/chruby). Supports brew and manual installation of chruby. +This plugin loads [chruby](https://github.com/postmodern/chruby), a tool that changes the +current Ruby version, and completion and a prompt function to display the Ruby version. +Supports brew and manual installation of chruby. To use it, add `chruby` to the plugins array in your zshrc file: - ```zsh plugins=(... chruby) ``` From c5b4613bf6e1256e56b5451bccce5972a255a58b Mon Sep 17 00:00:00 2001 From: Maciej Motyka <39633561+maciejmotyka@users.noreply.github.com> Date: Wed, 9 Oct 2019 19:13:25 +0200 Subject: [PATCH 103/302] python: add recurse flag to pygrep (#8217) As described in #7053 --- plugins/python/python.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/python/python.plugin.zsh b/plugins/python/python.plugin.zsh index f754ea261..950b0e01a 100644 --- a/plugins/python/python.plugin.zsh +++ b/plugins/python/python.plugin.zsh @@ -11,5 +11,5 @@ function pyclean() { } # Grep among .py files -alias pygrep='grep --include="*.py"' +alias pygrep='grep -r --include="*.py"' From 49c423c7e0a6d5193b77e60107e7c329da28d987 Mon Sep 17 00:00:00 2001 From: 927589452 <927589452@users.noreply.github.com> Date: Wed, 9 Oct 2019 19:24:44 +0200 Subject: [PATCH 104/302] battery: add support for sysctl in FreeBSD (#8155) --- plugins/battery/battery.plugin.zsh | 49 ++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/plugins/battery/battery.plugin.zsh b/plugins/battery/battery.plugin.zsh index 8f398cfb3..6b6684716 100644 --- a/plugins/battery/battery.plugin.zsh +++ b/plugins/battery/battery.plugin.zsh @@ -7,6 +7,9 @@ # Email: neuralsandwich@gmail.com # # Modified to add support for Apple Mac # ########################################### +# Author: J (927589452) # +# Modified to add support for FreeBSD # +########################################### if [[ "$OSTYPE" = darwin* ]] ; then @@ -64,6 +67,52 @@ if [[ "$OSTYPE" = darwin* ]] ; then [[ $(ioreg -rc "AppleSmartBattery"| grep '^.*"IsCharging"\ =\ ' | sed -e 's/^.*"IsCharging"\ =\ //') == "Yes" ]] } +elif [[ "$OSTYPE" = freebsd* ]] ; then + + function battery_is_charging() { + [[ $(sysctl -n hw.acpi.battery.state) -eq 2 ]] + } + + function battery_pct() { + if (( $+commands[sysctl] )) ; then + echo "$(sysctl -n hw.acpi.battery.life)" + fi + } + + function battery_pct_remaining() { + if [ ! $(battery_is_charging) ] ; then + battery_pct + else + echo "External Power" + fi + } + + function battery_time_remaining() { + remaining_time=$(sysctl -n hw.acpi.battery.time) + if [[ $remaining_time -ge 0 ]] ; then + # calculation from https://www.unix.com/shell-programming-and-scripting/23695-convert-minutes-hours-minutes-seconds.html + ((hour=$remaining_time/60)) + ((minute=$remaining_time-$hour*60)) + echo $hour:$minute + fi + } + + function battery_pct_prompt() { + b=$(battery_pct_remaining) + if [ ! $(battery_is_charging) ] ; then + if [ $b -gt 50 ] ; then + color='green' + elif [ $b -gt 20 ] ; then + color='yellow' + else + color='red' + fi + echo "%{$fg[$color]%}$(battery_pct_remaining)%%%{$reset_color%}" + else + echo "∞" + fi + } + elif [[ "$OSTYPE" = linux* ]] ; then function battery_is_charging() { From a2cc84dd20d13f60bab51438ebbf4ea220a255ee Mon Sep 17 00:00:00 2001 From: Kirill <30822663+KirillDemtchenko@users.noreply.github.com> Date: Wed, 9 Oct 2019 21:55:16 +0300 Subject: [PATCH 105/302] fbterm: add README (#8241) --- plugins/fbterm/README.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 plugins/fbterm/README.md diff --git a/plugins/fbterm/README.md b/plugins/fbterm/README.md new file mode 100644 index 000000000..eec33d7ee --- /dev/null +++ b/plugins/fbterm/README.md @@ -0,0 +1,9 @@ +# fbterm + +This plugin automatically starts [fbterm](https://github.com/zhangyuanwei/fbterm) +if on a real TTY (`/dev/tty*`). + +To use it, add fbterm to the plugins array of your zshrc file: +``` +plugins=(... fbterm) +``` From 710a3d5a1e2888a4dfb1769f8f1edd8a590eee22 Mon Sep 17 00:00:00 2001 From: Kirill <30822663+KirillDemtchenko@users.noreply.github.com> Date: Wed, 9 Oct 2019 22:04:49 +0300 Subject: [PATCH 106/302] emotty: add README (#8240) --- plugins/emotty/README.md | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 plugins/emotty/README.md diff --git a/plugins/emotty/README.md b/plugins/emotty/README.md new file mode 100644 index 000000000..2cfbe120c --- /dev/null +++ b/plugins/emotty/README.md @@ -0,0 +1,39 @@ +# emotty plugin + +This plugin returns an emoji for the current $TTY number so it can be used +in a prompt. + +To use it, add emotty to the plugins array in your zshrc file: +``` +plugins=(... emotty) +``` + +**NOTE:** it requires the [emoji plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/emoji). + +## Usage + +The function `emotty` displays an emoji from the current character set (default: `emoji`), based +on the number associated to the `$TTY`. + +There are different sets of emoji characters available, to choose a different +set, set `$emotty_set` to the name of the set you would like to use, e.g.: +``` +emotty_set=nature +``` + +### Character Sets + +- emoji +- loral +- love +- nature +- stellar +- zodiac + +Use the `display_emotty` function to list the emojis in the current character set, or +the character set passed as the first argument. For example: + +``` +$ display_emotty zodiac + +``` From 35aa3c13311e12ff3375f2eef561562244433ee8 Mon Sep 17 00:00:00 2001 From: jotaro-sama <36264038+jotaro-sama@users.noreply.github.com> Date: Thu, 10 Oct 2019 03:57:25 +0200 Subject: [PATCH 107/302] add readme for the rust plugin --- plugins/rust/README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 plugins/rust/README.md diff --git a/plugins/rust/README.md b/plugins/rust/README.md new file mode 100644 index 000000000..7cc1ceb66 --- /dev/null +++ b/plugins/rust/README.md @@ -0,0 +1,15 @@ +# rust + +This plugin adds completion for [`rustc`](https://doc.rust-lang.org/rustc/index.html), the compiler for the Rust programming language. + +To use it, add `rust` to the plugins array in your zshrc file: + +```zsh +plugins=(... rust) +``` + +## Aliases + +| Command | Description | +|------------------|---------------------------------------------------------------------------------| +| `rustc` | Compiler for the Rust language | From bb97a9b3ecb809dc7f4f64713170e42b44853d1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 10 Oct 2019 11:07:33 +0200 Subject: [PATCH 108/302] Delete alias section --- plugins/rust/README.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/plugins/rust/README.md b/plugins/rust/README.md index 7cc1ceb66..83d7d91ba 100644 --- a/plugins/rust/README.md +++ b/plugins/rust/README.md @@ -7,9 +7,3 @@ To use it, add `rust` to the plugins array in your zshrc file: ```zsh plugins=(... rust) ``` - -## Aliases - -| Command | Description | -|------------------|---------------------------------------------------------------------------------| -| `rustc` | Compiler for the Rust language | From f2be66177d440719dc58ce974077709b9b1b8f33 Mon Sep 17 00:00:00 2001 From: Yasna Kateb Date: Mon, 14 Oct 2019 13:05:12 +0330 Subject: [PATCH 109/302] Added README for pod --- plugins/pod/README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 plugins/pod/README.md diff --git a/plugins/pod/README.md b/plugins/pod/README.md new file mode 100644 index 000000000..1009a0855 --- /dev/null +++ b/plugins/pod/README.md @@ -0,0 +1,10 @@ +# pod + +This plugin adds completion for [`CocoaPods`](https://cocoapods.org/) +CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects. + +To use it, add `pod` to the plugins array in your zshrc file: + +```zsh +plugins=(... pod) +``` From c1bc062e6b56e03fe0b8b31df9520941d219b43f Mon Sep 17 00:00:00 2001 From: yasnakateb <37741028+yasnakateb@users.noreply.github.com> Date: Mon, 14 Oct 2019 13:06:20 +0330 Subject: [PATCH 110/302] Update README --- plugins/pod/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/pod/README.md b/plugins/pod/README.md index 1009a0855..0a3cc7a36 100644 --- a/plugins/pod/README.md +++ b/plugins/pod/README.md @@ -1,6 +1,6 @@ # pod -This plugin adds completion for [`CocoaPods`](https://cocoapods.org/) +This plugin adds completion for [`CocoaPods`](https://cocoapods.org/). CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects. To use it, add `pod` to the plugins array in your zshrc file: From f56b678888c0ad4ac71458680d75d88b442cf09b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 15 Oct 2019 16:51:51 +0200 Subject: [PATCH 111/302] fzf: check for dpkg before checking for fzf in debian Fixes #8253 Co-authored-by: Mariusz B --- plugins/fzf/fzf.plugin.zsh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins/fzf/fzf.plugin.zsh b/plugins/fzf/fzf.plugin.zsh index 646148297..f701fdf32 100644 --- a/plugins/fzf/fzf.plugin.zsh +++ b/plugins/fzf/fzf.plugin.zsh @@ -1,9 +1,9 @@ function setup_using_base_dir() { - # Declare all variables local not no mess with outside env in any way - local fzf_base - local fzf_shell - local fzfdirs - local dir + # Declare all variables local not no mess with outside env in any way + local fzf_base + local fzf_shell + local fzfdirs + local dir test -d "${FZF_BASE}" && fzf_base="${FZF_BASE}" @@ -58,7 +58,7 @@ function setup_using_base_dir() { function setup_using_debian_package() { - dpkg -s fzf &> /dev/null + (( $+command[dpkg] )) && dpkg -s fzf &> /dev/null if (( $? )); then # Either not a debian based distro, or no fzf installed. In any case skip ahead return 1 From ca6b3977834889f56d03356061394ca80f3520c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 15 Oct 2019 22:56:45 +0200 Subject: [PATCH 112/302] meta: remove automatic bug label on bug reports People sometimes use the bug report template for things that are support. Maintainers will confirm whether it's a bug with the appropriate label. --- .github/ISSUE_TEMPLATE/bug_report.md | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index ff55f36be..076c35544 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,7 +1,6 @@ --- name: Bug report about: Create a report to help us improve -labels: 'Type: bug' --- From 1f8989aee81740760fd4202172c90446d1c391d9 Mon Sep 17 00:00:00 2001 From: Kenny Heaton Date: Tue, 15 Oct 2019 16:21:16 -0500 Subject: [PATCH 113/302] rake: add README (#8254) --- plugins/rake/README.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 plugins/rake/README.md diff --git a/plugins/rake/README.md b/plugins/rake/README.md new file mode 100644 index 000000000..e235bd91a --- /dev/null +++ b/plugins/rake/README.md @@ -0,0 +1,37 @@ +# Rake plugin + +This plugin adds support for [rake](https://ruby.github.io/rake/), the Ruby +build tool or Ruby Make. + +To use it, add `rake` to the plugins array in your zshrc file: + +```zsh +plugins=(... rake) +``` + +## Aliases + +The plugin aliases the rake command so you can pass arguments when invoking rake tasks +without having to escape the brackets, i.e., you can run +``` +rake namespace:task['argument'] +``` +instead of having to do +``` +rake namespace:task\['argument'\] +``` + +| Alias | Command | Description | +|--------|--------------------------------|-----------------------------------------------| +| rake | `noglob rake` | Allows unescaped square brackets | +| brake | `noglob bundle exec rake` | Same as above but call rake using bundler | +| srake | `noglob sudo rake` | Same as rake but using sudo | +| sbrake | `noglob sudo bundle exec rake` | Same as above but using both sudo and bundler | + +## Jim Weirich + +The plugin also aliases `rake` to [`jimweirich`](https://github.com/jimweirich), author of Rake +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) From 11f36cf9226618666a3335833e5cfb246fce44b9 Mon Sep 17 00:00:00 2001 From: flowin Date: Tue, 15 Oct 2019 23:25:56 +0200 Subject: [PATCH 114/302] screen: add README (#8256) --- plugins/screen/README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 plugins/screen/README.md diff --git a/plugins/screen/README.md b/plugins/screen/README.md new file mode 100644 index 000000000..103e17237 --- /dev/null +++ b/plugins/screen/README.md @@ -0,0 +1,10 @@ +# screen + +This plugin sets title and hardstatus of the tab window for [screen](https://www.gnu.org/software/screen/), +the terminal multiplexer. + +To use it add `screen` to the plugins array in your zshrc file. + +```zsh +plugins=(... screen) +``` From 767be6c42f1b71fe497c46faa67c2ef4e70ab829 Mon Sep 17 00:00:00 2001 From: Sofia Rivas Date: Tue, 15 Oct 2019 16:46:40 -0500 Subject: [PATCH 115/302] git-remote-branch: add README (#8259) --- plugins/git-remote-branch/README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 plugins/git-remote-branch/README.md diff --git a/plugins/git-remote-branch/README.md b/plugins/git-remote-branch/README.md new file mode 100644 index 000000000..bd73e5dec --- /dev/null +++ b/plugins/git-remote-branch/README.md @@ -0,0 +1,14 @@ +# git-remote-branch plugin + +This plugin adds completion for [`grb`](https://github.com/webmat/git_remote_branch), +or `git_remote_branch`. + +To use it, add `git-remote-branch` to the plugins array of your `.zshrc` file: +``` +plugins=(... git-remote-branch) +``` + +## Deprecation + +[git_remote_branch was archived in 2018](https://github.com/webmat/git_remote_branch#archived), +meaning it's not actively maintained anymore. Use at your own risk. From f7d9dae12e82b724dcb0f482b03b9771c82b5906 Mon Sep 17 00:00:00 2001 From: Shriniwas Sharma Date: Wed, 16 Oct 2019 09:28:19 +0200 Subject: [PATCH 116/302] bira: move virtualenv information (#8266) --- themes/bira.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/bira.zsh-theme b/themes/bira.zsh-theme index d00f72f5d..cdae68d6c 100644 --- a/themes/bira.zsh-theme +++ b/themes/bira.zsh-theme @@ -16,7 +16,7 @@ local venv_prompt='$(virtualenv_prompt_info)' ZSH_THEME_RVM_PROMPT_OPTIONS="i v g" -PROMPT="╭─${venv_prompt}${user_host}${current_dir}${rvm_ruby}${git_branch} +PROMPT="╭─${user_host}${current_dir}${rvm_ruby}${git_branch}${venv_prompt} ╰─%B${user_symbol}%b " RPROMPT="%B${return_code}%b" From 563c0708ab7100c23aab218a9053a61d81fe1317 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C5=81uczy=C5=84ski?= Date: Wed, 16 Oct 2019 17:59:06 +0200 Subject: [PATCH 117/302] fzf: fix regression (#8269) Typo introduced in f56b678 fixing #8253 --- plugins/fzf/fzf.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/fzf/fzf.plugin.zsh b/plugins/fzf/fzf.plugin.zsh index f701fdf32..fe471a363 100644 --- a/plugins/fzf/fzf.plugin.zsh +++ b/plugins/fzf/fzf.plugin.zsh @@ -58,7 +58,7 @@ function setup_using_base_dir() { function setup_using_debian_package() { - (( $+command[dpkg] )) && dpkg -s fzf &> /dev/null + (( $+commands[dpkg] )) && dpkg -s fzf &> /dev/null if (( $? )); then # Either not a debian based distro, or no fzf installed. In any case skip ahead return 1 From 3e4d10c4f17b2fe57090a524d5d78781beda204a Mon Sep 17 00:00:00 2001 From: Shahin Sorkh Date: Wed, 16 Oct 2019 19:31:15 +0330 Subject: [PATCH 118/302] lib: allow alias expansion in _ sudo alias (#8268) --- lib/misc.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/misc.zsh b/lib/misc.zsh index 36c3ae2e5..61571afc9 100644 --- a/lib/misc.zsh +++ b/lib/misc.zsh @@ -22,7 +22,7 @@ env_default 'PAGER' 'less' env_default 'LESS' '-R' ## super user alias -alias _='sudo' +alias _='sudo ' ## more intelligent acking for ubuntu users if which ack-grep &> /dev/null; then From a41d308f70181db085938c5a8f2fe3d0d8e312c5 Mon Sep 17 00:00:00 2001 From: Nick Fagerlund Date: Fri, 18 Oct 2019 09:43:25 -0700 Subject: [PATCH 119/302] bundler: make it play nice with functions that call wrapped commands (#8271) When another function calls one of the bundler plugin's wrapper functions, the command to run gets passed as an array instead of a space-separated string. That works fine when the arguments are expanded alone, like `bundle exec $@`, but something like `./bin/$@` will expand to something like `./bin/rake ./bin/--silent ./bin/--tasks`, which of course will explode. This was causing a nasty interaction with the rake-fast plugin, and I'd be shocked if it wasn't causing other problems. The fix is to explicitly turn off the `RC_EXPAND_PARAM` option for that expansion. See http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion for more details. --- plugins/bundler/bundler.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index c4a4fd40a..d93fac01e 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -95,7 +95,7 @@ _binstubbed() { _run-with-bundler() { if _bundler-installed && _within-bundled-project; then if _binstubbed $1; then - ./bin/$@ + ./bin/${^^@} else bundle exec $@ fi From e8a6d328ac36df80901dae540c6a466354327bb0 Mon Sep 17 00:00:00 2001 From: Nick <24370162+deltaclock@users.noreply.github.com> Date: Fri, 18 Oct 2019 17:05:47 +0000 Subject: [PATCH 120/302] eecms: add README (#8277) --- plugins/eecms/README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 plugins/eecms/README.md diff --git a/plugins/eecms/README.md b/plugins/eecms/README.md new file mode 100644 index 000000000..c53835521 --- /dev/null +++ b/plugins/eecms/README.md @@ -0,0 +1,11 @@ +# eecms plugin + +This plugin adds auto-completion of console commands for [`eecms`](https://github.com/ExpressionEngine/ExpressionEngine). + +To use it, add `eecms` to the plugins array of your `.zshrc` file: +``` +plugins=(... eecms) +``` + +It also adds the alias `eecms` which finds the eecms file in the current project +and runs it with php. From 45d2236941cdb55d33c418c7779b66f3fd1dd3f0 Mon Sep 17 00:00:00 2001 From: Nick <24370162+deltaclock@users.noreply.github.com> Date: Fri, 18 Oct 2019 17:12:05 +0000 Subject: [PATCH 121/302] phing: add README (#8278) --- plugins/phing/README.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 plugins/phing/README.md diff --git a/plugins/phing/README.md b/plugins/phing/README.md new file mode 100644 index 000000000..e2ac0bdf5 --- /dev/null +++ b/plugins/phing/README.md @@ -0,0 +1,8 @@ +# Phing plugin + +This plugin adds autocompletion for [`phing`](https://github.com/phingofficial/phing) targets. + +To use it, add `phing` to the plugins array of your `.zshrc` file: +``` +plugins=(... eecms) +``` From efee47b5c0438f7dd0cfd03b9339bd6e1b4ab932 Mon Sep 17 00:00:00 2001 From: flowin Date: Fri, 18 Oct 2019 20:05:49 +0200 Subject: [PATCH 122/302] pass: add README (#8282) --- plugins/pass/README.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 plugins/pass/README.md diff --git a/plugins/pass/README.md b/plugins/pass/README.md new file mode 100644 index 000000000..2b0704981 --- /dev/null +++ b/plugins/pass/README.md @@ -0,0 +1,22 @@ +# pass + +This plugin provides completion for the [pass](https://www.passwordstore.org/) password manager. + +To use it, add `pass` to the plugins array in your zshrc file. + +``` +plugins=(... pass) +``` + +## Configuration + +### Multiple repositories + +If you use multiple repositories, you can configure completion like this: +```zsh +compdef _pass workpass +zstyle ':completion::complete:workpass::' prefix "$HOME/work/pass" +workpass() { + PASSWORD_STORE_DIR=$HOME/work/pass pass $@ +} +``` From 6b6f2b6dfdc4bc327e814477170f81f0b91a9740 Mon Sep 17 00:00:00 2001 From: Vsevolod Romashov <7@7vn.ru> Date: Fri, 18 Oct 2019 22:55:56 +0300 Subject: [PATCH 123/302] bundler: support new file naming convention (#6594) --- plugins/bundler/bundler.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index d93fac01e..665cb5e43 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -82,7 +82,7 @@ _bundler-installed() { _within-bundled-project() { local check_dir="$PWD" while [ "$check_dir" != "/" ]; do - [ -f "$check_dir/Gemfile" ] && return + [ -f "$check_dir/Gemfile" -o -f "$check_dir/gems.rb" ] && return check_dir="$(dirname $check_dir)" done false From 74165aba4ad500e6467973c5037e1379c55e9560 Mon Sep 17 00:00:00 2001 From: Angelos Orfanakos Date: Fri, 18 Oct 2019 22:56:30 +0300 Subject: [PATCH 124/302] rails: detect gems.rb in _rake_command (#8223) --- plugins/rails/rails.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/rails/rails.plugin.zsh b/plugins/rails/rails.plugin.zsh index a8ec79db2..1fd5f0f86 100644 --- a/plugins/rails/rails.plugin.zsh +++ b/plugins/rails/rails.plugin.zsh @@ -17,7 +17,7 @@ function _rake_command () { bin/stubs/rake $@ elif [ -e "bin/rake" ]; then bin/rake $@ - elif type bundle &> /dev/null && [ -e "Gemfile" ]; then + elif type bundle &> /dev/null && ([ -e "Gemfile" ] || [ -e "gems.rb" ]); then bundle exec rake $@ else command rake $@ From 39a4f9281b5d41736eb37ab535cb81a909e9f4b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Zu=CC=88hlke?= Date: Fri, 18 Oct 2019 23:37:51 +0200 Subject: [PATCH 125/302] Add Readme.md for supervisor. Sync completion with original source. --- plugins/supervisor/README.md | 13 +++++++++++++ plugins/supervisor/_supervisorctl | 7 +++++++ 2 files changed, 20 insertions(+) create mode 100644 plugins/supervisor/README.md diff --git a/plugins/supervisor/README.md b/plugins/supervisor/README.md new file mode 100644 index 000000000..25a04c968 --- /dev/null +++ b/plugins/supervisor/README.md @@ -0,0 +1,13 @@ +# supervisor plugin + +This plugin adds tab-completion for supervisord/supervisorctl in [Supervisor](http://supervisord.org/). + +Supervisor is a client/server system that allows its users to monitor and control a number of processes on UNIX-like operating systems. + +To use it, add `supervisor` to the plugins array in your zshrc file: + +```zsh +plugins=(... supervisor) +``` + +These scripts are from [zshcompfunc4supervisor](https://bitbucket.org/hhatto/zshcompfunc4supervisor). diff --git a/plugins/supervisor/_supervisorctl b/plugins/supervisor/_supervisorctl index d159f20e0..9f576c0c0 100644 --- a/plugins/supervisor/_supervisorctl +++ b/plugins/supervisor/_supervisorctl @@ -112,6 +112,13 @@ _supervisorctl_start() { '*::supvervisor process:_get_supervisor_procs' } +(( $+functions[_supervisorctl_restart] )) || +_supervisorctl_restart() { + # TODO: add 'all' + _arguments -s \ + '*::supvervisor process:_get_supervisor_procs' +} + (( $+functions[_supervisorctl_status] )) || _supervisorctl_status() { _arguments \ From 166719c0abecbcea418f2fc1db2939ed811971d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Zu=CC=88hlke?= Date: Fri, 18 Oct 2019 23:52:26 +0200 Subject: [PATCH 126/302] Format docker Readme like the other plugins. --- plugins/docker/README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugins/docker/README.md b/plugins/docker/README.md index e91798485..f7e5b8fe4 100644 --- a/plugins/docker/README.md +++ b/plugins/docker/README.md @@ -1,5 +1,13 @@ ## Docker autocomplete plugin +This plugin adds auto-completion for docker. + +To use it add `docker` to the plugins array in your zshrc file. + +```zsh +plugins=(... docker) +``` + A copy of the completion script from the [docker/cli](https://github.com/docker/cli/blob/master/contrib/completion/zsh/_docker) git repo. From f48a40ee91b48ca78703395e07aba5b2dd9e3c97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sat, 19 Oct 2019 17:28:43 +0200 Subject: [PATCH 127/302] Reorganize stuff --- plugins/docker/README.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/plugins/docker/README.md b/plugins/docker/README.md index f7e5b8fe4..4d9f3ae9b 100644 --- a/plugins/docker/README.md +++ b/plugins/docker/README.md @@ -1,13 +1,11 @@ -## Docker autocomplete plugin +# Docker plugin -This plugin adds auto-completion for docker. +This plugin adds auto-completion for [docker](https://www.docker.com/). To use it add `docker` to the plugins array in your zshrc file. - ```zsh plugins=(... docker) ``` -A copy of the completion script from the -[docker/cli](https://github.com/docker/cli/blob/master/contrib/completion/zsh/_docker) -git repo. +A copy of the completion script from the docker/cli git repo: +https://github.com/docker/cli/blob/master/contrib/completion/zsh/_docker From 160a801bedc9663db5539d4f663d2c2dbdf6cdcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sat, 19 Oct 2019 17:29:46 +0200 Subject: [PATCH 128/302] Clean up README --- plugins/supervisor/README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/plugins/supervisor/README.md b/plugins/supervisor/README.md index 25a04c968..1eacea6d3 100644 --- a/plugins/supervisor/README.md +++ b/plugins/supervisor/README.md @@ -1,11 +1,10 @@ # supervisor plugin -This plugin adds tab-completion for supervisord/supervisorctl in [Supervisor](http://supervisord.org/). - -Supervisor is a client/server system that allows its users to monitor and control a number of processes on UNIX-like operating systems. +This plugin adds tab-completion for `supervisord`/`supervisorctl` in [Supervisor](http://supervisord.org/). +Supervisor is a client/server system that allows its users to monitor and control a number +of processes on UNIX-like operating systems. To use it, add `supervisor` to the plugins array in your zshrc file: - ```zsh plugins=(... supervisor) ``` From aebf333b0ce05bb6710729180335957ceed80dd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Z=C3=BChlke?= Date: Sat, 19 Oct 2019 17:39:03 +0200 Subject: [PATCH 129/302] magic-enter: update README (#8284) --- plugins/magic-enter/Readme.md | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/plugins/magic-enter/Readme.md b/plugins/magic-enter/Readme.md index b401ab415..78514c67d 100644 --- a/plugins/magic-enter/Readme.md +++ b/plugins/magic-enter/Readme.md @@ -1,14 +1,17 @@ -## Magic Enter +## Magic Enter plugin -**Maintainer:** [@dufferzafar](https://github.com/dufferzafar) +This plugin makes your enter key magical, by binding commonly used commands to it. -Makes your enter key magical, by binding commonly used commands to it. +To use it, add `magic-enter` to the plugins array in your zshrc file. You can set the +commands to be run in your .zshrc, before the line containing plugins. If no command +is specified in a git directory, `git status` is executed; in other directories, `ls`. -You can set the commands to be run in your .zshrc, before the line containing plugins! - -```bash +```zsh +# defaults MAGIC_ENTER_GIT_COMMAND='git status -u .' MAGIC_ENTER_OTHER_COMMAND='ls -lh .' -plugins=(magic-enter) +plugins=(... magic-enter) ``` + +**Maintainer:** [@dufferzafar](https://github.com/dufferzafar) From 05dfd0ae8520e58e852c574f55c83fe6f49fb189 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sat, 19 Oct 2019 17:51:28 +0200 Subject: [PATCH 130/302] cargo: update completion to latest version (cdac4a8) https://github.com/rust-lang/cargo/blob/cdac4a8/src/etc/_cargo --- plugins/cargo/_cargo | 789 ++++++++++++++++++------------------------- 1 file changed, 326 insertions(+), 463 deletions(-) diff --git a/plugins/cargo/_cargo b/plugins/cargo/_cargo index 395c517cd..12694901e 100644 --- a/plugins/cargo/_cargo +++ b/plugins/cargo/_cargo @@ -2,489 +2,367 @@ autoload -U regexp-replace -zstyle -T ':completion:*:*:cargo:*' tag-order && \ - zstyle ':completion:*:*:cargo:*' tag-order 'common-commands' - _cargo() { -local context state state_descr line -typeset -A opt_args + local curcontext="$curcontext" ret=1 + local -a command_scope_spec common parallel features msgfmt triple target registry + local -a state line state_descr # These are set by _arguments + typeset -A opt_args -# leading items in parentheses are an exclusion list for the arguments following that arg -# See: http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Completion-Functions -# - => exclude all other options -# 1 => exclude positional arg 1 -# * => exclude all other args -# +blah => exclude +blah -_arguments \ - '(- 1 *)'{-h,--help}'[show help message]' \ - '(- 1 *)--list[list installed commands]' \ - '(- 1 *)'{-V,--version}'[show version information]' \ - {-v,--verbose}'[use verbose output]' \ - --color'[colorization option]' \ - '(+beta +nightly)+stable[use the stable toolchain]' \ - '(+stable +nightly)+beta[use the beta toolchain]' \ - '(+stable +beta)+nightly[use the nightly toolchain]' \ - '1: :->command' \ - '*:: :->args' + common=( + '(-q --quiet)*'{-v,--verbose}'[use verbose output]' + '(-q --quiet -v --verbose)'{-q,--quiet}'[no output printed to stdout]' + '-Z+[pass unstable (nightly-only) flags to cargo]: :_cargo_unstable_flags' + '--frozen[require that Cargo.lock and cache are up-to-date]' + '--locked[require that Cargo.lock is up-to-date]' + '--color=[specify colorization option]:coloring:(auto always never)' + '(- 1 *)'{-h,--help}'[show help message]' + ) -case $state in - command) - _alternative 'common-commands:common:_cargo_cmds' 'all-commands:all:_cargo_all_cmds' - ;; + # leading items in parentheses are an exclusion list for the arguments following that arg + # See: http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Completion-Functions + # - => exclude all other options + # 1 => exclude positional arg 1 + # * => exclude all other args + # +blah => exclude +blah + _arguments -s -S -C $common \ + '(- 1 *)--list[list installed commands]' \ + '(- 1 *)--explain=[provide a detailed explanation of an error message]:error code' \ + '(- 1 *)'{-V,--version}'[show version information]' \ + '(+beta +nightly)+stable[use the stable toolchain]' \ + '(+stable +nightly)+beta[use the beta toolchain]' \ + '(+stable +beta)+nightly[use the nightly toolchain]' \ + '1: :_cargo_cmds' \ + '*:: :->args' - args) - case $words[1] in - bench) - _arguments \ - '--features=[space separated feature list]' \ - '--all-features[enable all available features]' \ - '(-h, --help)'{-h,--help}'[show help message]' \ - '(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \ - "${command_scope_spec[@]}" \ - '--manifest-path=[path to manifest]: :_files -/' \ - '--no-default-features[do not build the default features]' \ - '--no-run[compile but do not run]' \ - '(-p,--package)'{-p=,--package=}'[package to run benchmarks for]:packages:_get_package_names' \ - '--target=[target triple]' \ - '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ - '--color=:colorization option:(auto always never)' \ - ;; + # These flags are mutually exclusive specifiers for the scope of a command; as + # they are used in multiple places without change, they are expanded into the + # appropriate command's `_arguments` where appropriate. + command_scope_spec=( + '(--bin --example --test --lib)--bench=[specify benchmark name]: :_cargo_benchmark_names' + '(--bench --bin --test --lib)--example=[specify example name]:example name' + '(--bench --example --test --lib)--bin=[specify binary name]:binary name' + '(--bench --bin --example --test)--lib=[specify library name]:library name' + '(--bench --bin --example --lib)--test=[specify test name]:test name' + ) - build) - _arguments \ - '--features=[space separated feature list]' \ - '--all-features[enable all available features]' \ - '(-h, --help)'{-h,--help}'[show help message]' \ - '(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \ - "${command_scope_spec[@]}" \ - '--manifest-path=[path to manifest]: :_files -/' \ - '--no-default-features[do not build the default features]' \ - '(-p,--package)'{-p=,--package=}'[package to build]:packages:_get_package_names' \ - '--release=[build in release mode]' \ - '--target=[target triple]' \ - '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ - '--color=:colorization option:(auto always never)' \ - ;; + parallel=( + '(-j --jobs)'{-j+,--jobs=}'[specify number of parallel jobs]:jobs [# of CPUs]' + ) - check) - _arguments \ - '--features=[space separated feature list]' \ - '--all-features[enable all available features]' \ - '(-h, --help)'{-h,--help}'[show help message]' \ - '(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \ - "${command_scope_spec[@]}" \ - '--manifest-path=[path to manifest]: :_files -/' \ - '--no-default-features[do not check the default features]' \ - '(-p,--package)'{-p=,--package=}'[package to check]:packages:_get_package_names' \ - '--release=[check in release mode]' \ - '--target=[target triple]' \ - '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ - '--color=:colorization option:(auto always never)' \ - ;; + features=( + '(--all-features)--features=[specify features to activate]:feature' + '(--features)--all-features[activate all available features]' + "--no-default-features[don't build the default features]" + ) - clean) - _arguments \ - '(-h, --help)'{-h,--help}'[show help message]' \ - '--manifest-path=[path to manifest]: :_files -/' \ - '(-p,--package)'{-p=,--package=}'[package to clean]:packages:_get_package_names' \ - '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ - '--release[whether or not to clean release artifacts]' \ - '--target=[target triple(default:all)]' \ - '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=:colorization option:(auto always never)' \ - ;; + msgfmt='--message-format=[specify error format]:error format [human]:(human json short)' + triple='--target=[specify target triple]:target triple' + target='--target-dir=[specify directory for all generated artifacts]:directory:_directories' + manifest='--manifest-path=[specify path to manifest]:path:_directories' + registry='--registry=[specify registry to use]:registry' - doc) - _arguments \ - '--features=[space separated feature list]' \ - '--all-features[enable all available features]' \ - '(-h, --help)'{-h,--help}'[show help message]' \ - '(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \ - '--manifest-path=[path to manifest]: :_files -/' \ - '--no-deps[do not build docs for dependencies]' \ - '--no-default-features[do not build the default features]' \ - '--open[open docs in browser after the build]' \ - '(-p, --package)'{-p,--package}'=[package to document]' \ - '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ - '--release[build artifacts in release mode, with optimizations]' \ - '--target=[build for the target triple]' \ - '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=:colorization option:(auto always never)' \ - ;; + case $state in + args) + curcontext="${curcontext%:*}-${words[1]}:" + case ${words[1]} in + bench) + _arguments -s -A "^--" $common $parallel $features $msgfmt $triple $target $manifest \ + "${command_scope_spec[@]}" \ + '--all-targets[benchmark all targets]' \ + "--no-run[compile but don't run]" \ + '(-p --package)'{-p+,--package=}'[specify package to run benchmarks for]:package:_cargo_package_names' \ + '--exclude=[exclude packages from the benchmark]:spec' \ + '--no-fail-fast[run all benchmarks regardless of failure]' \ + '1: :_guard "^-*" "bench name"' \ + '*:args:_default' + ;; - fetch) - _arguments \ - '(-h, --help)'{-h,--help}'[show help message]' \ - '--manifest-path=[path to manifest]: :_files -/' \ - '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ - '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=:colorization option:(auto always never)' \ - ;; + build) + _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \ + '--all-targets[equivalent to specifying --lib --bins --tests --benches --examples]' \ + "${command_scope_spec[@]}" \ + '(-p --package)'{-p+,--package=}'[specify package to build]:package:_cargo_package_names' \ + '--release[build in release mode]' \ + '--build-plan[output the build plan in JSON]' \ + ;; - generate-lockfile) - _arguments \ - '(-h, --help)'{-h,--help}'[show help message]' \ - '--manifest-path=[path to manifest]: :_files -/' \ - '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ - '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=:colorization option:(auto always never)' \ - ;; + check) + _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \ + '--all-targets[equivalent to specifying --lib --bins --tests --benches --examples]' \ + "${command_scope_spec[@]}" \ + '(-p --package)'{-p+,--package=}'[specify package to check]:package:_cargo_package_names' \ + '--release[check in release mode]' \ + ;; - git-checkout) - _arguments \ - '(-h, --help)'{-h,--help}'[show help message]' \ - '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ - '--reference=[REF]' \ - '--url=[URL]' \ - '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=:colorization option:(auto always never)' \ - ;; + clean) + _arguments -s -S $common $triple $target $manifest \ + '(-p --package)'{-p+,--package=}'[specify package to clean]:package:_cargo_package_names' \ + '--release[clean release artifacts]' \ + '--doc[clean just the documentation directory]' + ;; - help) - _arguments \ - '(-h, --help)'{-h,--help}'[show help message]' \ - '*: :_cargo_cmds' \ - ;; + doc) + _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \ + '--no-deps[do not build docs for dependencies]' \ + '--document-private-items[include non-public items in the documentation]' \ + '--open[open docs in browser after the build]' \ + '(-p --package)'{-p+,--package=}'[specify package to document]:package:_cargo_package_names' \ + '--release[build artifacts in release mode, with optimizations]' \ + ;; - init) - _arguments \ - '--bin[use binary template]' \ - '--vcs:initialize a new repo with a given VCS:(git hg none)' \ - '(-h, --help)'{-h,--help}'[show help message]' \ - '--name=[set the resulting package name]' \ - '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ - '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=:colorization option:(auto always never)' \ - ;; + fetch) + _arguments -s -S $common $triple $manifest + ;; - install) - _arguments \ - '--bin=[only install the specified binary]' \ - '--branch=[branch to use when installing from git]' \ - '--color=:colorization option:(auto always never)' \ - '--debug[build in debug mode instead of release mode]' \ - '--example[install the specified example instead of binaries]' \ - '--features=[space separated feature list]' \ - '--all-features[enable all available features]' \ - '--git=[URL from which to install the crate]' \ - '(-h, --help)'{-h,--help}'[show help message]' \ - '(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \ - '--no-default-features[do not build the default features]' \ - '--path=[local filesystem path to crate to install]: :_files -/' \ - '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ - '--rev=[specific commit to use when installing from git]' \ - '--root=[directory to install packages into]: :_files -/' \ - '--tag=[tag to use when installing from git]' \ - '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--vers=[version to install from crates.io]' \ - ;; + fix) + _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \ + "${command_scope_spec[@]}" \ + '--broken-code[fix code even if it already has compiler errors]' \ + '--edition[fix in preparation for the next edition]' \ + '--edition-idioms[fix warnings to migrate to the idioms of an edition]' \ + '--allow-no-vcs[fix code even if a VCS was not detected]' \ + '--allow-dirty[fix code even if the working directory is dirty]' \ + '--allow-staged[fix code even if the working directory has staged changes]' + ;; - locate-project) - _arguments \ - '(-h, --help)'{-h,--help}'[show help message]' \ - '--manifest-path=[path to manifest]: :_files -/' \ - ;; + generate-lockfile) + _arguments -s -S $common $manifest + ;; - login) - _arguments \ - '(-h, --help)'{-h,--help}'[show help message]' \ - '--host=[Host to set the token for]' \ - '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ - '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=:colorization option:(auto always never)' \ - ;; + git-checkout) + _arguments -s -S $common \ + '--reference=:reference' \ + '--url=:url:_urls' + ;; - metadata) - _arguments \ - '(-h, --help)'{-h,--help}'[show help message]' \ - '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ - '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - "--no-deps[output information only about the root package and don't fetch dependencies]" \ - '--no-default-features[do not include the default feature]' \ - '--manifest-path=[path to manifest]: :_files -/' \ - '--features=[space separated feature list]' \ - '--all-features[enable all available features]' \ - '--format-version=[format version(default: 1)]' \ - '--color=:colorization option:(auto always never)' \ - ;; + help) + _cargo_cmds + ;; - new) - _arguments \ - '--bin[use binary template]' \ - '--vcs:initialize a new repo with a given VCS:(git hg none)' \ - '(-h, --help)'{-h,--help}'[show help message]' \ - '--name=[set the resulting package name]' \ - '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ - '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=:colorization option:(auto always never)' \ - ;; + init) + _arguments -s -S $common $registry \ + '--lib[use library template]' \ + '--edition=[specify edition to set for the crate generated]:edition:(2015 2018)' \ + '--vcs=[initialize a new repo with a given VCS]:vcs:(git hg pijul fossil none)' \ + '--name=[set the resulting package name]:name' \ + '1:path:_directories' + ;; - owner) - _arguments \ - '(-a, --add)'{-a,--add}'[add owner LOGIN]' \ - '(-h, --help)'{-h,--help}'[show help message]' \ - '--index[registry index]' \ - '(-l, --list)'{-l,--list}'[list owners of a crate]' \ - '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ - '(-r, --remove)'{-r,--remove}'[remove owner LOGIN]' \ - '--token[API token to use when authenticating]' \ - '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=:colorization option:(auto always never)' \ - ;; + install) + _arguments -s -S $common $parallel $features $triple $registry \ + '(-f --force)'{-f,--force}'[force overwriting of existing crates or binaries]' \ + '--bin=[only install the specified binary]:binary' \ + '--branch=[branch to use when installing from git]:branch' \ + '--debug[build in debug mode instead of release mode]' \ + '--example=[install the specified example instead of binaries]:example' \ + '--git=[specify URL from which to install the crate]:url:_urls' \ + '--path=[local filesystem path to crate to install]: :_directories' \ + '--rev=[specific commit to use when installing from git]:commit' \ + '--root=[directory to install packages into]: :_directories' \ + '--tag=[tag to use when installing from git]:tag' \ + '--vers=[version to install from crates.io]:version' \ + '--list[list all installed packages and their versions]' \ + '*: :_guard "^-*" "crate"' + ;; - package) - _arguments \ - '(-h, --help)'{-h,--help}'[show help message]' \ - '(-l, --list)'{-l,--list}'[print files included in a package without making one]' \ - '--manifest-path=[path to manifest]: :_files -/' \ - '--no-metadata[ignore warnings about a lack of human-usable metadata]' \ - '--no-verify[do not build to verify contents]' \ - '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ - '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=:colorization option:(auto always never)' \ - ;; + locate-project) + _arguments -s -S $common $manifest + ;; - pkgid) - _arguments \ - '(-h, --help)'{-h,--help}'[show help message]' \ - '--manifest-path=[path to manifest]: :_files -/' \ - '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ - '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=:colorization option:(auto always never)' \ - ;; + login) + _arguments -s -S $common $registry \ + '*: :_guard "^-*" "token"' + ;; - publish) - _arguments \ - '(-h, --help)'{-h,--help}'[show help message]' \ - '--host=[Host to set the token for]' \ - '--manifest-path=[path to manifest]: :_files -/' \ - '--no-verify[Do not verify tarball until before publish]' \ - '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ - '--token[token to use when uploading]' \ - '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=:colorization option:(auto always never)' \ - ;; + metadata) + _arguments -s -S $common $features $manifest \ + "--no-deps[output information only about the root package and don't fetch dependencies]" \ + '--format-version=[specify format version]:version [1]:(1)' + ;; - read-manifest) - _arguments \ - '(-h, --help)'{-h,--help}'[show help message]' \ - '--manifest-path=[path to manifest]: :_files -/' \ - '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=:colorization option:(auto always never)' \ - ;; + new) + _arguments -s -S $common $registry \ + '--lib[use library template]' \ + '--vcs:initialize a new repo with a given VCS:(git hg none)' \ + '--name=[set the resulting package name]' + ;; - run) - _arguments \ - '--example=[name of the bin target]' \ - '--features=[space separated feature list]' \ - '--all-features[enable all available features]' \ - '(-h, --help)'{-h,--help}'[show help message]' \ - '(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \ - '--manifest-path=[path to manifest]: :_files -/' \ - '--bin=[name of the bin target]' \ - '--no-default-features[do not build the default features]' \ - '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ - '--release=[build in release mode]' \ - '--target=[target triple]' \ - '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=:colorization option:(auto always never)' \ - '*: :_normal' \ - ;; + owner) + _arguments -s -S $common $registry \ + '(-a --add)'{-a,--add}'[specify name of a user or team to invite as an owner]:name' \ + '--index=[specify registry index]:index' \ + '(-l --list)'{-l,--list}'[list owners of a crate]' \ + '(-r --remove)'{-r,--remove}'[specify name of a user or team to remove as an owner]:name' \ + '--token=[specify API token to use when authenticating]:token' \ + '*: :_guard "^-*" "crate"' + ;; - rustc) - _arguments \ - '--color=:colorization option:(auto always never)' \ - '--features=[features to compile for the package]' \ - '--all-features[enable all available features]' \ - '(-h, --help)'{-h,--help}'[show help message]' \ - '(-j, --jobs)'{-j,--jobs}'=[number of parallel jobs, defaults to # of CPUs]' \ - '--manifest-path=[path to the manifest to fetch dependencies for]: :_files -/' \ - '--no-default-features[do not compile default features for the package]' \ - '(-p, --package)'{-p,--package}'=[profile to compile for]' \ - '--profile=[profile to build the selected target for]' \ - '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ - '--release[build artifacts in release mode, with optimizations]' \ - '--target=[target triple which compiles will be for]' \ - '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - "${command_scope_spec[@]}" \ - ;; + package) + _arguments -s -S $common $parallel $features $triple $target $manifest \ + '(-l --list)'{-l,--list}'[print files included in a package without making one]' \ + '--no-metadata[ignore warnings about a lack of human-usable metadata]' \ + '--allow-dirty[allow dirty working directories to be packaged]' \ + "--no-verify[don't build to verify contents]" + ;; - rustdoc) - _arguments \ - '--color=:colorization option:(auto always never)' \ - '--features=[space-separated list of features to also build]' \ - '--all-features[enable all available features]' \ - '(-h, --help)'{-h,--help}'[show help message]' \ - '(-j, --jobs)'{-j,--jobs}'=[number of parallel jobs, defaults to # of CPUs]' \ - '--manifest-path=[path to the manifest to document]: :_files -/' \ - '--no-default-features[do not build the `default` feature]' \ - '--open[open the docs in a browser after the operation]' \ - '(-p, --package)'{-p,--package}'=[package to document]' \ - '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ - '--release[build artifacts in release mode, with optimizations]' \ - '--target=[build for the target triple]' \ - '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - "${command_scope_spec[@]}" \ - ;; + pkgid) + _arguments -s -S $common $manifest \ + '(-p --package)'{-p+,--package=}'[specify package to get ID specifier for]:package:_cargo_package_names' \ + '*: :_guard "^-*" "spec"' + ;; - search) - _arguments \ - '--color=:colorization option:(auto always never)' \ - '(-h, --help)'{-h,--help}'[show help message]' \ - '--host=[host of a registry to search in]' \ - '--limit=[limit the number of results]' \ - '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ - '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - ;; + publish) + _arguments -s -S $common $parallel $features $triple $target $manifest $registry \ + '--index=[specify registry index]:index' \ + '--allow-dirty[allow dirty working directories to be packaged]' \ + "--no-verify[don't verify the contents by building them]" \ + '--token=[specify token to use when uploading]:token' \ + '--dry-run[perform all checks without uploading]' + ;; - test) - _arguments \ - '--features=[space separated feature list]' \ - '--all-features[enable all available features]' \ - '(-h, --help)'{-h,--help}'[show help message]' \ - '(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \ - '--manifest-path=[path to manifest]: :_files -/' \ - '--test=[test name]: :_test_names' \ - '--no-default-features[do not build the default features]' \ - '--no-fail-fast[run all tests regardless of failure]' \ - '--no-run[compile but do not run]' \ - '(-p,--package)'{-p=,--package=}'[package to run tests for]:packages:_get_package_names' \ - '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ - '--release[build artifacts in release mode, with optimizations]' \ - '--target=[target triple]' \ - '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=:colorization option:(auto always never)' \ - '1: :_test_names' \ - '(--doc --bin --example --test --bench)--lib[only test library]' \ - '(--lib --bin --example --test --bench)--doc[only test documentation]' \ - '(--lib --doc --example --test --bench)--bin=[binary name]' \ - '(--lib --doc --bin --test --bench)--example=[example name]' \ - '(--lib --doc --bin --example --bench)--test=[test name]' \ - '(--lib --doc --bin --example --test)--bench=[benchmark name]' \ - '--message-format:error format:(human json short)' \ - '--frozen[require lock and cache up to date]' \ - '--locked[require lock up to date]' - ;; + read-manifest) + _arguments -s -S $common $manifest + ;; - uninstall) - _arguments \ - '--bin=[only uninstall the binary NAME]' \ - '--color=:colorization option:(auto always never)' \ - '(-h, --help)'{-h,--help}'[show help message]' \ - '(-q, --quiet)'{-q,--quiet}'[less output printed to stdout]' \ - '--root=[directory to uninstall packages from]: :_files -/' \ - '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - ;; + run) + _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \ + '--example=[name of the bin target]:name' \ + '--bin=[name of the bin target]:name' \ + '(-p --package)'{-p+,--package=}'[specify package with the target to run]:package:_cargo_package_names' \ + '--release[build in release mode]' \ + '*: :_default' + ;; - update) - _arguments \ - '--aggressive=[force dependency update]' \ - '(-h, --help)'{-h,--help}'[show help message]' \ - '--manifest-path=[path to manifest]: :_files -/' \ - '(-p,--package)'{-p=,--package=}'[package to update]:packages:__get_package_names' \ - '--precise=[update single dependency to PRECISE]: :' \ - '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ - '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=:colorization option:(auto always never)' \ - ;; + rustc) + _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \ + '(-p --package)'{-p+,--package=}'[specify package to build]:package:_cargo_package_names' \ + '--profile=[specify profile to build the selected target for]:profile' \ + '--release[build artifacts in release mode, with optimizations]' \ + "${command_scope_spec[@]}" \ + '*: : _dispatch rustc rustc -default-' + ;; - verify-project) - _arguments \ - '(-h, --help)'{-h,--help}'[show help message]' \ - '--manifest-path=[path to manifest]: :_files -/' \ - '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ - '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=:colorization option:(auto always never)' \ - ;; + rustdoc) + _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \ + '--document-private-items[include non-public items in the documentation]' \ + '--open[open the docs in a browser after the operation]' \ + '(-p --package)'{-p+,--package=}'[specify package to document]:package:_cargo_package_names' \ + '--release[build artifacts in release mode, with optimizations]' \ + "${command_scope_spec[@]}" \ + '*: : _dispatch rustdoc rustdoc -default-' + ;; - version) - _arguments \ - '(-h, --help)'{-h,--help}'[show help message]' \ - '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=:colorization option:(auto always never)' \ - ;; + search) + _arguments -s -S $common $registry \ + '--index=[specify registry index]:index' \ + '--limit=[limit the number of results]:results [10]' \ + '*: :_guard "^-*" "query"' + ;; - yank) - _arguments \ - '(-h, --help)'{-h,--help}'[show help message]' \ - '--index[registry index]' \ - '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ - '--token[API token to use when authenticating]' \ - '--undo[undo a yank, putting a version back into the index]' \ - '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ - '--color=:colorization option:(auto always never)' \ - '--vers[yank version]' \ - ;; - esac - ;; -esac + test) + _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \ + '--test=[test name]: :_cargo_test_names' \ + '--no-fail-fast[run all tests regardless of failure]' \ + '--no-run[compile but do not run]' \ + '(-p --package)'{-p+,--package=}'[package to run tests for]:package:_cargo_package_names' \ + '--all[test all packages in the workspace]' \ + '--release[build artifacts in release mode, with optimizations]' \ + '1: :_cargo_test_names' \ + '(--doc --bin --example --test --bench)--lib[only test library]' \ + '(--lib --bin --example --test --bench)--doc[only test documentation]' \ + '(--lib --doc --example --test --bench)--bin=[binary name]' \ + '(--lib --doc --bin --test --bench)--example=[example name]' \ + '(--lib --doc --bin --example --bench)--test=[test name]' \ + '(--lib --doc --bin --example --test)--bench=[benchmark name]' \ + '*: :_default' + ;; + + uninstall) + _arguments -s -S $common \ + '(-p --package)'{-p+,--package=}'[specify package to uninstall]:package:_cargo_package_names' \ + '--bin=[only uninstall the specified binary]:name' \ + '--root=[directory to uninstall packages from]: :_files -/' \ + '*:crate:_cargo_installed_crates -F line' + ;; + + update) + _arguments -s -S $common $manifest \ + '--aggressive=[force dependency update]' \ + "--dry-run[don't actually write the lockfile]" \ + '(-p --package)'{-p+,--package=}'[specify package to update]:package:_cargo_package_names' \ + '--precise=[update single dependency to precise release]:release' + ;; + + verify-project) + _arguments -s -S $common $manifest + ;; + + version) + _arguments -s -S $common + ;; + + yank) + _arguments -s -S $common $registry \ + '--vers=[specify yank version]:version' \ + '--undo[undo a yank, putting a version back into the index]' \ + '--index=[specify registry index to yank from]:registry index' \ + '--token=[specify API token to use when authenticating]:token' \ + '*: :_guard "^-*" "crate"' + ;; + *) + # allow plugins to define their own functions + if ! _call_function ret _cargo-${words[1]}; then + # fallback on default completion for unknown commands + _default && ret=0 + fi + (( ! ret )) + ;; + esac + ;; + esac } -_cargo_cmds(){ -local -a commands;commands=( -'bench:execute all benchmarks of a local package' -'build:compile the current package' -'check:check the current package without compiling' -'clean:remove generated artifacts' -'doc:build package documentation' -'fetch:fetch package dependencies' -'generate-lockfile:create lockfile' -'git-checkout:git checkout' -'help:get help for commands' -'init:create new package in current directory' -'install:install a Rust binary' -'locate-project:print "Cargo.toml" location' -'login:login to remote server' -'metadata:the metadata for a package in json' -'new:create a new package' -'owner:manage the owners of a crate on the registry' -'package:assemble local package into a distributable tarball' -'pkgid:print a fully qualified package specification' -'publish:upload package to the registry' -'read-manifest:print manifest in JSON format' -'run:run the main binary of the local package' -'rustc:compile a package and all of its dependencies' -'rustdoc:build documentation for a package' -'search:search packages on crates.io' -'test:execute all unit and tests of a local package' -'uninstall:remove a Rust binary' -'update:update dependencies' -'verify-project:check Cargo.toml' -'version:show version information' -'yank:remove pushed file from index' -) -_describe -t common-commands 'common commands' commands +_cargo_unstable_flags() { + local flags + flags=( help ${${${(M)${(f)"$(_call_program flags cargo -Z help)"}:#*--*}/ #-- #/:}##*-Z } ) + _describe -t flags 'unstable flag' flags } -_cargo_all_cmds(){ -local -a commands;commands=($(cargo --list)) -_describe -t all-commands 'all commands' commands +_cargo_installed_crates() { + local expl + _description crates expl 'crate' + compadd "$@" "$expl[@]" - ${${${(f)"$(cargo install --list)"}:# *}%% *} +} + +_cargo_cmds() { + local -a commands + # This uses Parameter Expansion Flags, which are a built-in Zsh feature. + # See more: http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion-Flags + # and http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion + # + # # How this work? + # + # First it splits the result of `cargo --list` at newline, then it removes the first line. + # Then it removes indentation (4 whitespaces) before each items. (Note the x## pattern [1]). + # Then it replaces those spaces between item and description with a `:` + # + # [1]: https://github.com/zsh-users/zsh-completions/blob/master/zsh-completions-howto.org#patterns + commands=( ${${${(M)"${(f)$(_call_program commands cargo --list)}":# *}/ ##/}/ ##/:} ) + _describe -t commands 'command' commands } #FIXME: Disabled until fixed #gets package names from the manifest file -_get_package_names() -{ -} - -#TODO:see if it makes sense to have 'locate-project' to have non-json output. -#strips package name from json stuff -_locate_manifest(){ -local manifest=`cargo locate-project 2>/dev/null` -regexp-replace manifest '\{"root":"|"\}' '' -echo $manifest +_cargo_package_names() { + _message -e packages package } # Extracts the values of "name" from the array given in $1 and shows them as # command line options for completion -_get_names_from_array() -{ - local -a filelist; - local manifest=$(_locate_manifest) +_cargo_names_from_array() { + # strip json from the path + local manifest=${${${"$(cargo locate-project)"}%\"\}}##*\"} if [[ -z $manifest ]]; then return 0 fi @@ -494,51 +372,36 @@ _get_names_from_array() local in_block=false local block_name=$1 names=() - while read line - do + while read -r line; do if [[ $last_line == "[[$block_name]]" ]]; then in_block=true else - if [[ $last_line =~ '.*\[\[.*' ]]; then + if [[ $last_line =~ '\s*\[\[.*' ]]; then in_block=false fi fi if [[ $in_block == true ]]; then - if [[ $line =~ '.*name.*=' ]]; then - regexp-replace line '^.*name *= *|"' "" - names+=$line + if [[ $line =~ '\s*name\s*=' ]]; then + regexp-replace line '^\s*name\s*=\s*|"' '' + names+=( "$line" ) fi fi last_line=$line - done < $manifest - _describe $block_name names + done < "$manifest" + _describe "$block_name" names } #Gets the test names from the manifest file -_test_names() -{ - _get_names_from_array "test" +_cargo_test_names() { + _cargo_names_from_array "test" } #Gets the bench names from the manifest file -_benchmark_names() -{ - _get_names_from_array "bench" +_cargo_benchmark_names() { + _cargo_names_from_array "bench" } -# These flags are mutually exclusive specifiers for the scope of a command; as -# they are used in multiple places without change, they are expanded into the -# appropriate command's `_arguments` where appropriate. -set command_scope_spec -command_scope_spec=( - '(--bin --example --test --lib)--bench=[benchmark name]: :_benchmark_names' - '(--bench --bin --test --lib)--example=[example name]' - '(--bench --example --test --lib)--bin=[binary name]' - '(--bench --bin --example --test)--lib=[library name]' - '(--bench --bin --example --lib)--test=[test name]' -) - _cargo From 090ab73daa587cd592bbd03445223bc570f91367 Mon Sep 17 00:00:00 2001 From: Netoun Date: Sun, 20 Oct 2019 19:19:58 +0200 Subject: [PATCH 131/302] safe-paste: add README (#8292) --- plugins/safe-paste/README.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 plugins/safe-paste/README.md diff --git a/plugins/safe-paste/README.md b/plugins/safe-paste/README.md new file mode 100644 index 000000000..a2e7ddbfc --- /dev/null +++ b/plugins/safe-paste/README.md @@ -0,0 +1,9 @@ +# safe-paste + +Preventing any code from actually running while pasting, so you have a chance to review what was actually pasted before running it. + +To use it, add `safe-paste` to the plugins array in your zshrc file: + +```zsh +plugins=(... safe-paste) +``` From a7c740b1d7d0033c6de118439c7935962b2a5c2a Mon Sep 17 00:00:00 2001 From: Kenny Heaton Date: Sun, 20 Oct 2019 13:16:37 -0500 Subject: [PATCH 132/302] rbenv: add README (#8293) --- plugins/rbenv/README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 plugins/rbenv/README.md diff --git a/plugins/rbenv/README.md b/plugins/rbenv/README.md new file mode 100644 index 000000000..43a2e93ac --- /dev/null +++ b/plugins/rbenv/README.md @@ -0,0 +1,26 @@ +# rbenv plugin + +The primary job of this plugin is to provide `rbenv_prompt_info` which can be added to your theme to include Ruby +version and gemset information into your prompt. + +Some functionality of this plugin will not work unless you also have the rbenv plugin *gemset* installed. +https://github.com/jf/rbenv-gemset + +To use it, add `rbenv` to the plugins array in your zshrc file: +```zsh +plugins=(... rbenv) +``` + +## Alias + +| Alias | Command | Description | +|----------------|---------------------|----------------------------------| +| rubies | `rbenv versions` | List the installed Ruby versions | +| gemsets | `rbenv gemset list` | List the existing gemsets | + +## Functions + +* `current_ruby`: The version of Ruby currently being used. +* `current_gemset`: The name of the current gemset. +* `gems`: Lists installed gems with enhanced formatting and color. +* `rbenv_prompt_info`: For adding information to your prompt. Format: `@`. From 534ec60bfd14ee640076c7594ee4fa723fafd1b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Mon, 21 Oct 2019 16:42:06 +0200 Subject: [PATCH 133/302] Set default git-config values known to fix repository issues - core.autocrlf=false -> #4069 - fsck.zeroPaddedFilemode -> #4963 Fixes #4069 Fixes #4963 --- tools/install.sh | 6 +++++- tools/upgrade.sh | 12 +++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/tools/install.sh b/tools/install.sh index 61010214e..a5a90e6f6 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -90,7 +90,11 @@ setup_ohmyzsh() { exit 1 fi - git clone --depth=1 --branch "$BRANCH" "$REMOTE" "$ZSH" || { + git clone -c core.eol=lf -c core.autocrlf=false \ + -c fsck.zeroPaddedFilemode=ignore \ + -c fetch.fsck.zeroPaddedFilemode=ignore \ + -c receive.fsck.zeroPaddedFilemode=ignore \ + --depth=1 --branch "$BRANCH" "$REMOTE" "$ZSH" || { error "git clone of oh-my-zsh repo failed" exit 1 } diff --git a/tools/upgrade.sh b/tools/upgrade.sh index d234c7f88..0dd855b70 100644 --- a/tools/upgrade.sh +++ b/tools/upgrade.sh @@ -20,8 +20,18 @@ else NORMAL="" fi -printf "${BLUE}%s${NORMAL}\n" "Updating Oh My Zsh" cd "$ZSH" + +# Set git-config values known to fix git errors +# Line endings (#4069) +git config core.eol lf +git config core.autocrlf false +# zeroPaddedFilemode fsck errors (#4963) +git config fsck.zeroPaddedFilemode ignore +git config fetch.fsck.zeroPaddedFilemode ignore +git config receive.fsck.zeroPaddedFilemode ignore + +printf "${BLUE}%s${NORMAL}\n" "Updating Oh My Zsh" if git pull --rebase --stat origin master then printf '%s' "$GREEN" From 40df67bc3b9b51caa24df5d220487043040d1f9a Mon Sep 17 00:00:00 2001 From: Tim <0xTim@users.noreply.github.com> Date: Tue, 22 Oct 2019 17:24:05 +0100 Subject: [PATCH 134/302] swiftpm: update completion for Swift 5.1 (#8248) --- plugins/swiftpm/README.md | 2 +- plugins/swiftpm/_swift | 234 ++++++++++++++++++++------------------ 2 files changed, 122 insertions(+), 114 deletions(-) diff --git a/plugins/swiftpm/README.md b/plugins/swiftpm/README.md index 291458511..a722c03e4 100644 --- a/plugins/swiftpm/README.md +++ b/plugins/swiftpm/README.md @@ -2,7 +2,7 @@ ## Description -This plugin provides a few utilities that make you faster on your daily work with the [Swift Package Manager](https://github.com/apple/swift-package-manager), as well as autocompletion for Swift 5.0. +This plugin provides a few utilities that make you faster on your daily work with the [Swift Package Manager](https://github.com/apple/swift-package-manager), as well as autocompletion for Swift 5.1. To start using it, add the `swiftpm` plugin to your `plugins` array in `~/.zshrc`: diff --git a/plugins/swiftpm/_swift b/plugins/swiftpm/_swift index 1366b4d9c..fe6f1c9aa 100644 --- a/plugins/swiftpm/_swift +++ b/plugins/swiftpm/_swift @@ -82,13 +82,15 @@ _swift_build() { "(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]" "--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]" "--static-swift-stdlib[Link Swift stdlib statically]" - "--enable-llbuild-library[Enable building with the llbuild library]" "--force-resolved-versions[]" "--disable-automatic-resolution[Disable automatic resolution if Package.resolved file is out-of-date]" "--enable-index-store[Enable indexing-while-building feature]" "--disable-index-store[Disable indexing-while-building feature]" "--enable-pubgrub-resolver[\[Experimental\] Enable the new Pubgrub dependency resolver]" "--enable-parseable-module-interfaces[]" + "--trace-resolver[]" + "(--jobs -j)"{--jobs,-j}"[The number of jobs to spawn in parallel during the build process]:The number of jobs to spawn in parallel during the build process: " + "--enable-test-discovery[Enable test discovery on platforms without Objective-C runtime]" "--build-tests[Build both source and test targets]" "--product[Build the specified product]:Build the specified product: " "--target[Build the specified target]:Build the specified target: " @@ -125,13 +127,15 @@ _swift_run() { "(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]" "--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]" "--static-swift-stdlib[Link Swift stdlib statically]" - "--enable-llbuild-library[Enable building with the llbuild library]" "--force-resolved-versions[]" "--disable-automatic-resolution[Disable automatic resolution if Package.resolved file is out-of-date]" "--enable-index-store[Enable indexing-while-building feature]" "--disable-index-store[Disable indexing-while-building feature]" "--enable-pubgrub-resolver[\[Experimental\] Enable the new Pubgrub dependency resolver]" "--enable-parseable-module-interfaces[]" + "--trace-resolver[]" + "(--jobs -j)"{--jobs,-j}"[The number of jobs to spawn in parallel during the build process]:The number of jobs to spawn in parallel during the build process: " + "--enable-test-discovery[Enable test discovery on platforms without Objective-C runtime]" "--skip-build[Skip building the executable product]" "--build-tests[Build both source and test targets]" "--repl[Launch Swift REPL for the package]" @@ -166,13 +170,15 @@ _swift_package() { "(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]" "--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]" "--static-swift-stdlib[Link Swift stdlib statically]" - "--enable-llbuild-library[Enable building with the llbuild library]" "--force-resolved-versions[]" "--disable-automatic-resolution[Disable automatic resolution if Package.resolved file is out-of-date]" "--enable-index-store[Enable indexing-while-building feature]" "--disable-index-store[Disable indexing-while-building feature]" "--enable-pubgrub-resolver[\[Experimental\] Enable the new Pubgrub dependency resolver]" "--enable-parseable-module-interfaces[]" + "--trace-resolver[]" + "(--jobs -j)"{--jobs,-j}"[The number of jobs to spawn in parallel during the build process]:The number of jobs to spawn in parallel during the build process: " + "--enable-test-discovery[Enable test discovery on platforms without Objective-C runtime]" '(-): :->command' '(-)*:: :->arg' ) @@ -181,49 +187,61 @@ _swift_package() { (command) local modes modes=( - 'update:Update package dependencies' - 'describe:Describe the current package' - 'resolve:Resolve package dependencies' - 'tools-version:Manipulate tools version of the current package' - 'unedit:Remove a package from editable mode' - 'show-dependencies:Print the resolved dependency graph' - 'fetch:' + 'completion-tool:Completion tool (for shell completions)' 'dump-package:Print parsed Package.swift as JSON' + 'describe:Describe the current package' + 'clean:Delete build artifacts' + 'show-dependencies:Print the resolved dependency graph' + 'init:Initialize a new package' + 'unedit:Remove a package from editable mode' + 'tools-version:Manipulate tools version of the current package' + 'fetch:' + 'resolve:Resolve package dependencies' + 'reset:Reset the complete cache/build directory' + 'generate-xcodeproj:Generates an Xcode project' 'edit:Put a package in editable mode' 'config:Manipulate configuration of the package' - 'completion-tool:Completion tool (for shell completions)' - 'clean:Delete build artifacts' - 'generate-xcodeproj:Generates an Xcode project' - 'reset:Reset the complete cache/build directory' - 'init:Initialize a new package' + 'update:Update package dependencies' ) _describe "mode" modes ;; (arg) case ${words[1]} in - (update) - _swift_package_update + (completion-tool) + _swift_package_completion-tool + ;; + (dump-package) + _swift_package_dump-package ;; (describe) _swift_package_describe ;; - (resolve) - _swift_package_resolve - ;; - (tools-version) - _swift_package_tools-version - ;; - (unedit) - _swift_package_unedit + (clean) + _swift_package_clean ;; (show-dependencies) _swift_package_show-dependencies ;; + (init) + _swift_package_init + ;; + (unedit) + _swift_package_unedit + ;; + (tools-version) + _swift_package_tools-version + ;; (fetch) _swift_package_fetch ;; - (dump-package) - _swift_package_dump-package + (resolve) + _swift_package_resolve + ;; + (reset) + _swift_package_reset + ;; + (generate-xcodeproj) + _swift_package_generate-xcodeproj ;; (edit) _swift_package_edit @@ -231,27 +249,22 @@ _swift_package() { (config) _swift_package_config ;; - (completion-tool) - _swift_package_completion-tool - ;; - (clean) - _swift_package_clean - ;; - (generate-xcodeproj) - _swift_package_generate-xcodeproj - ;; - (reset) - _swift_package_reset - ;; - (init) - _swift_package_init + (update) + _swift_package_update ;; esac ;; esac } -_swift_package_update() { +_swift_package_completion-tool() { + arguments=( + ": :{_values '' 'generate-bash-script[generate Bash completion script]' 'generate-zsh-script[generate Bash completion script]' 'list-dependencies[list all dependencies' names]' 'list-executables[list all executables' names]'}" + ) + _arguments $arguments && return +} + +_swift_package_dump-package() { arguments=( ) _arguments $arguments && return @@ -264,6 +277,49 @@ _swift_package_describe() { _arguments $arguments && return } +_swift_package_clean() { + arguments=( + ) + _arguments $arguments && return +} + +_swift_package_show-dependencies() { + arguments=( + "--format[text|dot|json|flatlist]: :{_values '' 'text[list dependencies using text format]' 'dot[list dependencies using dot format]' 'json[list dependencies using JSON format]'}" + ) + _arguments $arguments && return +} + +_swift_package_init() { + arguments=( + "--type[empty|library|executable|system-module|manifest]: :{_values '' 'empty[generates an empty project]' 'library[generates project for a dynamic library]' 'executable[generates a project for a cli executable]' 'system-module[generates a project for a system module]'}" + "--name[Provide custom package name]:Provide custom package name: " + ) + _arguments $arguments && return +} + +_swift_package_unedit() { + arguments=( + ":The name of the package to unedit:_swift_dependency" + "--force[Unedit the package even if it has uncommited and unpushed changes.]" + ) + _arguments $arguments && return +} + +_swift_package_tools-version() { + arguments=( + "--set[Set tools version of package to the given value]:Set tools version of package to the given value: " + "--set-current[Set tools version of package to the current tools version in use]" + ) + _arguments $arguments && return +} + +_swift_package_fetch() { + arguments=( + ) + _arguments $arguments && return +} + _swift_package_resolve() { arguments=( ":The name of the package to resolve:_swift_dependency" @@ -274,37 +330,20 @@ _swift_package_resolve() { _arguments $arguments && return } -_swift_package_tools-version() { - arguments=( - "--set[Set tools version of package to the given value]:Set tools version of package to the given value: " - "--set-current[Set tools version of package to the current tools version in use]" - ) - _arguments $arguments && return -} - -_swift_package_unedit() { - arguments=( - ":The name of the package to unedit:_swift_dependency" - "--force[Unedit the package even if it has uncommited and unpushed changes.]" - ) - _arguments $arguments && return -} - -_swift_package_show-dependencies() { - arguments=( - "--format[text|dot|json|flatlist]: :{_values '' 'text[list dependencies using text format]' 'dot[list dependencies using dot format]' 'json[list dependencies using JSON format]'}" - ) - _arguments $arguments && return -} - -_swift_package_fetch() { +_swift_package_reset() { arguments=( ) _arguments $arguments && return } -_swift_package_dump-package() { +_swift_package_generate-xcodeproj() { arguments=( + "--xcconfig-overrides[Path to xcconfig file]:Path to xcconfig file:_files" + "--enable-code-coverage[Enable code coverage in the generated project]" + "--output[Path where the Xcode project should be generated]:Path where the Xcode project should be generated:_files" + "--legacy-scheme-generator[Use the legacy scheme generator]" + "--watch[Watch for changes to the Package manifest to regenerate the Xcode project]" + "--skip-extra-files[Do not add file references for extra files to the generated Xcode project]" ) _arguments $arguments && return } @@ -330,8 +369,8 @@ _swift_package_config() { local modes modes=( 'unset-mirror:Remove an existing mirror' - 'set-mirror:Set a mirror for a dependency' 'get-mirror:Print mirror configuration for the given package dependency' + 'set-mirror:Set a mirror for a dependency' ) _describe "mode" modes ;; @@ -340,12 +379,12 @@ _swift_package_config() { (unset-mirror) _swift_package_config_unset-mirror ;; - (set-mirror) - _swift_package_config_set-mirror - ;; (get-mirror) _swift_package_config_get-mirror ;; + (set-mirror) + _swift_package_config_set-mirror + ;; esac ;; esac @@ -359,6 +398,13 @@ _swift_package_config_unset-mirror() { _arguments $arguments && return } +_swift_package_config_get-mirror() { + arguments=( + "--package-url[The package dependency url]:The package dependency url: " + ) + _arguments $arguments && return +} + _swift_package_config_set-mirror() { arguments=( "--package-url[The package dependency url]:The package dependency url: " @@ -367,48 +413,8 @@ _swift_package_config_set-mirror() { _arguments $arguments && return } -_swift_package_config_get-mirror() { +_swift_package_update() { arguments=( - "--package-url[The package dependency url]:The package dependency url: " - ) - _arguments $arguments && return -} - -_swift_package_completion-tool() { - arguments=( - ": :{_values '' 'generate-bash-script[generate Bash completion script]' 'generate-zsh-script[generate Bash completion script]' 'list-dependencies[list all dependencies' names]' 'list-executables[list all executables' names]'}" - ) - _arguments $arguments && return -} - -_swift_package_clean() { - arguments=( - ) - _arguments $arguments && return -} - -_swift_package_generate-xcodeproj() { - arguments=( - "--xcconfig-overrides[Path to xcconfig file]:Path to xcconfig file:_files" - "--enable-code-coverage[Enable code coverage in the generated project]" - "--output[Path where the Xcode project should be generated]:Path where the Xcode project should be generated:_files" - "--legacy-scheme-generator[Use the legacy scheme generator]" - "--watch[Watch for changes to the Package manifest to regenerate the Xcode project]" - "--skip-extra-files[Do not add file references for extra files to the generated Xcode project]" - ) - _arguments $arguments && return -} - -_swift_package_reset() { - arguments=( - ) - _arguments $arguments && return -} - -_swift_package_init() { - arguments=( - "--type[empty|library|executable|system-module]: :{_values '' 'empty[generates an empty project]' 'library[generates project for a dynamic library]' 'executable[generates a project for a cli executable]' 'system-module[generates a project for a system module]'}" - "--name[Provide custom package name]:Provide custom package name: " ) _arguments $arguments && return } @@ -440,13 +446,15 @@ _swift_test() { "(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]" "--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]" "--static-swift-stdlib[Link Swift stdlib statically]" - "--enable-llbuild-library[Enable building with the llbuild library]" "--force-resolved-versions[]" "--disable-automatic-resolution[Disable automatic resolution if Package.resolved file is out-of-date]" "--enable-index-store[Enable indexing-while-building feature]" "--disable-index-store[Disable indexing-while-building feature]" "--enable-pubgrub-resolver[\[Experimental\] Enable the new Pubgrub dependency resolver]" "--enable-parseable-module-interfaces[]" + "--trace-resolver[]" + "(--jobs -j)"{--jobs,-j}"[The number of jobs to spawn in parallel during the build process]:The number of jobs to spawn in parallel during the build process: " + "--enable-test-discovery[Enable test discovery on platforms without Objective-C runtime]" "--skip-build[Skip building the test target]" "(--list-tests -l)"{--list-tests,-l}"[Lists test methods in specifier format]" "--generate-linuxmain[Generate LinuxMain.swift entries for the package]" From eaa682c0a64daad3138e6f08e7b6c8825700049f Mon Sep 17 00:00:00 2001 From: Lukasz Chrzaszcz Date: Thu, 24 Oct 2019 17:42:33 +0200 Subject: [PATCH 135/302] 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 136/302] 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 137/302] 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 138/302] 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 139/302] 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 140/302] 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 141/302] 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 142/302] 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 143/302] 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 144/302] 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 145/302] 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 146/302] 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 147/302] 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 148/302] 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 149/302] 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 150/302] 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 151/302] 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 152/302] 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 153/302] 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 154/302] 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 155/302] 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 156/302] 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 157/302] 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 158/302] 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