From 4674384d1a1182484705b3fa4bd7b3267295d9cc Mon Sep 17 00:00:00 2001 From: Will LE Date: Thu, 12 May 2022 16:31:00 +0700 Subject: [PATCH 01/28] fix(lib): don't return clean with `hide-dirty=1` in `parse_git_dirty` (#10897) --- lib/git.zsh | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/lib/git.zsh b/lib/git.zsh index be9fa7e67..390c0ad4b 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -34,26 +34,30 @@ function git_prompt_info() { # Checks if working tree is dirty function parse_git_dirty() { + if [[ "$(__git_prompt_git config --get oh-my-zsh.hide-dirty)" == "1" ]]; then + return 0 + fi + local STATUS local -a FLAGS FLAGS=('--porcelain') - if [[ "$(__git_prompt_git config --get oh-my-zsh.hide-dirty)" != "1" ]]; then - if [[ "${DISABLE_UNTRACKED_FILES_DIRTY:-}" == "true" ]]; then - FLAGS+='--untracked-files=no' - fi - case "${GIT_STATUS_IGNORE_SUBMODULES:-}" in - 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:-dirty}" - ;; - esac - STATUS=$(__git_prompt_git status ${FLAGS} 2> /dev/null | tail -n 1) + if [[ "${DISABLE_UNTRACKED_FILES_DIRTY:-}" == "true" ]]; then + FLAGS+='--untracked-files=no' fi - if [[ -n $STATUS ]]; then + + case "${GIT_STATUS_IGNORE_SUBMODULES:-}" in + 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:-dirty}" + ;; + esac + + STATUS=$(__git_prompt_git status ${FLAGS} 2> /dev/null | tail -n 1) + if [[ -n "$STATUS" ]]; then echo "$ZSH_THEME_GIT_PROMPT_DIRTY" else echo "$ZSH_THEME_GIT_PROMPT_CLEAN" From 140c977a3d82410f48c198596de193d2d6b7b9b5 Mon Sep 17 00:00:00 2001 From: jackh Date: Wed, 4 May 2022 00:30:18 +0800 Subject: [PATCH 02/28] fix(web-search): URL-encode search parameters (#10910) Fixes #10884 --- plugins/web-search/web-search.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/web-search/web-search.plugin.zsh b/plugins/web-search/web-search.plugin.zsh index 0a2b8809e..229948894 100644 --- a/plugins/web-search/web-search.plugin.zsh +++ b/plugins/web-search/web-search.plugin.zsh @@ -35,7 +35,7 @@ function web_search() { if [[ $# -gt 1 ]]; then # build search url: # join arguments passed with '+', then append to search engine URL - url="${urls[$1]}${(j:+:)@[2,-1]}" + url="${urls[$1]}$(omz_urlencode ${@[2,-1]})" else # build main page url: # split by '/', then rejoin protocol (1) and domain (2) parts with '//' From d7fc9b87f92fbd0c03eb99b8c69318468f69e61e Mon Sep 17 00:00:00 2001 From: jackh Date: Wed, 4 May 2022 00:34:22 +0800 Subject: [PATCH 03/28] fix(frontend-search): URL-encode search parameters (#10910) Fixes #10884 Closes #10910 --- plugins/frontend-search/frontend-search.plugin.zsh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/frontend-search/frontend-search.plugin.zsh b/plugins/frontend-search/frontend-search.plugin.zsh index 7f8d5c90c..b9e2fe95d 100644 --- a/plugins/frontend-search/frontend-search.plugin.zsh +++ b/plugins/frontend-search/frontend-search.plugin.zsh @@ -103,8 +103,7 @@ function frontend() { # build search url: # join arguments passed with '%20', then append to search context URL - # TODO substitute for proper urlencode method - url="${urls[$1]}${(j:%20:)@[2,-1]}" + url="${urls[$1]}$(omz_urlencode -P ${@[2,-1]})" echo "Opening $url ..." From dfee71c7735b739d6db478b2353752aeb6bc1ae2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 12 May 2022 18:25:02 +0200 Subject: [PATCH 04/28] Revert "fix(lib): don't return clean with `hide-dirty=1` in `parse_git_dirty`" (#10927) --- lib/git.zsh | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/lib/git.zsh b/lib/git.zsh index 390c0ad4b..be9fa7e67 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -34,30 +34,26 @@ function git_prompt_info() { # Checks if working tree is dirty function parse_git_dirty() { - if [[ "$(__git_prompt_git config --get oh-my-zsh.hide-dirty)" == "1" ]]; then - return 0 - fi - local STATUS local -a FLAGS FLAGS=('--porcelain') - if [[ "${DISABLE_UNTRACKED_FILES_DIRTY:-}" == "true" ]]; then - FLAGS+='--untracked-files=no' + if [[ "$(__git_prompt_git config --get oh-my-zsh.hide-dirty)" != "1" ]]; then + if [[ "${DISABLE_UNTRACKED_FILES_DIRTY:-}" == "true" ]]; then + FLAGS+='--untracked-files=no' + fi + case "${GIT_STATUS_IGNORE_SUBMODULES:-}" in + 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:-dirty}" + ;; + esac + STATUS=$(__git_prompt_git status ${FLAGS} 2> /dev/null | tail -n 1) fi - - case "${GIT_STATUS_IGNORE_SUBMODULES:-}" in - 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:-dirty}" - ;; - esac - - STATUS=$(__git_prompt_git status ${FLAGS} 2> /dev/null | tail -n 1) - if [[ -n "$STATUS" ]]; then + if [[ -n $STATUS ]]; then echo "$ZSH_THEME_GIT_PROMPT_DIRTY" else echo "$ZSH_THEME_GIT_PROMPT_CLEAN" From 39b600e9e564db3dec265fcf2e3db4b5568dd93a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sun, 15 May 2022 13:20:33 +0200 Subject: [PATCH 05/28] fix(lib): encode all arguments besides the first in `omz_urlencode` Fixes https://github.com/ohmyzsh/ohmyzsh/commit/140c977a3d82410f48c198596de193d2d6b7b9b5#commitcomment-73688165 --- lib/functions.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/functions.zsh b/lib/functions.zsh index 61f4dd49e..dfcc4d961 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -144,7 +144,7 @@ zmodload zsh/langinfo # Returns nonzero if encoding failed. # # Usage: -# omz_urlencode [-r] [-m] [-P] +# omz_urlencode [-r] [-m] [-P] [ ...] # # -r causes reserved characters (;/?:@&=+$,) to be escaped # @@ -156,7 +156,7 @@ function omz_urlencode() { local -a opts zparseopts -D -E -a opts r m P - local in_str=$1 + local in_str="$@" local url_str="" local spaces_as_plus if [[ -z $opts[(r)-P] ]]; then spaces_as_plus=1; fi From e9e8c6b54d594109041bdd4bc3902b40f9ae8849 Mon Sep 17 00:00:00 2001 From: Steven Pitts <25968054+stevenpitts@users.noreply.github.com> Date: Wed, 25 May 2022 10:32:33 -0400 Subject: [PATCH 06/28] feat(git): add `gupom` and `gupomi` aliases (#10261) Co-authored-by: Steven Pitts --- plugins/git/README.md | 2 ++ plugins/git/git.plugin.zsh | 2 ++ 2 files changed, 4 insertions(+) diff --git a/plugins/git/README.md b/plugins/git/README.md index b9af3488f..b9a0309f3 100644 --- a/plugins/git/README.md +++ b/plugins/git/README.md @@ -181,6 +181,8 @@ plugins=(... git) | gupv | git pull --rebase -v | | gupa | git pull --rebase --autostash | | gupav | git pull --rebase --autostash -v | +| gupom | git pull --rebase origin $(git_main_branch) | +| gupomi | git pull --rebase=interactive origin $(git_main_branch) | | glum | git pull upstream $(git_main_branch) | | gwch | git whatchanged -p --abbrev-commit --pretty=medium | | gwip | git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign -m "--wip-- [skip ci]" | diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 8f7e623ec..be6adc7ce 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -307,6 +307,8 @@ alias gup='git pull --rebase' alias gupv='git pull --rebase -v' alias gupa='git pull --rebase --autostash' alias gupav='git pull --rebase --autostash -v' +alias gupom='git pull --rebase origin $(git_main_branch)' +alias gupomi='git pull --rebase=interactive origin $(git_main_branch)' alias glum='git pull upstream $(git_main_branch)' alias gwch='git whatchanged -p --abbrev-commit --pretty=medium' From 18e7e5d0339f3491a6c0324e2443415309b56173 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 1 Jun 2022 09:11:49 +0200 Subject: [PATCH 07/28] fix(updater): use `curl --connect-timeout` in new update check --- tools/check_for_upgrade.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh index 149500aa9..009c273fa 100644 --- a/tools/check_for_upgrade.sh +++ b/tools/check_for_upgrade.sh @@ -65,7 +65,7 @@ function is_update_available() { local remote_head remote_head=$( if (( ${+commands[curl]} )); then - curl -m 2 -fsSL -H 'Accept: application/vnd.github.v3.sha' $api_url 2>/dev/null + curl --conect-timeout 2 -fsSL -H 'Accept: application/vnd.github.v3.sha' $api_url 2>/dev/null elif (( ${+commands[wget]} )); then wget -T 2 -O- --header='Accept: application/vnd.github.v3.sha' $api_url 2>/dev/null elif (( ${+commands[fetch]} )); then From 6622210d7d4afe859f11c5d50c177bd5e500f2c6 Mon Sep 17 00:00:00 2001 From: FaeTheWolf Date: Sun, 5 Jun 2022 09:59:44 -0400 Subject: [PATCH 08/28] fix(oc): fix completion for oc 4.9 and 4.10 (#10973) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #10939 Co-authored-by: Jorge Francisco Varela Gutiérrez --- plugins/oc/oc.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/oc/oc.plugin.zsh b/plugins/oc/oc.plugin.zsh index b968c4bd4..f0e2fc3bc 100644 --- a/plugins/oc/oc.plugin.zsh +++ b/plugins/oc/oc.plugin.zsh @@ -4,4 +4,5 @@ if [ $commands[oc] ]; then source <(oc completion zsh) + compdef _oc oc fi From d41ca84af1271e8bfbe26f581cebe3b86521d0db Mon Sep 17 00:00:00 2001 From: Maxim Derbenev Date: Mon, 6 Jun 2022 18:37:42 +0500 Subject: [PATCH 09/28] fix(docker): rename `dip` alias to `dipu` to avoid naming conflict (#10957) --- plugins/docker/README.md | 2 +- plugins/docker/docker.plugin.zsh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/docker/README.md b/plugins/docker/README.md index 2b721c770..606690f14 100644 --- a/plugins/docker/README.md +++ b/plugins/docker/README.md @@ -57,7 +57,7 @@ the lines below to your zshrc file**, but be aware of the side effects: | dib | `docker image build` | Build an image from a Dockerfile (same as docker build) | | dii | `docker image inspect` | Display detailed information on one or more images | | dils | `docker image ls` | List docker images | -| dip | `docker image push` | Push an image or repository to a remote registry | +| dipu | `docker image push` | Push an image or repository to a remote registry | | dirm | `docker image rm` | Remove one or more images | | dit | `docker image tag` | Add a name and tag to a particular image | | | | **Docker Network** | diff --git a/plugins/docker/docker.plugin.zsh b/plugins/docker/docker.plugin.zsh index 843c8e241..9c8ad8a28 100644 --- a/plugins/docker/docker.plugin.zsh +++ b/plugins/docker/docker.plugin.zsh @@ -21,7 +21,7 @@ alias dxcit='docker container exec -it' alias dib='docker image build' alias dii='docker image inspect' alias dils='docker image ls' -alias dip='docker image push' +alias dipu='docker image push' alias dirm='docker image rm' alias dit='docker image tag' From 055c3b6cb30c5e658914000597b8582afc3aa40e Mon Sep 17 00:00:00 2001 From: Jon Mosco <1970496+jonmosco@users.noreply.github.com> Date: Sun, 12 Jun 2022 13:41:52 -0400 Subject: [PATCH 10/28] chore(kube-ps1): update to most recent version (#10980) --- plugins/kube-ps1/README.md | 3 +++ plugins/kube-ps1/kube-ps1.plugin.zsh | 39 +++++++++++++++++++--------- 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/plugins/kube-ps1/README.md b/plugins/kube-ps1/README.md index b08997b0f..1ed3e4438 100644 --- a/plugins/kube-ps1/README.md +++ b/plugins/kube-ps1/README.md @@ -128,6 +128,7 @@ the following environment variables: | `KUBE_PS1_NS_ENABLE` | `true` | Display the namespace. If set to `false`, this will also disable `KUBE_PS1_DIVIDER` | | `KUBE_PS1_PREFIX` | `(` | Prompt opening character | | `KUBE_PS1_SYMBOL_ENABLE` | `true ` | Display the prompt Symbol. If set to `false`, this will also disable `KUBE_PS1_SEPARATOR` | +| `KUBE_PS1_SYMBOL_PADDING` | `false` | Adds a space (padding) after the symbol to prevent clobbering prompt characters | | `KUBE_PS1_SYMBOL_DEFAULT` | `⎈ ` | Default prompt symbol. Unicode `\u2388` | | `KUBE_PS1_SYMBOL_USE_IMG` | `false` | ☸️ , Unicode `\u2638` as the prompt symbol | | `KUBE_PS1_SEPARATOR` | | | Separator between symbol and context name | @@ -151,8 +152,10 @@ The default colors are set with the following environment variables: | Variable | Default | Meaning | | :------- | :-----: | ------- | +| `KUBE_PS1_PREFIX_COLOR` | `null` | Set default color of the prompt prefix | | `KUBE_PS1_SYMBOL_COLOR` | `blue` | Set default color of the Kubernetes symbol | | `KUBE_PS1_CTX_COLOR` | `red` | Set default color of the context | +| `KUBE_PS1_SUFFIX_COLOR` | `null` | Set default color of the prompt suffix | | `KUBE_PS1_NS_COLOR` | `cyan` | Set default color of the namespace | | `KUBE_PS1_BG_COLOR` | `null` | Set default color of the prompt background | diff --git a/plugins/kube-ps1/kube-ps1.plugin.zsh b/plugins/kube-ps1/kube-ps1.plugin.zsh index 9e77cbc19..894e0f7f0 100644 --- a/plugins/kube-ps1/kube-ps1.plugin.zsh +++ b/plugins/kube-ps1/kube-ps1.plugin.zsh @@ -1,9 +1,9 @@ -#!/bin/bash +#!/usr/bin/env bash # Kubernetes prompt helper for bash/zsh # Displays current context and namespace -# Copyright 2019 Jon Mosco +# Copyright 2021 Jon Mosco # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -24,7 +24,8 @@ # Override these values in ~/.zshrc or ~/.bashrc KUBE_PS1_BINARY="${KUBE_PS1_BINARY:-kubectl}" KUBE_PS1_SYMBOL_ENABLE="${KUBE_PS1_SYMBOL_ENABLE:-true}" -KUBE_PS1_SYMBOL_DEFAULT=${KUBE_PS1_SYMBOL_DEFAULT:-$'\u2388 '} +KUBE_PS1_SYMBOL_DEFAULT=${KUBE_PS1_SYMBOL_DEFAULT:-$'\u2388'} +KUBE_PS1_SYMBOL_PADDING="${KUBE_PS1_SYMBOL_PADDING:-false}" KUBE_PS1_SYMBOL_USE_IMG="${KUBE_PS1_SYMBOL_USE_IMG:-false}" KUBE_PS1_NS_ENABLE="${KUBE_PS1_NS_ENABLE:-true}" KUBE_PS1_CONTEXT_ENABLE="${KUBE_PS1_CONTEXT_ENABLE:-true}" @@ -32,10 +33,12 @@ KUBE_PS1_PREFIX="${KUBE_PS1_PREFIX-(}" KUBE_PS1_SEPARATOR="${KUBE_PS1_SEPARATOR-|}" KUBE_PS1_DIVIDER="${KUBE_PS1_DIVIDER-:}" KUBE_PS1_SUFFIX="${KUBE_PS1_SUFFIX-)}" + KUBE_PS1_SYMBOL_COLOR="${KUBE_PS1_SYMBOL_COLOR-blue}" KUBE_PS1_CTX_COLOR="${KUBE_PS1_CTX_COLOR-red}" KUBE_PS1_NS_COLOR="${KUBE_PS1_NS_COLOR-cyan}" KUBE_PS1_BG_COLOR="${KUBE_PS1_BG_COLOR}" + KUBE_PS1_KUBECONFIG_CACHE="${KUBECONFIG}" KUBE_PS1_DISABLE_PATH="${HOME}/.kube/kube-ps1/disabled" KUBE_PS1_LAST_TIME=0 @@ -149,18 +152,17 @@ _kube_ps1_symbol() { case "${KUBE_PS1_SHELL}" in bash) - if ((BASH_VERSINFO[0] >= 4)) && [[ $'\u2388 ' != "\\u2388 " ]]; then + if ((BASH_VERSINFO[0] >= 4)) && [[ $'\u2388' != "\\u2388" ]]; then KUBE_PS1_SYMBOL="${KUBE_PS1_SYMBOL_DEFAULT}" - # KUBE_PS1_SYMBOL=$'\u2388 ' - KUBE_PS1_SYMBOL_IMG=$'\u2638 ' + KUBE_PS1_SYMBOL_IMG=$'\u2638\ufe0f' else - KUBE_PS1_SYMBOL=$'\xE2\x8E\x88 ' - KUBE_PS1_SYMBOL_IMG=$'\xE2\x98\xB8 ' + KUBE_PS1_SYMBOL=$'\xE2\x8E\x88' + KUBE_PS1_SYMBOL_IMG=$'\xE2\x98\xB8' fi ;; zsh) KUBE_PS1_SYMBOL="${KUBE_PS1_SYMBOL_DEFAULT}" - KUBE_PS1_SYMBOL_IMG="\u2638 ";; + KUBE_PS1_SYMBOL_IMG="\u2638";; *) KUBE_PS1_SYMBOL="k8s" esac @@ -169,7 +171,12 @@ _kube_ps1_symbol() { KUBE_PS1_SYMBOL="${KUBE_PS1_SYMBOL_IMG}" fi - echo "${KUBE_PS1_SYMBOL}" + if [[ "${KUBE_PS1_SYMBOL_PADDING}" == true ]]; then + echo "${KUBE_PS1_SYMBOL} " + else + echo "${KUBE_PS1_SYMBOL}" + fi + } _kube_ps1_split() { @@ -339,7 +346,11 @@ kube_ps1() { [[ -n "${KUBE_PS1_BG_COLOR}" ]] && KUBE_PS1+="$(_kube_ps1_color_bg ${KUBE_PS1_BG_COLOR})" # Prefix - [[ -n "${KUBE_PS1_PREFIX}" ]] && KUBE_PS1+="${KUBE_PS1_PREFIX}" + if [[ -z "${KUBE_PS1_PREFIX_COLOR:-}" ]] && [[ -n "${KUBE_PS1_PREFIX}" ]]; then + KUBE_PS1+="${KUBE_PS1_PREFIX}" + else + KUBE_PS1+="$(_kube_ps1_color_fg $KUBE_PS1_PREFIX_COLOR)${KUBE_PS1_PREFIX}${KUBE_PS1_RESET_COLOR}" + fi # Symbol KUBE_PS1+="$(_kube_ps1_color_fg $KUBE_PS1_SYMBOL_COLOR)$(_kube_ps1_symbol)${KUBE_PS1_RESET_COLOR}" @@ -362,7 +373,11 @@ kube_ps1() { fi # Suffix - [[ -n "${KUBE_PS1_SUFFIX}" ]] && KUBE_PS1+="${KUBE_PS1_SUFFIX}" + if [[ -z "${KUBE_PS1_SUFFIX_COLOR:-}" ]] && [[ -n "${KUBE_PS1_SUFFIX}" ]]; then + KUBE_PS1+="${KUBE_PS1_SUFFIX}" + else + KUBE_PS1+="$(_kube_ps1_color_fg $KUBE_PS1_SUFFIX_COLOR)${KUBE_PS1_SUFFIX}${KUBE_PS1_RESET_COLOR}" + fi # Close Background color if defined [[ -n "${KUBE_PS1_BG_COLOR}" ]] && KUBE_PS1+="${_KUBE_PS1_OPEN_ESC}${_KUBE_PS1_DEFAULT_BG}${_KUBE_PS1_CLOSE_ESC}" From 50550c70eaa36e79fdf380bdc4ddad4a1ad581a0 Mon Sep 17 00:00:00 2001 From: Sukka Date: Mon, 13 Jun 2022 02:22:29 +0800 Subject: [PATCH 11/28] fix(github): deprecate the `git.io` command (#10896) --- plugins/github/README.md | 1 - plugins/github/github.plugin.zsh | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/github/README.md b/plugins/github/README.md index af2b8a4e7..5d8b62501 100644 --- a/plugins/github/README.md +++ b/plugins/github/README.md @@ -11,7 +11,6 @@ This plugin supports working with GitHub from the command line. It provides a fe * `empty_gh` - Creates a new empty repo (with a `README.md`) and pushes it to GitHub * `new_gh` - Initializes an existing directory as a repo and pushes it to GitHub * `exist_gh` - Takes an existing repo and pushes it to GitHub -* `git.io` - Shortens a URL using [git.io](https://git.io) ## Installation diff --git a/plugins/github/github.plugin.zsh b/plugins/github/github.plugin.zsh index 8e4b97352..79114ff69 100644 --- a/plugins/github/github.plugin.zsh +++ b/plugins/github/github.plugin.zsh @@ -68,8 +68,9 @@ exist_gh() { # [DIRECTORY] # documentation: https://github.com/blog/985-git-io-github-url-shortener # git.io() { - emulate -L zsh - curl -i -s https://git.io -F "url=$1" | grep "Location" | cut -f 2 -d " " + # emulate -L zsh + # curl -i -s https://git.io -F "url=$1" | grep "Location" | cut -f 2 -d " " + print -u2 ${(%):-"%F{yellow}%BThe \`git.io\` is deprecated.%b\nView the announcement made by GitHub: https://github.blog/changelog/2022-01-11-git-io-no-longer-accepts-new-urls/%f"} } # End Functions ############################################################# From 0866f4daf4f55a52c1979002627f1bf61aa1e1c6 Mon Sep 17 00:00:00 2001 From: Ilya Maximov Date: Sun, 8 May 2022 17:24:00 +0200 Subject: [PATCH 12/28] fix(toolbox): fix the plugin's filename --- plugins/toolbox/{kubectx.plugin.zsh => toolbox.plugin.zsh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename plugins/toolbox/{kubectx.plugin.zsh => toolbox.plugin.zsh} (100%) diff --git a/plugins/toolbox/kubectx.plugin.zsh b/plugins/toolbox/toolbox.plugin.zsh similarity index 100% rename from plugins/toolbox/kubectx.plugin.zsh rename to plugins/toolbox/toolbox.plugin.zsh From ed03e7127f392bb3ee51ed971e9f2c76984bb761 Mon Sep 17 00:00:00 2001 From: Ilya Maximov Date: Sun, 8 May 2022 17:29:02 +0200 Subject: [PATCH 13/28] feat(toolbox): alias for `toolbox enter` --- plugins/toolbox/README.md | 6 ++++++ plugins/toolbox/toolbox.plugin.zsh | 2 ++ 2 files changed, 8 insertions(+) diff --git a/plugins/toolbox/README.md b/plugins/toolbox/README.md index aac2bb3b0..abaca31f4 100644 --- a/plugins/toolbox/README.md +++ b/plugins/toolbox/README.md @@ -17,3 +17,9 @@ You can use it by adding `$(toolbox_prompt_info)` to your `PROMPT` or `RPROMPT` ```zsh RPROMPT='$(toolbox_prompt_info)' ``` + +## Aliases + +| Alias | Command | Description | +|-------|----------------------|----------------------------------------| +| tb | `toolbox enter` | Enters the toolbox environment | diff --git a/plugins/toolbox/toolbox.plugin.zsh b/plugins/toolbox/toolbox.plugin.zsh index 8b6bf5ecd..d24d6d396 100644 --- a/plugins/toolbox/toolbox.plugin.zsh +++ b/plugins/toolbox/toolbox.plugin.zsh @@ -1,3 +1,5 @@ function toolbox_prompt_info() { [[ -f /run/.toolboxenv ]] && echo "⬢" } + +alias tb="toolbox enter" From 8168ec0174e7e3212be20ecc74810155772abff1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 15 Jun 2022 20:07:35 +0200 Subject: [PATCH 14/28] refactor!: remove deprecated plugins BREAKING CHANGE: the following deprecated plugins have been removed: `cargo`, `copydir`, `npx`, `osx`, and `rustup`. See the wiki for more info: https://github.com/ohmyzsh/ohmyzsh/wiki/Plugins#removed refactor(rustup)!: remove deprecated plugin BREAKING CHANGE: the plugin was deprecated and is now removed. See the wiki for more info: https://github.com/ohmyzsh/ohmyzsh/wiki/Plugins#removed --- plugins/cargo/README.md | 3 --- plugins/cargo/cargo.plugin.zsh | 7 ------- plugins/copydir/README.md | 3 --- plugins/copydir/copydir.plugin.zsh | 7 ------- plugins/npx/README.md | 16 ---------------- plugins/npx/npx.plugin.zsh | 12 ------------ plugins/osx/README.md | 3 --- plugins/osx/osx.plugin.zsh | 5 ----- plugins/rustup/README.md | 3 --- plugins/rustup/rustup.plugin.zsh | 7 ------- 10 files changed, 66 deletions(-) delete mode 100644 plugins/cargo/README.md delete mode 100644 plugins/cargo/cargo.plugin.zsh delete mode 100644 plugins/copydir/README.md delete mode 100644 plugins/copydir/copydir.plugin.zsh delete mode 100644 plugins/npx/README.md delete mode 100644 plugins/npx/npx.plugin.zsh delete mode 100644 plugins/osx/README.md delete mode 100644 plugins/osx/osx.plugin.zsh delete mode 100644 plugins/rustup/README.md delete mode 100644 plugins/rustup/rustup.plugin.zsh diff --git a/plugins/cargo/README.md b/plugins/cargo/README.md deleted file mode 100644 index 93e69ae7f..000000000 --- a/plugins/cargo/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# cargo - -**Deprecated: use the [`rust`](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/rust) plugin instead.** diff --git a/plugins/cargo/cargo.plugin.zsh b/plugins/cargo/cargo.plugin.zsh deleted file mode 100644 index 692025e8f..000000000 --- a/plugins/cargo/cargo.plugin.zsh +++ /dev/null @@ -1,7 +0,0 @@ -print ${(%):-'%F{yellow}The `cargo` plugin is deprecated and has been moved to the `rust` plugin.'} -print ${(%):-'Please update your .zshrc to use the `%Brust%b` plugin instead.%f'} - -(( ${fpath[(Ie)$ZSH/plugins/rust]} )) || { - fpath=("$ZSH/plugins/rust" $fpath) - source "$ZSH/plugins/rust/rust.plugin.zsh" -} diff --git a/plugins/copydir/README.md b/plugins/copydir/README.md deleted file mode 100644 index cf24b789f..000000000 --- a/plugins/copydir/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# copydir plugin - -This plugin is deprecated. Use the [`copypath` plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/copypath) instead. diff --git a/plugins/copydir/copydir.plugin.zsh b/plugins/copydir/copydir.plugin.zsh deleted file mode 100644 index a2b489ec0..000000000 --- a/plugins/copydir/copydir.plugin.zsh +++ /dev/null @@ -1,7 +0,0 @@ -echo ${(%):-'%F{yellow}The `%Bcopydir%b` plugin is deprecated. Use the `%Bcopypath%b` plugin instead.%f'} -source "$ZSH/plugins/copypath/copypath.plugin.zsh" - -# TODO: 2022-02-22: Remove deprecated copydir function. -function copydir { - copypath -} diff --git a/plugins/npx/README.md b/plugins/npx/README.md deleted file mode 100644 index 4b2aba8f0..000000000 --- a/plugins/npx/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# npx plugin - -## Deprecation - -Since npm v7, `npx` has been moved to `npm exec`. With the move, [the `--shell-auto-fallback` argument -for `npx` has been removed](https://github.com/npm/cli/blob/v7.0.0/docs/content/cli-commands/npm-exec.md#compatibility-with-older-npx-versions): - -> Shell fallback functionality is removed, as it is not advisable. - -When using npm v7, you'll get this error: - -> npx: the --shell-auto-fallback argument has been removed - -If you get this error, just disable the plugin by removing it from the plugins array in your zshrc file. -This plugin will no longer be maintained and will be removed in the future, when the older `npx` versions -are no longer available. diff --git a/plugins/npx/npx.plugin.zsh b/plugins/npx/npx.plugin.zsh deleted file mode 100644 index c1e2eca98..000000000 --- a/plugins/npx/npx.plugin.zsh +++ /dev/null @@ -1,12 +0,0 @@ -if (( ! $+commands[npx] )); then - return -fi - -if ! npx_fallback_script="$(npx --shell-auto-fallback zsh 2>/dev/null)"; then - print -u2 ${(%):-"%F{yellow}This \`npx\` version ($(npx --version)) is not supported.%f"} -else - source <(<<< "$npx_fallback_script") -fi - -print -u2 ${(%):-"%F{yellow}The \`npx\` plugin is deprecated and will be removed soon. %BPlease disable it%b.%f"} -unset npx_fallback_script diff --git a/plugins/osx/README.md b/plugins/osx/README.md deleted file mode 100644 index 98d859545..000000000 --- a/plugins/osx/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# osx plugin - -**Deprecated: use the [`macos`](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/macos) plugin instead.** diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh deleted file mode 100644 index 3b0935981..000000000 --- a/plugins/osx/osx.plugin.zsh +++ /dev/null @@ -1,5 +0,0 @@ -print -u2 ${(%):-'%F{yellow}The `osx` plugin is deprecated and has been renamed to `macos`.'} -print -u2 ${(%):-'Please update your .zshrc to use the `%Bmacos%b` plugin instead.%f'} - -(( ${fpath[(Ie)$ZSH/plugins/macos]} )) || fpath=("$ZSH/plugins/macos" $fpath) -source "$ZSH/plugins/macos/macos.plugin.zsh" diff --git a/plugins/rustup/README.md b/plugins/rustup/README.md deleted file mode 100644 index c620e72a8..000000000 --- a/plugins/rustup/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# rustup - -**Deprecated: use the [`rust`](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/rust) plugin instead.** diff --git a/plugins/rustup/rustup.plugin.zsh b/plugins/rustup/rustup.plugin.zsh deleted file mode 100644 index ef141cf8f..000000000 --- a/plugins/rustup/rustup.plugin.zsh +++ /dev/null @@ -1,7 +0,0 @@ -print ${(%):-'%F{yellow}The `rustup` plugin is deprecated and has been moved to the `rust` plugin.'} -print ${(%):-'Please update your .zshrc to use the `%Brust%b` plugin instead.%f'} - -(( ${fpath[(Ie)$ZSH/plugins/rust]} )) || { - fpath=("$ZSH/plugins/rust" $fpath) - source "$ZSH/plugins/rust/rust.plugin.zsh" -} From 4c82a2eedf0c43d47601ffa8b0303ed1326fab8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20M=C3=BCller?= Date: Sun, 19 Jun 2022 12:32:16 +0200 Subject: [PATCH 15/28] fix(emacs): fix check for open frames w/ extra output (#10992) --- plugins/emacs/emacsclient.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/emacs/emacsclient.sh b/plugins/emacs/emacsclient.sh index 25efe0d68..96893c932 100755 --- a/plugins/emacs/emacsclient.sh +++ b/plugins/emacs/emacsclient.sh @@ -11,7 +11,7 @@ emacsfun() { esac # Check if there are suitable frames - frames="$(emacsclient -a '' -n -e "$cmd" 2>/dev/null)" + frames="$(emacsclient -a '' -n -e "$cmd" 2>/dev/null |sed 's/.*\x07//g' )" # Only create another X frame if there isn't one present if [ -z "$frames" -o "$frames" = nil ]; then From d2dc3bd2da531754778d1e9d7fb082715fc532f1 Mon Sep 17 00:00:00 2001 From: Carlo Sala Date: Tue, 12 Jul 2022 18:40:39 +0200 Subject: [PATCH 16/28] feat(brew): run `brew shellenv` command at plugin load (#10874) --- plugins/brew/README.md | 12 ++++++++---- plugins/brew/brew.plugin.zsh | 30 +++++++++++++++++++++++++++--- 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/plugins/brew/README.md b/plugins/brew/README.md index bf952bf01..64e0e1153 100644 --- a/plugins/brew/README.md +++ b/plugins/brew/README.md @@ -8,19 +8,23 @@ To use it, add `brew` to the plugins array of your zshrc file: plugins=(... brew) ``` +## Shellenv + +This plugin also executes `brew shellenv` at plugin load to set up many useful variables, such as `HOMEBREW_PREFIX` or `HOMEBREW_REPOSITORY`. + ## Aliases | Alias | Command | Description | -|----------|---------------------------------------|---------------------------------------------------------------------| +| -------- | ------------------------------------- | ------------------------------------------------------------------- | +| `bcubc` | `brew upgrade --cask && brew cleanup` | Update outdated casks, then run cleanup. | +| `bcubo` | `brew update && brew outdated --cask` | Update Homebrew data, then list outdated casks. | | `brewp` | `brew pin` | Pin a specified formula so that it's not upgraded. | | `brews` | `brew list -1` | List installed formulae or the installed files for a given formula. | | `brewsp` | `brew list --pinned` | List pinned formulae, or show the version of a given formula. | -| `bubo` | `brew update && brew outdated` | Update Homebrew data, then list outdated formulae and casks. | | `bubc` | `brew upgrade && brew cleanup` | Upgrade outdated formulae and casks, then run cleanup. | +| `bubo` | `brew update && brew outdated` | Update Homebrew data, then list outdated formulae and casks. | | `bubu` | `bubo && bubc` | Do the last two operations above. | | `buf` | `brew upgrade --formula` | Upgrade only formulas (not casks). | -| `bcubo` | `brew update && brew outdated --cask` | Update Homebrew data, then list outdated casks. | -| `bcubc` | `brew upgrade --cask && brew cleanup` | Update outdated casks, then run cleanup. | ## Completion diff --git a/plugins/brew/brew.plugin.zsh b/plugins/brew/brew.plugin.zsh index 070a083d0..4a2322216 100644 --- a/plugins/brew/brew.plugin.zsh +++ b/plugins/brew/brew.plugin.zsh @@ -1,11 +1,35 @@ +if (( ! $+commands[brew] )); then + if [[ -x /opt/homebrew/bin/brew ]]; then + BREW_LOCATION="/opt/homebrew/bin/brew" + elif [[ -x /usr/local/bin/brew ]]; then + BREW_LOCATION="/usr/local/bin/brew" + elif [[ -x /home/linuxbrew/.linuxbrew/bin/brew ]]; then + BREW_LOCATION="/home/linuxbrew/.linuxbrew/bin/brew" + elif [[ -x "$HOME/.linuxbrew/bin/brew" ]]; then + BREW_LOCATION="$HOME/.linuxbrew/bin/brew" + else + return + fi +fi + +if [[ -z "$HOMEBREW_PREFIX" ]]; then + if [[ -z $BREW_LOCATION ]]; then + eval "$(brew shellenv)" + else + eval "$("$BREW_LOCATION" shellenv)" + fi +fi + +unset BREW_LOCATION + +alias bcubc='brew upgrade --cask && brew cleanup' +alias bcubo='brew update && brew outdated --cask' alias brewp='brew pin' alias brewsp='brew list --pinned' -alias bubo='brew update && brew outdated' alias bubc='brew upgrade && brew cleanup' +alias bubo='brew update && brew outdated' alias bubu='bubo && bubc' alias buf='brew upgrade --formula' -alias bcubo='brew update && brew outdated --cask' -alias bcubc='brew upgrade --cask && brew cleanup' function brews() { local formulae="$(brew leaves | xargs brew deps --installed --for-each)" From 5336e59db1b76b9b5439099cbc5a311796d32ba9 Mon Sep 17 00:00:00 2001 From: Ian Cowan <38896380+iccowan@users.noreply.github.com> Date: Tue, 12 Jul 2022 12:46:42 -0400 Subject: [PATCH 17/28] chore(git): fix unintentional latex in documentation (#11018) --- plugins/git/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/git/README.md b/plugins/git/README.md index b9a0309f3..0700dcc32 100644 --- a/plugins/git/README.md +++ b/plugins/git/README.md @@ -23,7 +23,7 @@ plugins=(... git) | gb | git branch | | gba | git branch -a | | gbd | git branch -d | -| gbda | git branch --no-color --merged \| grep -vE "^([+*]\|\s*($(git_main_branch)\|$(git_develop_branch))\s*$)" \| xargs git branch -d 2>/dev/null | +| gbda | git branch --no-color --merged \| grep -vE "^([+*]\|\s*($(git_main_branch)\|$(git_develop_branch))\s*$)" \| xargs git branch -d 2>/dev/null | | gbD | git branch -D | | gbl | git blame -b -w | | gbnm | git branch --no-merged | @@ -42,12 +42,12 @@ plugins=(... git) | gcans! | git commit -v -a -s --no-edit --amend | | gcam | git commit -a -m | | gcas | git commit -a -s | -| gcasm | git commit -a -s -m | +| gcasm | git commit -a -s -m | | gcsm | git commit -s -m | | gcb | git checkout -b | | gcf | git config --list | | gcl | git clone --recurse-submodules | -| gccd | git clone --recurse-submodules "$@" && cd "$(basename $_ .git)" | +| gccd | git clone --recurse-submodules "$@" && cd "$(basename $_ .git)" | | gclean | git clean -id | | gpristine | git reset --hard && git clean -dffx | | gcm | git checkout $(git_main_branch) | From 4506210c38774bc5da1a0495c2a911776cf6f2cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sun, 19 Jun 2022 12:54:11 +0200 Subject: [PATCH 18/28] fix(lib): don't attach to tty in `wl-copy` and `xclip` (#10953) Fixes #10925 --- lib/clipboard.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/clipboard.zsh b/lib/clipboard.zsh index 4e3ba0a45..272b41598 100644 --- a/lib/clipboard.zsh +++ b/lib/clipboard.zsh @@ -58,10 +58,10 @@ function detect-clipboard() { function clipcopy() { cat "${1:-/dev/stdin}" > /dev/clipboard; } function clippaste() { cat /dev/clipboard; } elif [ -n "${WAYLAND_DISPLAY:-}" ] && (( ${+commands[wl-copy]} )) && (( ${+commands[wl-paste]} )); then - function clipcopy() { wl-copy < "${1:-/dev/stdin}"; } + function clipcopy() { wl-copy < "${1:-/dev/stdin}" &>/dev/null &|; } function clippaste() { wl-paste; } elif [ -n "${DISPLAY:-}" ] && (( ${+commands[xclip]} )); then - function clipcopy() { xclip -in -selection clipboard < "${1:-/dev/stdin}"; } + function clipcopy() { xclip -in -selection clipboard < "${1:-/dev/stdin}" &>/dev/null &|; } function clippaste() { xclip -out -selection clipboard; } elif [ -n "${DISPLAY:-}" ] && (( ${+commands[xsel]} )); then function clipcopy() { xsel --clipboard --input < "${1:-/dev/stdin}"; } From 39573125e4971b34e26f4cb3aaa210a74ea6ca34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sun, 19 Jun 2022 12:49:32 +0200 Subject: [PATCH 19/28] feat(lib): wait for input to copy to the clipboard (#10953) --- lib/clipboard.zsh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/clipboard.zsh b/lib/clipboard.zsh index 272b41598..aab21a28a 100644 --- a/lib/clipboard.zsh +++ b/lib/clipboard.zsh @@ -52,37 +52,37 @@ function detect-clipboard() { emulate -L zsh if [[ "${OSTYPE}" == darwin* ]] && (( ${+commands[pbcopy]} )) && (( ${+commands[pbpaste]} )); then - function clipcopy() { pbcopy < "${1:-/dev/stdin}"; } + function clipcopy() { cat "${1:-/dev/stdin}" | pbcopy; } function clippaste() { pbpaste; } elif [[ "${OSTYPE}" == (cygwin|msys)* ]]; then function clipcopy() { cat "${1:-/dev/stdin}" > /dev/clipboard; } function clippaste() { cat /dev/clipboard; } elif [ -n "${WAYLAND_DISPLAY:-}" ] && (( ${+commands[wl-copy]} )) && (( ${+commands[wl-paste]} )); then - function clipcopy() { wl-copy < "${1:-/dev/stdin}" &>/dev/null &|; } + function clipcopy() { cat "${1:-/dev/stdin}" | wl-copy &>/dev/null &|; } function clippaste() { wl-paste; } elif [ -n "${DISPLAY:-}" ] && (( ${+commands[xclip]} )); then - function clipcopy() { xclip -in -selection clipboard < "${1:-/dev/stdin}" &>/dev/null &|; } + function clipcopy() { cat "${1:-/dev/stdin}" | xclip -selection clipboard -in &>/dev/null &|; } function clippaste() { xclip -out -selection clipboard; } elif [ -n "${DISPLAY:-}" ] && (( ${+commands[xsel]} )); then - function clipcopy() { xsel --clipboard --input < "${1:-/dev/stdin}"; } + function clipcopy() { cat "${1:-/dev/stdin}" | xsel --clipboard --input; } function clippaste() { xsel --clipboard --output; } elif (( ${+commands[lemonade]} )); then - function clipcopy() { lemonade copy < "${1:-/dev/stdin}"; } + function clipcopy() { cat "${1:-/dev/stdin}" | lemonade copy; } function clippaste() { lemonade paste; } elif (( ${+commands[doitclient]} )); then - function clipcopy() { doitclient wclip < "${1:-/dev/stdin}"; } + function clipcopy() { cat "${1:-/dev/stdin}" | doitclient wclip; } function clippaste() { doitclient wclip -r; } elif (( ${+commands[win32yank]} )); then - function clipcopy() { win32yank -i < "${1:-/dev/stdin}"; } + function clipcopy() { cat "${1:-/dev/stdin}" | win32yank -i; } function clippaste() { win32yank -o; } elif [[ $OSTYPE == linux-android* ]] && (( $+commands[termux-clipboard-set] )); then - function clipcopy() { termux-clipboard-set < "${1:-/dev/stdin}"; } + function clipcopy() { cat "${1:-/dev/stdin}" | termux-clipboard-set; } function clippaste() { termux-clipboard-get; } elif [ -n "${TMUX:-}" ] && (( ${+commands[tmux]} )); then function clipcopy() { tmux load-buffer "${1:--}"; } function clippaste() { tmux save-buffer -; } elif [[ $(uname -r) = *icrosoft* ]]; then - function clipcopy() { clip.exe < "${1:-/dev/stdin}"; } + function clipcopy() { cat "${1:-/dev/stdin}" | clip.exe; } function clippaste() { powershell.exe -noprofile -command Get-Clipboard; } else function _retry_clipboard_detection_or_fail() { From ef8e63a7fd30e04079e54ea76043c1db76e24ddf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 12 Jul 2022 18:56:09 +0200 Subject: [PATCH 20/28] fix(lib): prefer `xsel` over `xclip` in clipboard.zsh See #10925 --- lib/clipboard.zsh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/clipboard.zsh b/lib/clipboard.zsh index aab21a28a..ad83fc4b2 100644 --- a/lib/clipboard.zsh +++ b/lib/clipboard.zsh @@ -10,8 +10,8 @@ # - pbcopy, pbpaste (macOS) # - cygwin (Windows running Cygwin) # - wl-copy, wl-paste (if $WAYLAND_DISPLAY is set) -# - xclip (if $DISPLAY is set) # - xsel (if $DISPLAY is set) +# - xclip (if $DISPLAY is set) # - lemonade (for SSH) https://github.com/pocke/lemonade # - doitclient (for SSH) http://www.chiark.greenend.org.uk/~sgtatham/doit/ # - win32yank (Windows) @@ -60,12 +60,12 @@ function detect-clipboard() { elif [ -n "${WAYLAND_DISPLAY:-}" ] && (( ${+commands[wl-copy]} )) && (( ${+commands[wl-paste]} )); then function clipcopy() { cat "${1:-/dev/stdin}" | wl-copy &>/dev/null &|; } function clippaste() { wl-paste; } - elif [ -n "${DISPLAY:-}" ] && (( ${+commands[xclip]} )); then - function clipcopy() { cat "${1:-/dev/stdin}" | xclip -selection clipboard -in &>/dev/null &|; } - function clippaste() { xclip -out -selection clipboard; } elif [ -n "${DISPLAY:-}" ] && (( ${+commands[xsel]} )); then function clipcopy() { cat "${1:-/dev/stdin}" | xsel --clipboard --input; } function clippaste() { xsel --clipboard --output; } + elif [ -n "${DISPLAY:-}" ] && (( ${+commands[xclip]} )); then + function clipcopy() { cat "${1:-/dev/stdin}" | xclip -selection clipboard -in &>/dev/null &|; } + function clippaste() { xclip -out -selection clipboard; } elif (( ${+commands[lemonade]} )); then function clipcopy() { cat "${1:-/dev/stdin}" | lemonade copy; } function clippaste() { lemonade paste; } From 0726c1099fec6599dbf91a260f21d6d45fd8f309 Mon Sep 17 00:00:00 2001 From: Hans Donner Date: Tue, 12 Jul 2022 19:25:27 +0200 Subject: [PATCH 21/28] fix(aws): allow non-space characters in profile names (#11040) --- plugins/aws/aws.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/aws/aws.plugin.zsh b/plugins/aws/aws.plugin.zsh index b8625d7ac..2167f552c 100644 --- a/plugins/aws/aws.plugin.zsh +++ b/plugins/aws/aws.plugin.zsh @@ -147,7 +147,7 @@ function aws_change_access_key() { function aws_profiles() { [[ -r "${AWS_CONFIG_FILE:-$HOME/.aws/config}" ]] || return 1 - grep --color=never -Eo '\[.*\]' "${AWS_CONFIG_FILE:-$HOME/.aws/config}" | sed -E 's/^[[:space:]]*\[(profile)?[[:space:]]*([-_[:alnum:]\.@]+)\][[:space:]]*$/\2/g' + grep --color=never -Eo '\[.*\]' "${AWS_CONFIG_FILE:-$HOME/.aws/config}" | sed -E 's/^[[:space:]]*\[(profile)?[[:space:]]*([^[:space:]]+)\][[:space:]]*$/\2/g' } function _aws_profiles() { From 0c7ce363c903e1e3255d4d30255ff4790678ace9 Mon Sep 17 00:00:00 2001 From: hellzbellz <31550512+Hellzbellz123@users.noreply.github.com> Date: Tue, 12 Jul 2022 10:36:43 -0700 Subject: [PATCH 22/28] chore(lib): only create `afind` alias if `ack` is installed (#11017) --- lib/misc.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/misc.zsh b/lib/misc.zsh index a5d3af998..1f637083a 100644 --- a/lib/misc.zsh +++ b/lib/misc.zsh @@ -24,10 +24,10 @@ env_default 'LESS' '-R' ## super user alias alias _='sudo ' -## more intelligent acking for ubuntu users +## more intelligent acking for ubuntu users and no alias for users without ack if (( $+commands[ack-grep] )); then alias afind='ack-grep -il' -else +elif (( $+commands[ack] )); then alias afind='ack -il' fi From 249c708ed3a4a7a63d16a6e911a46b6fb9623cbd Mon Sep 17 00:00:00 2001 From: Anubhav Sharma Date: Tue, 12 Jul 2022 13:44:32 -0400 Subject: [PATCH 23/28] fix(frontcube): fix escape of reset color sequence (#10921) --- themes/frontcube.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/frontcube.zsh-theme b/themes/frontcube.zsh-theme index f9488d0ac..de6348329 100644 --- a/themes/frontcube.zsh-theme +++ b/themes/frontcube.zsh-theme @@ -1,7 +1,7 @@ PROMPT=' %{$fg_bold[gray]%}%~%{$fg_bold[blue]%}%{$fg_bold[blue]%} % %{$reset_color%} -%{$fg[green]%}➞ %{$reset_color%' +%{$fg[green]%}➞ %{$reset_color%}' RPROMPT='$(git_prompt_info) $(ruby_prompt_info)' From bb6c14cdfd0b7d543d0d9c2e5f0c0a9409a82084 Mon Sep 17 00:00:00 2001 From: Brian Wright <4408242+PennRobotics@users.noreply.github.com> Date: Tue, 26 Jul 2022 11:46:10 +0200 Subject: [PATCH 24/28] fix(updater): correct spelling of `curl` flag (#11072) --- tools/check_for_upgrade.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh index 009c273fa..cc527e72d 100644 --- a/tools/check_for_upgrade.sh +++ b/tools/check_for_upgrade.sh @@ -65,7 +65,7 @@ function is_update_available() { local remote_head remote_head=$( if (( ${+commands[curl]} )); then - curl --conect-timeout 2 -fsSL -H 'Accept: application/vnd.github.v3.sha' $api_url 2>/dev/null + curl --connect-timeout 2 -fsSL -H 'Accept: application/vnd.github.v3.sha' $api_url 2>/dev/null elif (( ${+commands[wget]} )); then wget -T 2 -O- --header='Accept: application/vnd.github.v3.sha' $api_url 2>/dev/null elif (( ${+commands[fetch]} )); then From af2daa7ab7dde3674f4861ef684773410b9cccd4 Mon Sep 17 00:00:00 2001 From: Christopher Boyd <6323077+cpboyd@users.noreply.github.com> Date: Wed, 27 Jul 2022 12:06:28 -0400 Subject: [PATCH 25/28] feat(flutter): use up-to-date zsh completion (#11062) --- plugins/flutter/_flutter | 37 ------------------------------ plugins/flutter/flutter.plugin.zsh | 15 ++++++++++++ 2 files changed, 15 insertions(+), 37 deletions(-) delete mode 100644 plugins/flutter/_flutter diff --git a/plugins/flutter/_flutter b/plugins/flutter/_flutter deleted file mode 100644 index ab6ce4265..000000000 --- a/plugins/flutter/_flutter +++ /dev/null @@ -1,37 +0,0 @@ -#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 index 80b74f64a..44d196cd4 100644 --- a/plugins/flutter/flutter.plugin.zsh +++ b/plugins/flutter/flutter.plugin.zsh @@ -12,3 +12,18 @@ alias flrd="flutter run --debug" alias flrp="flutter run --profile" alias flrr="flutter run --release" alias flupgrd="flutter upgrade" + +# COMPLETION FUNCTION +if (( ! $+commands[flutter] )); then + return +fi + +# If the completion file doesn't exist yet, we need to autoload it and +# bind it to `flutter`. Otherwise, compinit will have already done that. +if [[ ! -f "$ZSH_CACHE_DIR/completions/_flutter" ]]; then + typeset -g -A _comps + autoload -Uz _flutter + _comps[flutter]=_flutter +fi + +flutter zsh-completion >| "$ZSH_CACHE_DIR/completions/_flutter" &| \ No newline at end of file From 8362ae285a5c227cb20387543483a3597fa31931 Mon Sep 17 00:00:00 2001 From: Felix Stupp Date: Wed, 27 Jul 2022 16:07:53 +0000 Subject: [PATCH 26/28] fix(git-auto-fetch): don't override native `stat` command (#11068) --- plugins/git-auto-fetch/git-auto-fetch.plugin.zsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh b/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh index efe8cbe66..2e029639c 100644 --- a/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh +++ b/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh @@ -2,7 +2,8 @@ : ${GIT_AUTO_FETCH_INTERVAL:=60} # Necessary for the git-fetch-all function -zmodload zsh/datetime zsh/stat +zmodload zsh/datetime +zmodload -F zsh/stat b:zstat # only zstat command, not stat command function git-fetch-all { ( From aa75eeea3348b906f2016be0e44335889e0faed1 Mon Sep 17 00:00:00 2001 From: Anatoli Babenia Date: Fri, 29 Jul 2022 14:05:34 +0300 Subject: [PATCH 27/28] chore(copybuffer): format shortcut and lighten text (#11078) --- plugins/copybuffer/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/copybuffer/README.md b/plugins/copybuffer/README.md index da138bdbd..a53d1c813 100644 --- a/plugins/copybuffer/README.md +++ b/plugins/copybuffer/README.md @@ -1,7 +1,7 @@ # `copybuffer` plugin -This plugin binds the ctrl-o keyboard shortcut to a command that copies the text -that is currently typed in the command line ($BUFFER) to the system clipboard. +This plugin adds the ctrl-o keyboard shortcut to copy the current text +in the command line to the system clipboard. This is useful if you type a command - and before you hit enter to execute it - want to copy it maybe so you can paste it into a script, gist or whatnot. From 4fcf52c2b1e086596d96b04f9c1ff3d742194857 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Mon, 1 Aug 2022 20:54:45 +0200 Subject: [PATCH 28/28] fix: don't use `$functions_source` for compatibility with zsh < 5.4 --- plugins/aliases/aliases.plugin.zsh | 23 +++++----- plugins/shell-proxy/shell-proxy.plugin.zsh | 51 ++++++++++++---------- 2 files changed, 42 insertions(+), 32 deletions(-) diff --git a/plugins/aliases/aliases.plugin.zsh b/plugins/aliases/aliases.plugin.zsh index 4e1e0558e..9864de957 100644 --- a/plugins/aliases/aliases.plugin.zsh +++ b/plugins/aliases/aliases.plugin.zsh @@ -1,11 +1,14 @@ -# with lots of 3rd-party amazing aliases installed, just need something to explore it quickly. -# -# - acs: alias cheatsheet -# group alias by command, pass addition argv to grep. -function acs(){ - (( $+commands[python3] )) || { - echo "[error] No python executable detected" - return +# Handle $0 according to the standard: +# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html +0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}" +0="${${(M)0:#/*}:-$PWD/$0}" + +eval ' + function acs(){ + (( $+commands[python3] )) || { + echo "[error] No python executable detected" + return + } + alias | python3 "'"${0:h}"'/cheatsheet.py" "$@" } - alias | python3 ${functions_source[$0]:h}/cheatsheet.py $@ -} +' diff --git a/plugins/shell-proxy/shell-proxy.plugin.zsh b/plugins/shell-proxy/shell-proxy.plugin.zsh index 9d45b5269..4fdbe9322 100644 --- a/plugins/shell-proxy/shell-proxy.plugin.zsh +++ b/plugins/shell-proxy/shell-proxy.plugin.zsh @@ -1,32 +1,39 @@ #!/usr/bin/bash # shellcheck disable=SC1090,SC2154 -proxy() { - # deprecate $DEFAULT_PROXY, use SHELLPROXY_URL instead - if [[ -n "$DEFAULT_PROXY" && -z "$SHELLPROXY_URL" ]]; then - echo >&2 "proxy: DEFAULT_PROXY is deprecated, use SHELLPROXY_URL instead" - SHELLPROXY_URL="$DEFAULT_PROXY" - unset DEFAULT_PROXY - fi +# Handle $0 according to the standard: +# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html +0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}" +0="${${(M)0:#/*}:-$PWD/$0}" - # deprecate CONFIG_PROXY, use SHELLPROXY_CONFIG instead - if [[ -n "$CONFIG_PROXY" && -z "$SHELLPROXY_CONFIG" ]]; then - echo >&2 "proxy: CONFIG_PROXY is deprecated, use SHELLPROXY_CONFIG instead" - SHELLPROXY_CONFIG="$CONFIG_PROXY" - unset CONFIG_PROXY - fi +eval ' + proxy() { + # deprecate $DEFAULT_PROXY, use SHELLPROXY_URL instead + if [[ -n "$DEFAULT_PROXY" && -z "$SHELLPROXY_URL" ]]; then + echo >&2 "proxy: DEFAULT_PROXY is deprecated, use SHELLPROXY_URL instead" + SHELLPROXY_URL="$DEFAULT_PROXY" + unset DEFAULT_PROXY + fi - # the proxy.py script is in the same directory as this function - local proxy="${functions_source[$0]:A:h}/proxy.py" + # deprecate CONFIG_PROXY, use SHELLPROXY_CONFIG instead + if [[ -n "$CONFIG_PROXY" && -z "$SHELLPROXY_CONFIG" ]]; then + echo >&2 "proxy: CONFIG_PROXY is deprecated, use SHELLPROXY_CONFIG instead" + SHELLPROXY_CONFIG="$CONFIG_PROXY" + unset CONFIG_PROXY + fi - # capture the output of the proxy script and bail out if it fails - local output - output="$(SHELLPROXY_URL="$SHELLPROXY_URL" SHELLPROXY_CONFIG="$SHELLPROXY_CONFIG" "$proxy" "$1")" || - return $? + # the proxy.py script is in the same directory as this function + local proxy="'"${0:h}"'/proxy.py" - # evaluate the output generated by the proxy script - source <(echo "$output") -} + # capture the output of the proxy script and bail out if it fails + local output + output="$(SHELLPROXY_URL="$SHELLPROXY_URL" SHELLPROXY_CONFIG="$SHELLPROXY_CONFIG" "$proxy" "$1")" || + return $? + + # evaluate the output generated by the proxy script + source <(echo "$output") + } +' _proxy() { local -r commands=('enable' 'disable' 'status')