From b3d1826a431028acdbbae1eb5242f5641da17788 Mon Sep 17 00:00:00 2001 From: Kirk <1652877+chenkirk@users.noreply.github.com> Date: Fri, 23 Apr 2021 06:22:18 -0700 Subject: [PATCH 01/15] feat(ys): add setting to hide dirty info in hg repositories (#8415) On large mercurial projects, using `hg status` to show dirty prompt causes significant delay. This commit checks a local hg config value of `oh-my-zsh.hide-dirty` to skip dirty check. Users who wish to skip dirty check can add this to their `.hg/hgrc` file. ``` [oh-my-zsh] hide-dirty = 1 ``` This config value uses the same naming as ones found for git, in file lib/git.zsh. --- themes/ys.zsh-theme | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/themes/ys.zsh-theme b/themes/ys.zsh-theme index 89d5355dc..95067060b 100644 --- a/themes/ys.zsh-theme +++ b/themes/ys.zsh-theme @@ -26,10 +26,12 @@ ys_hg_prompt_info() { if [ -d '.hg' ]; then echo -n "${YS_VCS_PROMPT_PREFIX1}hg${YS_VCS_PROMPT_PREFIX2}" echo -n $(hg branch 2>/dev/null) - if [ -n "$(hg status 2>/dev/null)" ]; then - echo -n "$YS_VCS_PROMPT_DIRTY" - else - echo -n "$YS_VCS_PROMPT_CLEAN" + if [[ "$(hg config oh-my-zsh.hide-dirty 2>/dev/null)" != "1" ]]; then + if [ -n "$(hg status 2>/dev/null)" ]; then + echo -n "$YS_VCS_PROMPT_DIRTY" + else + echo -n "$YS_VCS_PROMPT_CLEAN" + fi fi echo -n "$YS_VCS_PROMPT_SUFFIX" fi From 0e5fed193edf0073fab5adaac61f7b912ea86060 Mon Sep 17 00:00:00 2001 From: MrAureliusR <41264289+MrAureliusR@users.noreply.github.com> Date: Fri, 23 Apr 2021 09:51:31 -0400 Subject: [PATCH 02/15] feat(ys): add virtualenv prompt info (#8453) --- themes/ys.zsh-theme | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/themes/ys.zsh-theme b/themes/ys.zsh-theme index 95067060b..303c898b4 100644 --- a/themes/ys.zsh-theme +++ b/themes/ys.zsh-theme @@ -37,6 +37,15 @@ ys_hg_prompt_info() { fi } +# Virtualenv +local venv_info='$(virtenv_prompt)' +YS_THEME_VIRTUALENV_PROMPT_PREFIX=" %{$fg[green]%}" +YS_THEME_VIRTUALENV_PROMPT_SUFFIX=" %{$reset_color%}%" +virtenv_prompt() { + [[ -n ${VIRTUAL_ENV} ]] || return + echo "${YS_THEME_VIRTUALENV_PROMPT_PREFIX}${VIRTUAL_ENV:t}${YS_THEME_VIRTUALENV_PROMPT_SUFFIX}" +} + local exit_code="%(?,,C:%{$fg[red]%}%?%{$reset_color%})" # Prompt format: @@ -57,6 +66,7 @@ PROMPT=" %{$terminfo[bold]$fg[yellow]%}%~%{$reset_color%}\ ${hg_info}\ ${git_info}\ +${venv_info}\ \ %{$fg[white]%}[%*] $exit_code %{$terminfo[bold]$fg[red]%}$ %{$reset_color%}" From 1916a31153ddf3e48d31e3a7193ed97eaf34097d Mon Sep 17 00:00:00 2001 From: Wolfgang Ladermann Date: Fri, 23 Apr 2021 16:23:26 +0200 Subject: [PATCH 03/15] feat(systemadmin): add IPv6 info to `geteip` command (#9856) --- plugins/systemadmin/systemadmin.plugin.zsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/systemadmin/systemadmin.plugin.zsh b/plugins/systemadmin/systemadmin.plugin.zsh index 08136abda..a77f0069b 100644 --- a/plugins/systemadmin/systemadmin.plugin.zsh +++ b/plugins/systemadmin/systemadmin.plugin.zsh @@ -131,7 +131,8 @@ d0() { # gather external ip address geteip() { - curl -s -S https://icanhazip.com + curl -s -S -4 https://icanhazip.com + curl -s -S -6 https://icanhazip.com } # determine local IP address(es) From 48a3c2f32d1a4643db367eed4d6c53768c3847b1 Mon Sep 17 00:00:00 2001 From: Ian G Canino Date: Fri, 23 Apr 2021 14:28:42 -0400 Subject: [PATCH 04/15] feat(fzf): look in XDG compliant location (#9858) --- plugins/fzf/fzf.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/fzf/fzf.plugin.zsh b/plugins/fzf/fzf.plugin.zsh index 69ec1d411..a979fe222 100644 --- a/plugins/fzf/fzf.plugin.zsh +++ b/plugins/fzf/fzf.plugin.zsh @@ -7,6 +7,7 @@ function setup_using_base_dir() { fzfdirs=( "${HOME}/.fzf" "${HOME}/.nix-profile/share/fzf" + "${XDG_DATA_HOME:-$HOME/.local/share}/fzf" "/usr/local/opt/fzf" "/usr/share/fzf" "/usr/local/share/examples/fzf" From 1cc15ca3c23ba1a2b5236432bc62eb652c98972d Mon Sep 17 00:00:00 2001 From: Mauro Porras <167700+mauroporras@users.noreply.github.com> Date: Sun, 25 Apr 2021 12:02:39 -0500 Subject: [PATCH 05/15] feat(npm): add alias for `npm i -f` (#8454) As documented in the README, `npm i -f` forces npm to install the specified packages from a remote package registry, even if local copies exist on disk caches. --- plugins/npm/README.md | 1 + plugins/npm/npm.plugin.zsh | 3 +++ 2 files changed, 4 insertions(+) diff --git a/plugins/npm/README.md b/plugins/npm/README.md index 0b1a2280f..bc627e56f 100644 --- a/plugins/npm/README.md +++ b/plugins/npm/README.md @@ -15,6 +15,7 @@ plugins=(... npm) | `npmg` | `npm i -g` | Install dependencies globally | | `npmS` | `npm i -S` | Install and save to dependencies in your package.json | | `npmD` | `npm i -D` | Install and save to dev-dependencies in your package.json | +| `npmF` | `npm i -f` | Force install from remote registries ignoring local cache | | `npmE` | `PATH="$(npm bin)":"$PATH"` | Run command from node_modules folder based on current directory | | `npmO` | `npm outdated` | Check which npm modules are outdated | | `npmV` | `npm -v` | Check package versions | diff --git a/plugins/npm/npm.plugin.zsh b/plugins/npm/npm.plugin.zsh index 87c68f3fb..93de9cba3 100644 --- a/plugins/npm/npm.plugin.zsh +++ b/plugins/npm/npm.plugin.zsh @@ -27,6 +27,9 @@ alias npmS="npm i -S " # npmd is used by https://github.com/dominictarr/npmd alias npmD="npm i -D " +# Force npm to fetch remote resources even if a local copy exists on disk. +alias npmF='npm i -f' + # Execute command from node_modules folder based on current directory # i.e npmE gulp alias npmE='PATH="$(npm bin)":"$PATH"' From 32532c149a90eb25710f94d207546501e83c161b Mon Sep 17 00:00:00 2001 From: Petr Rajtslegr Date: Sun, 25 Apr 2021 19:07:25 +0200 Subject: [PATCH 06/15] feat(npm): add alias for `npm update` (#9442) --- plugins/npm/README.md | 1 + plugins/npm/npm.plugin.zsh | 3 +++ 2 files changed, 4 insertions(+) diff --git a/plugins/npm/README.md b/plugins/npm/README.md index bc627e56f..d6bada38b 100644 --- a/plugins/npm/README.md +++ b/plugins/npm/README.md @@ -18,6 +18,7 @@ plugins=(... npm) | `npmF` | `npm i -f` | Force install from remote registries ignoring local cache | | `npmE` | `PATH="$(npm bin)":"$PATH"` | Run command from node_modules folder based on current directory | | `npmO` | `npm outdated` | Check which npm modules are outdated | +| `npmU` | `npm update` | Update all the packages listed to the latest version | | `npmV` | `npm -v` | Check package versions | | `npmL` | `npm list` | List installed packages | | `npmL0` | `npm ls --depth=0` | List top-level installed packages | diff --git a/plugins/npm/npm.plugin.zsh b/plugins/npm/npm.plugin.zsh index 93de9cba3..23f627ccd 100644 --- a/plugins/npm/npm.plugin.zsh +++ b/plugins/npm/npm.plugin.zsh @@ -37,6 +37,9 @@ alias npmE='PATH="$(npm bin)":"$PATH"' # Check which npm modules are outdated alias npmO="npm outdated" +# Update all the packages listed to the latest version +alias npmU="npm update" + # Check package versions alias npmV="npm -v" From 7ed8888c5bc58827a5b8cf9e8347829613bd3683 Mon Sep 17 00:00:00 2001 From: Sherwin Heydarbeygi Date: Sun, 25 Apr 2021 10:08:51 -0700 Subject: [PATCH 07/15] feat(npm): add aliases for `npm search` and `npm info` (#9365) --- plugins/npm/README.md | 2 ++ plugins/npm/npm.plugin.zsh | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/plugins/npm/README.md b/plugins/npm/README.md index d6bada38b..47d153619 100644 --- a/plugins/npm/README.md +++ b/plugins/npm/README.md @@ -27,3 +27,5 @@ plugins=(... npm) | `npmR` | `npm run` | Run npm scripts | | `npmP` | `npm publish` | Run npm publish | | `npmI` | `npm init` | Run npm init | +| `npmi` | `npm info` | Run npm info | +| `npmSe` | `npm search` | Run npm search | diff --git a/plugins/npm/npm.plugin.zsh b/plugins/npm/npm.plugin.zsh index 23f627ccd..f7d6d3939 100644 --- a/plugins/npm/npm.plugin.zsh +++ b/plugins/npm/npm.plugin.zsh @@ -63,3 +63,9 @@ alias npmP="npm publish" # Run npm init alias npmI="npm init" + +# Run npm info +alias npmi="npm info" + +# Run npm search +alias npmSe="npm search" From 6cc12e031ea8744a0dedb3c25ba3d73fe062772d Mon Sep 17 00:00:00 2001 From: Carlo Sala Date: Sun, 25 Apr 2021 19:14:05 +0200 Subject: [PATCH 08/15] feat(plugins): add plugin for `deno` (#9847) Co-authored-by: Kapil Pau Co-authored-by: CallMeLaNN --- plugins/deno/.gitignore | 1 + plugins/deno/README.md | 18 ++++++++++++++++++ plugins/deno/deno.plugin.zsh | 21 +++++++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 plugins/deno/.gitignore create mode 100644 plugins/deno/README.md create mode 100644 plugins/deno/deno.plugin.zsh diff --git a/plugins/deno/.gitignore b/plugins/deno/.gitignore new file mode 100644 index 000000000..cba5b03e8 --- /dev/null +++ b/plugins/deno/.gitignore @@ -0,0 +1 @@ +_deno diff --git a/plugins/deno/README.md b/plugins/deno/README.md new file mode 100644 index 000000000..828e6af39 --- /dev/null +++ b/plugins/deno/README.md @@ -0,0 +1,18 @@ +# Deno Plugin + +This plugin sets up completion and aliases for [Deno](https://deno.land). + +## Aliases + +| Alias | Full command | +| ----- | ---------------- | +| db | deno bundle | +| dc | deno compile | +| dca | deno cache | +| dfmt | deno fmt | +| dh | deno help | +| dli | deno lint | +| drn | deno run | +| drw | deno run --watch | +| dts | deno test | +| dup | deno upgrade | diff --git a/plugins/deno/deno.plugin.zsh b/plugins/deno/deno.plugin.zsh new file mode 100644 index 000000000..af5c98265 --- /dev/null +++ b/plugins/deno/deno.plugin.zsh @@ -0,0 +1,21 @@ +# ALIASES +alias db='deno bundle' +alias dc='deno compile' +alias dca='deno cache' +alias dfmt='deno fmt' +alias dh='deno help' +alias dli='deno lint' +alias drn='deno run' +alias drw='deno run --watch' +alias dts='deno test' +alias dup='deno upgrade' + +# COMPLETION FUNCTION +if (( $+commands[deno] )); then + if [[ ! -f $ZSH_CACHE_DIR/deno_version ]] \ + || [[ "$(deno --version)" != "$(< "$ZSH_CACHE_DIR/deno_version")" ]] \ + || [[ ! -f $ZSH/plugins/deno/_deno ]]; then + deno completions zsh > $ZSH/plugins/deno/_deno + deno --version > $ZSH_CACHE_DIR/deno_version + fi +fi From 6a7285bc5bb69c255920950c45a911fdeca7f665 Mon Sep 17 00:00:00 2001 From: Piper Date: Sun, 25 Apr 2021 10:21:31 -0700 Subject: [PATCH 09/15] chore: fix "Facebook" typo in README.md (#9378) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 86037f199..3ebea91e0 100644 --- a/README.md +++ b/README.md @@ -295,7 +295,7 @@ Thank you so much! We're on social media: - [@ohmyzsh](https://twitter.com/ohmyzsh) on Twitter. You should follow it. -- [FaceBook](https://www.facebook.com/Oh-My-Zsh-296616263819290/) poke us. +- [Facebook](https://www.facebook.com/Oh-My-Zsh-296616263819290/) poke us. - [Instagram](https://www.instagram.com/_ohmyzsh/) tag us in your post showing Oh My Zsh! - [Discord](https://discord.gg/ohmyzsh) to chat with us! From 0655241fa6b8d38ce2f2d43bb3289bdc2cad91c6 Mon Sep 17 00:00:00 2001 From: Eric Rodrigues Pires Date: Sun, 25 Apr 2021 14:56:59 -0300 Subject: [PATCH 10/15] fix(kubectl): use `--current` flag in `kcn` alias (#7605) --- plugins/kubectl/README.md | 2 +- plugins/kubectl/kubectl.plugin.zsh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/kubectl/README.md b/plugins/kubectl/README.md index 7a6cdaa59..8937b2b80 100644 --- a/plugins/kubectl/README.md +++ b/plugins/kubectl/README.md @@ -49,7 +49,7 @@ plugins=(... kubectl) | kdeli | `kubectl delete ingress` | Delete ingress resources matching passed argument | | | | **Namespace management** | | kgns | `kubectl get namespaces` | List the current namespaces in a cluster | -| kcn | `kubectl config set-context ...` | Change current namespace | +| kcn | `kubectl config set-context --current --namespace` | Change current namespace | | kens | `kubectl edit namespace` | Edit namespace resource from the default editor | | kdns | `kubectl describe namespace` | Describe namespace resource in detail | | kdelns | `kubectl delete namespace` | Delete the namespace. WARNING! This deletes everything in the namespace | diff --git a/plugins/kubectl/kubectl.plugin.zsh b/plugins/kubectl/kubectl.plugin.zsh index d509d8795..56135274f 100644 --- a/plugins/kubectl/kubectl.plugin.zsh +++ b/plugins/kubectl/kubectl.plugin.zsh @@ -71,7 +71,7 @@ alias kgns='kubectl get namespaces' alias kens='kubectl edit namespace' alias kdns='kubectl describe namespace' alias kdelns='kubectl delete namespace' -alias kcn='kubectl config set-context $(kubectl config current-context) --namespace' +alias kcn='kubectl config set-context --current --namespace' # ConfigMap management alias kgcm='kubectl get configmaps' From 63a7422d8dd5eb93c849df0ab9e679e6f333818a Mon Sep 17 00:00:00 2001 From: Carlo Sala Date: Mon, 26 Apr 2021 11:54:53 +0200 Subject: [PATCH 11/15] fix(deno): actually load deno completion (#9863) --- plugins/deno/deno.plugin.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/deno/deno.plugin.zsh b/plugins/deno/deno.plugin.zsh index af5c98265..a37b3bec4 100644 --- a/plugins/deno/deno.plugin.zsh +++ b/plugins/deno/deno.plugin.zsh @@ -18,4 +18,6 @@ if (( $+commands[deno] )); then deno completions zsh > $ZSH/plugins/deno/_deno deno --version > $ZSH_CACHE_DIR/deno_version fi + autoload -Uz _deno + _comps[deno]=_deno fi From 70ab2928a5ecd2513d4f6a67beb10f79d64d5172 Mon Sep 17 00:00:00 2001 From: "kalle (jag)" Date: Mon, 3 May 2021 16:35:28 +0200 Subject: [PATCH 12/15] feat(plugins): add `gh` plugin for GitHub CLI (#9557) --- plugins/gh/.gitignore | 1 + plugins/gh/README.md | 23 +++++++++++++++++++++++ plugins/gh/gh.plugin.zsh | 13 +++++++++++++ 3 files changed, 37 insertions(+) create mode 100644 plugins/gh/.gitignore create mode 100644 plugins/gh/README.md create mode 100644 plugins/gh/gh.plugin.zsh diff --git a/plugins/gh/.gitignore b/plugins/gh/.gitignore new file mode 100644 index 000000000..fa1244ab5 --- /dev/null +++ b/plugins/gh/.gitignore @@ -0,0 +1 @@ +_gh diff --git a/plugins/gh/README.md b/plugins/gh/README.md new file mode 100644 index 000000000..54e046a1c --- /dev/null +++ b/plugins/gh/README.md @@ -0,0 +1,23 @@ +# GitHub CLI plugin + +This plugin adds completion for the [GitHub CLI](https://cli.github.com/). + +To use it, add `gh` to the plugins array in your zshrc file: + +```zsh +plugins=(... gh) +``` + +This plugin does not add any aliases. + +## Cache + +This plugin caches the completion script and is automatically updated when the +plugin is loaded, which is usually when you start up a new terminal emulator. + +The cache is stored at: + +- `$ZSH/plugins/gh/_gh` completions script + +- `$ZSH_CACHE_DIR/gh_version` version of GitHub CLI, used to invalidate + the cache. diff --git a/plugins/gh/gh.plugin.zsh b/plugins/gh/gh.plugin.zsh new file mode 100644 index 000000000..8e055ec35 --- /dev/null +++ b/plugins/gh/gh.plugin.zsh @@ -0,0 +1,13 @@ +# Autocompletion for the GitHub CLI (gh). + +if (( $+commands[gh] )); then + if [[ ! -r "$ZSH_CACHE_DIR/gh_version" \ + || "$(gh --version)" != "$(< "$ZSH_CACHE_DIR/gh_version")" + || ! -f "$ZSH/plugins/gh/_gh" ]]; then + gh completion --shell zsh > $ZSH/plugins/gh/_gh + gh --version > $ZSH_CACHE_DIR/gh_version + fi + autoload -Uz _gh + _comps[gh]=_gh +fi + From f4de8c5b3a977d67ecbd302f24463dc00667eb40 Mon Sep 17 00:00:00 2001 From: sevendials Date: Mon, 3 May 2021 07:49:41 -0700 Subject: [PATCH 13/15] fix(command-not-found): remove invalid argument for PackageKit (#9876) `pk-command-not-found` doesn't accept `--` as an argument. This is what happens when `--` is the first argument: ``` $ gem zsh: --: command not found... ``` --- plugins/command-not-found/command-not-found.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/command-not-found/command-not-found.plugin.zsh b/plugins/command-not-found/command-not-found.plugin.zsh index cbf9a0a8e..3ec13429c 100644 --- a/plugins/command-not-found/command-not-found.plugin.zsh +++ b/plugins/command-not-found/command-not-found.plugin.zsh @@ -38,7 +38,7 @@ fi if [[ -x /usr/libexec/pk-command-not-found ]]; then command_not_found_handler() { if [[ -S /var/run/dbus/system_bus_socket && -x /usr/libexec/packagekitd ]]; then - /usr/libexec/pk-command-not-found -- "$@" + /usr/libexec/pk-command-not-found "$@" return $? fi From 4e8ffe88d4311edcd084de5efd4ee6688e9e70f7 Mon Sep 17 00:00:00 2001 From: Ben Goldberg Date: Mon, 3 May 2021 10:59:45 -0400 Subject: [PATCH 14/15] fix(cargo): complete flags for default cargo aliases (#9692) By default, cargo provides alias for some commonly used functions. This patch makes it that those alias will complete the same as their full commands. Default alias: b -> build c -> check t -> test r -> run Since cargo allows users to define custom alias it would be nice if oh-my-zsh automatically detected those and preformed completions as such but that would be a much more complex patch. --- plugins/cargo/_cargo | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/cargo/_cargo b/plugins/cargo/_cargo index ffc9fcdc8..ebff99310 100644 --- a/plugins/cargo/_cargo +++ b/plugins/cargo/_cargo @@ -77,7 +77,7 @@ _cargo() { '*:args:_default' ;; - build) + build|b) _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \ '--all-targets[equivalent to specifying --lib --bins --tests --benches --examples]' \ "${command_scope_spec[@]}" \ @@ -86,7 +86,7 @@ _cargo() { '--build-plan[output the build plan in JSON]' \ ;; - check) + check|c) _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \ '--all-targets[equivalent to specifying --lib --bins --tests --benches --examples]' \ "${command_scope_spec[@]}" \ @@ -224,7 +224,7 @@ _cargo() { _arguments -s -S $common $manifest ;; - run) + run|r) _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \ '--example=[name of the bin target]:name' \ '--bin=[name of the bin target]:name' \ @@ -259,7 +259,7 @@ _cargo() { '*: :_guard "^-*" "query"' ;; - test) + test|t) _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]' \ From d646884add277d134235a9b18ab755388d6e0d8d Mon Sep 17 00:00:00 2001 From: "Babak K. Shandiz" Date: Mon, 3 May 2021 20:05:13 +0430 Subject: [PATCH 15/15] feat(git): add aliases `gcas` and `gcasm` for commit with sign-off (#8881) --- 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 6ad19543e..4f051db8d 100644 --- a/plugins/git/README.md +++ b/plugins/git/README.md @@ -41,6 +41,8 @@ plugins=(... git) | gcan! | git commit -v -a --no-edit --amend | | 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 | | gcsm | git commit -s -m | | gcb | git checkout -b | | gcf | git config --list | diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index e815d0787..35ebfbfa3 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -80,6 +80,8 @@ alias gcan!='git commit -v -a --no-edit --amend' alias gcans!='git commit -v -a -s --no-edit --amend' alias gcam='git commit -a -m' alias gcsm='git commit -s -m' +alias gcas='git commit -a -s' +alias gcasm='git commit -a -s -m' alias gcb='git checkout -b' alias gcf='git config --list' alias gcl='git clone --recurse-submodules'