From 2d97e102b27135febd43fc6fdaa5dea84780973d Mon Sep 17 00:00:00 2001 From: hasheddan Date: Sat, 22 Aug 2020 09:00:06 -0500 Subject: Remove missing screenshots from kube-ps1 README Removes missing screenshots from README for kube-ps1 plugin. Signed-off-by: hasheddan --- plugins/kube-ps1/README.md | 8 -------- 1 file changed, 8 deletions(-) (limited to 'plugins') diff --git a/plugins/kube-ps1/README.md b/plugins/kube-ps1/README.md index a14337278..b08997b0f 100644 --- a/plugins/kube-ps1/README.md +++ b/plugins/kube-ps1/README.md @@ -6,14 +6,6 @@ configured on `kubectl` to your Bash/Zsh prompt strings (i.e. the `$PS1`). Inspired by several tools used to simplify usage of `kubectl`. -![prompt](img/screenshot2.png) - -![prompt_sol_light](img/screenshot-sol-light.png) - -![prompt_img](img/screenshot-img.png) - -![prompt demo](img/kube-ps1.gif) - ## Installing ### MacOS -- cgit v1.2.3-70-g09d2 From 68f809448a08d2c93d13650157fd0500a329a16a Mon Sep 17 00:00:00 2001 From: Raphaël Pinson Date: Thu, 8 Oct 2020 19:18:43 +0200 Subject: kubectl: add wrappers for colorized output in JSON and YAML (#9316) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Marc Cornellà --- plugins/kubectl/README.md | 8 ++++++++ plugins/kubectl/kubectl.plugin.zsh | 16 ++++++++++++++++ 2 files changed, 24 insertions(+) (limited to 'plugins') diff --git a/plugins/kubectl/README.md b/plugins/kubectl/README.md index ee05a8af1..84f5f8d89 100644 --- a/plugins/kubectl/README.md +++ b/plugins/kubectl/README.md @@ -106,3 +106,11 @@ plugins=(... kubectl) | kdelss | `kubectl delete statefulset` | Delete the statefulset | | ksss | `kubectl scale statefulset` | Scale a statefulset | | krsss | `kubectl rollout status statefulset`| Check the rollout status of a deployment | + +## Wrappers + +This plugin provides 3 wrappers to colorize kubectl output in JSON and YAML using various tools (which must be installed): + +- `kj`: JSON, colorized with [`jq`](https://stedolan.github.io/jq/). +- `kjx`: JSON, colorized with [`fx`](https://github.com/antonmedv/fx). +- `ky`: YAML, colorized with [`yh`](https://github.com/andreazorzetto/yh). diff --git a/plugins/kubectl/kubectl.plugin.zsh b/plugins/kubectl/kubectl.plugin.zsh index 647d029c1..6292a0b2f 100644 --- a/plugins/kubectl/kubectl.plugin.zsh +++ b/plugins/kubectl/kubectl.plugin.zsh @@ -150,3 +150,19 @@ alias kepvc='kubectl edit pvc' alias kdpvc='kubectl describe pvc' alias kdelpvc='kubectl delete pvc' +# Colored JSON output +kj() { + kubectl "$@" -o json | jq +} +compdef kj=kubectl + +kjx() { + kubectl "$@" -o json | fx +} +compdef kjx=kubectl + +# Colored YAML output +ky() { + kubectl "$@" -o yaml | yh +} +compdef ky=kubectl -- cgit v1.2.3-70-g09d2 From 8ad9b315a389c741d93aece3ed6eae6b6829f951 Mon Sep 17 00:00:00 2001 From: Duc Nguyen Date: Fri, 9 Oct 2020 17:35:13 +0700 Subject: Add git-lfs plugin (#9077) --- .github/CODEOWNERS | 1 + plugins/git-lfs/README.md | 24 ++++++++++++++++++++++++ plugins/git-lfs/git-lfs.plugin.zsh | 17 +++++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 plugins/git-lfs/README.md create mode 100644 plugins/git-lfs/git-lfs.plugin.zsh (limited to 'plugins') diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index cba8e93af..c3990c4ee 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,3 +1,4 @@ # Plugin owners plugins/gitfast/ @felipec plugins/sdk/ @rgoldberg +plugins/git-lfs/ @vietduc01100001 diff --git a/plugins/git-lfs/README.md b/plugins/git-lfs/README.md new file mode 100644 index 000000000..1222b2767 --- /dev/null +++ b/plugins/git-lfs/README.md @@ -0,0 +1,24 @@ +# git lfs plugin + +The git lfs plugin provides [aliases](#aliases) and [functions](#functions) for [git-lfs](https://github.com/git-lfs/git-lfs). + +To use it, add `git-lfs` to the plugins array in your zshrc file: + +```zsh +plugins=(... git-lfs) +``` + +## Aliases + +| Alias | Command | +| :------- | :---------------------------------- | +| `glfsi` | `git lfs install` | +| `glfst` | `git lfs track` | +| `glfsls` | `git lfs ls-files` | +| `glfsmi` | `git lfs migrate import --include=` | + +## Functions + +| Function | Command | +| :------- | :---------------------------------------------- | +| `gplfs` | `git lfs push origin "$(current_branch)" --all` | diff --git a/plugins/git-lfs/git-lfs.plugin.zsh b/plugins/git-lfs/git-lfs.plugin.zsh new file mode 100644 index 000000000..e7bb67603 --- /dev/null +++ b/plugins/git-lfs/git-lfs.plugin.zsh @@ -0,0 +1,17 @@ +# +# Aliases +# + +alias glfsi='git lfs install' +alias glfst='git lfs track' +alias glfsls='git lfs ls-files' +alias glfsmi='git lfs migrate import --include=' + +# +# Functions +# + +function gplfs() { + local b="$(git_current_branch)" + git lfs push origin "$b" --all +} -- cgit v1.2.3-70-g09d2 From df58625ca62ebb6ff5b7730717fdd55afdd28e63 Mon Sep 17 00:00:00 2001 From: Tom Hale Date: Fri, 9 Oct 2020 17:39:23 +0700 Subject: safe-paste: refresh plugin (update for zsh 5.1 and vi keymaps) (#7887) --- plugins/safe-paste/safe-paste.plugin.zsh | 128 +++++++++++++++++++++---------- 1 file changed, 87 insertions(+), 41 deletions(-) (limited to 'plugins') diff --git a/plugins/safe-paste/safe-paste.plugin.zsh b/plugins/safe-paste/safe-paste.plugin.zsh index 75f1791d7..db524538c 100644 --- a/plugins/safe-paste/safe-paste.plugin.zsh +++ b/plugins/safe-paste/safe-paste.plugin.zsh @@ -1,54 +1,100 @@ +# A good summary of the zsh 5.1 Bracketed Paste Mode changes is at: +# https://archive.zhimingwang.org/blog/2015-09-21-zsh-51-and-bracketed-paste.html + +# zsh 5.1 (September 2015) introduced built-in support for Bracketed Paste Mode +# https://github.com/zsh-users/zsh/blob/68405f31a043bdd5bf338eb06688ed3e1f740937/README#L38-L45 +# +# zsh 5.1 breaks url-quote-magic and other widgets replacing self-insert +# zsh-users' bracketed-paste-magic resolves these issues: +# https://github.com/zsh-users/zsh/blob/f702e17b14d75aa21bff014168fa9048124db286/Functions/Zle/bracketed-paste-magic#L9-L12 + +# Load bracketed-paste-magic if zsh version is >= 5.1 +if [[ ${ZSH_VERSION:0:3} -ge 5.1 ]]; then + set zle_bracketed_paste # Explicitly restore this zsh default + autoload -Uz bracketed-paste-magic + zle -N bracketed-paste bracketed-paste-magic + return ### The rest of this file is NOT executed on zsh version >= 5.1 ### +fi + +###################################################################### +# The rest of this file is ONLY executed if zsh version < 5.1 +###################################################################### + # Code from Mikael Magnusson: https://www.zsh.org/mla/users/2011/msg00367.html # -# Requires xterm, urxvt, iTerm2 or any other terminal that supports bracketed -# paste mode as documented: https://www.xfree86.org/current/ctlseqs.html - -# create a new keymap to use while pasting -bindkey -N paste -# make everything in this keymap call our custom widget -bindkey -R -M paste "^@"-"\M-^?" paste-insert -# these are the codes sent around the pasted text in bracketed -# paste mode. -# do the first one with both -M viins and -M vicmd in vi mode -bindkey '^[[200~' _start_paste -bindkey -M paste '^[[201~' _end_paste -# insert newlines rather than carriage returns when pasting newlines -bindkey -M paste -s '^M' '^J' - -zle -N _start_paste -zle -N _end_paste -zle -N zle-line-init _zle_line_init -zle -N zle-line-finish _zle_line_finish -zle -N paste-insert _paste_insert - -# switch the active keymap to paste mode -function _start_paste() { - bindkey -A paste main +# Requires xterm, urxvt, iTerm2 or any other terminal that supports +# Bracketed Paste Mode as documented: +# https://www.xfree86.org/current/ctlseqs.html#Bracketed%20Paste%20Mode +# +# For tmux, use: bind ] paste-buffer -p +# +# Additional technical details: https://cirw.in/blog/bracketed-paste + +# Create a new keymap to use while pasting +bindkey -N bracketed-paste +# Make everything in this new keymap enqueue characters for pasting +bindkey -RM bracketed-paste '\x00-\xFF' bracketed-paste-enqueue +# These are the codes sent around the pasted text in bracketed paste mode +bindkey -M main '^[[200~' _bracketed_paste_begin +bindkey -M bracketed-paste '^[[201~' _bracketed_paste_end +# Insert newlines rather than carriage returns when pasting newlines +bindkey -M bracketed-paste -s '^M' '^J' + +zle -N _bracketed_paste_begin +zle -N _bracketed_paste_end +zle -N bracketed-paste-enqueue _bracketed_paste_enqueue + +# Attempt to not clobber zle_line_{init,finish} +# Use https://github.com/willghatch/zsh-hooks if available +if typeset -f hooks-add-hook > /dev/null; then + hooks-add-hook zle_line_init_hook _bracketed_paste_zle_init + hooks-add-hook zle_line_finish_hook _bracketed_paste_zle_finish +else + zle -N zle-line-init _bracketed_paste_zle_init + zle -N zle-line-finish _bracketed_paste_zle_finish +fi + +# Switch the active keymap to paste mode +_bracketed_paste_begin() { + # Save the bindkey command to restore the active ("main") keymap + # Tokenise the restorative bindkey command into an array + _bracketed_paste_restore_keymap=( ${(z)"$(bindkey -lL main)"} ) + bindkey -A bracketed-paste main } -# go back to our normal keymap, and insert all the pasted text in the -# command line. this has the nice effect of making the whole paste be +# Go back to our normal keymap, and insert all the pasted text in the +# command line. This has the nice effect of making the whole paste be # a single undo/redo event. -function _end_paste() { -#use bindkey -v here with vi mode probably. maybe you want to track -#if you were in ins or cmd mode and restore the right one. - bindkey -e - LBUFFER+=$_paste_content - unset _paste_content +_bracketed_paste_end() { + # Only execute the restore command if it starts with 'bindkey' + # Allow for option KSH_ARRAYS being set (indexing starts at 0) + if [ ${_bracketed_paste_restore_keymap[@]:0:1} = 'bindkey' ]; then + $_bracketed_paste_restore_keymap + fi + LBUFFER+=$_bracketed_paste_content + unset _bracketed_paste_content _bracketed_paste_restore_keymap } -function _paste_insert() { - _paste_content+=$KEYS +# Append a pasted character to the content which is later inserted as a whole +_bracketed_paste_enqueue() { + _bracketed_paste_content+=$KEYS } -function _zle_line_init() { - # Tell terminal to send escape codes around pastes. - [[ $TERM == rxvt-unicode || $TERM == xterm || $TERM = xterm-256color || $TERM = screen || $TERM = screen-256color ]] && printf '\e[?2004h' +# Run at zle-line-init +_bracketed_paste_zle_init() { + _bracketed_paste_content='' + # Tell terminal to send escape codes around pastes + if [ $TERM =~ '^(rxvt-unicode|xterm(-256color)?|screen(-256color)?)$' ]; then + printf '\e[?2004h' + fi } -function _zle_line_finish() { - # Tell it to stop when we leave zle, so pasting in other programs - # doesn't get the ^[[200~ codes around the pasted text. - [[ $TERM == rxvt-unicode || $TERM == xterm || $TERM = xterm-256color || $TERM = screen || $TERM = screen-256color ]] && printf '\e[?2004l' +# Run at zle-line-finish +_bracketed_paste_zle_finish() { + # Turn off bracketed paste when we leave ZLE, so pasting in other programs + # doesn't get the ^[[200~ codes around the pasted text + if [ $TERM =~ '^(rxvt-unicode|xterm(-256color)?|screen(-256color)?)$' ]; then + printf '\e[?2004l' + fi } -- cgit v1.2.3-70-g09d2 From ef44416df2e2ae819b13764dbf6ca87ce099ec36 Mon Sep 17 00:00:00 2001 From: Andrew Janke Date: Thu, 10 Sep 2015 04:10:18 -0400 Subject: nvm: use `nvm current` in nvm_prompt_info and look in alternate install locations This makes it work regardless of where nvm is loaded from. And it uses nvm's version strings, which distinguish the "system" and "none" NVM environments, instead of reporting the specific version of the system node.js or erroring, respectively. Fixes #4336 Closes #4338 --- lib/nvm.zsh | 9 +++---- plugins/nvm/nvm.plugin.zsh | 62 +++++++++++++++++++++++++++++++--------------- 2 files changed, 46 insertions(+), 25 deletions(-) (limited to 'plugins') diff --git a/lib/nvm.zsh b/lib/nvm.zsh index 4a8b6811e..c4f70c849 100644 --- a/lib/nvm.zsh +++ b/lib/nvm.zsh @@ -1,9 +1,8 @@ -# get the node.js version +# get the nvm-controlled node.js version function nvm_prompt_info() { - [[ -f "$NVM_DIR/nvm.sh" ]] || return local nvm_prompt - nvm_prompt=$(node -v 2>/dev/null) - [[ "${nvm_prompt}x" == "x" ]] && return - nvm_prompt=${nvm_prompt:1} + which nvm &>/dev/null || return + nvm_prompt=$(nvm current) + nvm_prompt=${nvm_prompt#v} echo "${ZSH_THEME_NVM_PROMPT_PREFIX}${nvm_prompt}${ZSH_THEME_NVM_PROMPT_SUFFIX}" } diff --git a/plugins/nvm/nvm.plugin.zsh b/plugins/nvm/nvm.plugin.zsh index 2264a2420..ee8d2324b 100644 --- a/plugins/nvm/nvm.plugin.zsh +++ b/plugins/nvm/nvm.plugin.zsh @@ -1,23 +1,45 @@ -# Set NVM_DIR if it isn't already defined -[[ -z "$NVM_DIR" ]] && export NVM_DIR="$HOME/.nvm" +# nvm +# +# This plugin locates and loads nvm, looking for it in well-known locations. -# Don't try to load nvm if command already available -type "nvm" &> /dev/null && return +() { + emulate -L zsh + local nvm_install_dir="" dir install_locations + if [[ -n $NVM_INSTALL_DIR ]]; then + # User-specified path + nvm_install_dir=$NVM_INSTALL_DIR + else + # Well-known common installation locations for NVM + install_locations=( ~/.nvm ) + [[ -n $NVM_DIR ]] && install_locations=($NVM_DIR $install_locations) + # Mac Homebrew sticks + which brew &>/dev/null && install_locations+=$(brew --prefix nvm) + for dir ($install_locations); do + if [[ -s $dir/nvm.sh ]]; then + nvm_install_dir=$dir + break + fi + done + fi -# Load nvm if it exists in $NVM_DIR -if [[ -f "$NVM_DIR/nvm.sh" ]]; then - source "$NVM_DIR/nvm.sh" - return -fi + if [[ -n $nvm_install_dir ]]; then + source $nvm_install_dir/nvm.sh + else + # No NVM installation found + return 0 + fi -# Otherwise try to load nvm installed via Homebrew - -# User can set this if they have an unusual Homebrew setup -NVM_HOMEBREW="${NVM_HOMEBREW:-/usr/local/opt/nvm}" -# Load nvm from Homebrew location if it exists -[[ -f "$NVM_HOMEBREW/nvm.sh" ]] && source "$NVM_HOMEBREW/nvm.sh" -# Load nvm bash completion from Homebrew if it exists -if [[ -f "$NVM_HOMEBREW/etc/bash_completion.d/nvm" ]]; then - autoload -U +X bashcompinit && bashcompinit - source "$NVM_HOMEBREW/etc/bash_completion.d/nvm" -fi + # Locate and use the completion file shipped with NVM, instead of this + # plugin's completion + # (Their bash completion file has zsh portability support) + if [[ $ZSH_NVM_BUNDLED_COMPLETION == true ]]; then + local bash_comp_file + # Homebrew relocates the bash completion file, so look multiple places + for bash_comp_file ( bash_completion etc/bash_completion.d/nvm ); do + if [[ -s $nvm_install_dir/$bash_comp_file ]]; then + source $nvm_install_dir/$bash_comp_file + break; + fi + done + fi +} -- cgit v1.2.3-70-g09d2 From d8cb67023540c1e2e7e4e211e2f7c9fc2d4e0c3c Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Fri, 9 Oct 2020 16:12:03 +0200 Subject: nvm: simplify nvm.sh and bash completion loading --- lib/nvm.zsh | 4 +-- plugins/nvm/nvm.plugin.zsh | 67 ++++++++++++++++++---------------------------- 2 files changed, 27 insertions(+), 44 deletions(-) (limited to 'plugins') diff --git a/lib/nvm.zsh b/lib/nvm.zsh index c4f70c849..2fe57a8f4 100644 --- a/lib/nvm.zsh +++ b/lib/nvm.zsh @@ -1,8 +1,6 @@ # get the nvm-controlled node.js version function nvm_prompt_info() { - local nvm_prompt which nvm &>/dev/null || return - nvm_prompt=$(nvm current) - nvm_prompt=${nvm_prompt#v} + local nvm_prompt=${$(nvm current)#v} echo "${ZSH_THEME_NVM_PROMPT_PREFIX}${nvm_prompt}${ZSH_THEME_NVM_PROMPT_SUFFIX}" } diff --git a/plugins/nvm/nvm.plugin.zsh b/plugins/nvm/nvm.plugin.zsh index ee8d2324b..2c137894b 100644 --- a/plugins/nvm/nvm.plugin.zsh +++ b/plugins/nvm/nvm.plugin.zsh @@ -1,45 +1,30 @@ -# nvm -# -# This plugin locates and loads nvm, looking for it in well-known locations. +# Set NVM_DIR if it isn't already defined +[[ -z "$NVM_DIR" ]] && export NVM_DIR="$HOME/.nvm" -() { - emulate -L zsh - local nvm_install_dir="" dir install_locations - if [[ -n $NVM_INSTALL_DIR ]]; then - # User-specified path - nvm_install_dir=$NVM_INSTALL_DIR - else - # Well-known common installation locations for NVM - install_locations=( ~/.nvm ) - [[ -n $NVM_DIR ]] && install_locations=($NVM_DIR $install_locations) - # Mac Homebrew sticks - which brew &>/dev/null && install_locations+=$(brew --prefix nvm) - for dir ($install_locations); do - if [[ -s $dir/nvm.sh ]]; then - nvm_install_dir=$dir - break - fi - done - fi +# Don't try to load nvm if command already available +which nvm &> /dev/null && return - if [[ -n $nvm_install_dir ]]; then - source $nvm_install_dir/nvm.sh - else - # No NVM installation found - return 0 - fi +if [[ -f "$NVM_DIR/nvm.sh" ]]; then + # Load nvm if it exists in $NVM_DIR + source "$NVM_DIR/nvm.sh" +else + # Otherwise try to load nvm installed via Homebrew + # User can set this if they have an unusual Homebrew setup + NVM_HOMEBREW="${NVM_HOMEBREW:-/usr/local/opt/nvm}" + # Load nvm from Homebrew location if it exists + [[ -f "$NVM_HOMEBREW/nvm.sh" ]] && source "$NVM_HOMEBREW/nvm.sh" +fi - # Locate and use the completion file shipped with NVM, instead of this - # plugin's completion - # (Their bash completion file has zsh portability support) - if [[ $ZSH_NVM_BUNDLED_COMPLETION == true ]]; then - local bash_comp_file - # Homebrew relocates the bash completion file, so look multiple places - for bash_comp_file ( bash_completion etc/bash_completion.d/nvm ); do - if [[ -s $nvm_install_dir/$bash_comp_file ]]; then - source $nvm_install_dir/$bash_comp_file - break; - fi - done +# Load nvm bash completion +for nvm_completion in "$NVM_DIR/bash_completion" "$NVM_HOMEBREW/etc/bash_completion.d/nvm"; do + if [[ -f "$nvm_completion" ]]; then + # Load bashcompinit + autoload -U +X bashcompinit && bashcompinit + # Bypass compinit call in nvm bash completion script. See: + # https://github.com/nvm-sh/nvm/blob/4436638/bash_completion#L86-L93 + ZSH_VERSION= source "$nvm_completion" + break fi -} +done + +unset NVM_HOMEBREW nvm_completion -- cgit v1.2.3-70-g09d2 From d6f3630932f364370c08b5a02b88c74aed577463 Mon Sep 17 00:00:00 2001 From: Chigozirim C Date: Sat, 27 Apr 2019 01:38:14 -0600 Subject: nvm: check $XDG_CONFIG_HOME/nvm for an nvm installation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #7807 Co-authored-by: Marc Cornellà --- plugins/nvm/nvm.plugin.zsh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/nvm/nvm.plugin.zsh b/plugins/nvm/nvm.plugin.zsh index 2c137894b..21fb3112b 100644 --- a/plugins/nvm/nvm.plugin.zsh +++ b/plugins/nvm/nvm.plugin.zsh @@ -1,5 +1,11 @@ -# Set NVM_DIR if it isn't already defined -[[ -z "$NVM_DIR" ]] && export NVM_DIR="$HOME/.nvm" +# See https://github.com/nvm-sh/nvm#installation-and-update +if [[ -z "$NVM_DIR" ]]; then + if [[ -d "$HOME/.nvm" ]]; then + export NVM_DIR="$HOME/.nvm" + elif [[ -d "${XDG_CONFIG_HOME:-$HOME/.config}/nvm" ]]; then + export NVM_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/nvm" + fi +fi # Don't try to load nvm if command already available which nvm &> /dev/null && return -- cgit v1.2.3-70-g09d2 From 3e973080037ae68ac25a08545e7cdc60ba128900 Mon Sep 17 00:00:00 2001 From: Keith Yao Date: Mon, 17 Sep 2018 11:14:29 +0200 Subject: nvm: speed-up nvm loading with `--no-use` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #7138 Co-authored-by: Marc Cornellà --- plugins/nvm/nvm.plugin.zsh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/nvm/nvm.plugin.zsh b/plugins/nvm/nvm.plugin.zsh index 21fb3112b..640f1d45c 100644 --- a/plugins/nvm/nvm.plugin.zsh +++ b/plugins/nvm/nvm.plugin.zsh @@ -12,15 +12,22 @@ which nvm &> /dev/null && return if [[ -f "$NVM_DIR/nvm.sh" ]]; then # Load nvm if it exists in $NVM_DIR - source "$NVM_DIR/nvm.sh" + source "$NVM_DIR/nvm.sh" --no-use else # Otherwise try to load nvm installed via Homebrew # User can set this if they have an unusual Homebrew setup NVM_HOMEBREW="${NVM_HOMEBREW:-/usr/local/opt/nvm}" # Load nvm from Homebrew location if it exists - [[ -f "$NVM_HOMEBREW/nvm.sh" ]] && source "$NVM_HOMEBREW/nvm.sh" + [[ -f "$NVM_HOMEBREW/nvm.sh" ]] && source "$NVM_HOMEBREW/nvm.sh" --no-use fi +# Call nvm when first using node, npm or yarn +function node npm yarn { + unfunction node npm yarn + nvm use default + command "$0" "$@" +} + # Load nvm bash completion for nvm_completion in "$NVM_DIR/bash_completion" "$NVM_HOMEBREW/etc/bash_completion.d/nvm"; do if [[ -f "$nvm_completion" ]]; then -- cgit v1.2.3-70-g09d2 From a33c0cdb46badcc1df9a37da015a82f7f7b0a7e5 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Fri, 9 Oct 2020 16:35:47 +0200 Subject: nvm: only lazy-load nvm if the NVM_LAZY setting is set --- plugins/nvm/README.md | 4 ++++ plugins/nvm/nvm.plugin.zsh | 16 +++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) (limited to 'plugins') diff --git a/plugins/nvm/README.md b/plugins/nvm/README.md index 2515da9e8..ab71185cb 100644 --- a/plugins/nvm/README.md +++ b/plugins/nvm/README.md @@ -16,3 +16,7 @@ plugins=(... nvm) - **`NVM_HOMEBREW`**: if you installed nvm via Homebrew, in a directory other than `/usr/local/opt/nvm`, you can set `NVM_HOMEBREW` to be the directory where you installed it. + +- **`NVM_LAZY`**: if you want the plugin to defer the load of nvm to speed-up the start of your zsh session, + set `NVM_LAZY` to `1`. This will use the `--no-use` parameter when loading nvm, and will create a function + for `node`, `npm` and `yarn`, so when you call either of these three, nvm will load with `nvm use default`. diff --git a/plugins/nvm/nvm.plugin.zsh b/plugins/nvm/nvm.plugin.zsh index 640f1d45c..164be5907 100644 --- a/plugins/nvm/nvm.plugin.zsh +++ b/plugins/nvm/nvm.plugin.zsh @@ -12,21 +12,23 @@ which nvm &> /dev/null && return if [[ -f "$NVM_DIR/nvm.sh" ]]; then # Load nvm if it exists in $NVM_DIR - source "$NVM_DIR/nvm.sh" --no-use + source "$NVM_DIR/nvm.sh" ${NVM_LAZY+"--no-use"} else # Otherwise try to load nvm installed via Homebrew # User can set this if they have an unusual Homebrew setup NVM_HOMEBREW="${NVM_HOMEBREW:-/usr/local/opt/nvm}" # Load nvm from Homebrew location if it exists - [[ -f "$NVM_HOMEBREW/nvm.sh" ]] && source "$NVM_HOMEBREW/nvm.sh" --no-use + [[ -f "$NVM_HOMEBREW/nvm.sh" ]] && source "$NVM_HOMEBREW/nvm.sh" ${NVM_LAZY+"--no-use"} fi # Call nvm when first using node, npm or yarn -function node npm yarn { - unfunction node npm yarn - nvm use default - command "$0" "$@" -} +if (( $+NVM_LAZY )); then + function node npm yarn { + unfunction node npm yarn + nvm use default + command "$0" "$@" + } +fi # Load nvm bash completion for nvm_completion in "$NVM_DIR/bash_completion" "$NVM_HOMEBREW/etc/bash_completion.d/nvm"; do -- cgit v1.2.3-70-g09d2 From 8163f65084b86d5e63c1867d076ecdc8faca2f33 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Fri, 9 Oct 2020 16:40:13 +0200 Subject: nvm: exit the plugin if the nvm loading script wasn't found --- plugins/nvm/nvm.plugin.zsh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/nvm/nvm.plugin.zsh b/plugins/nvm/nvm.plugin.zsh index 164be5907..b2355b7ef 100644 --- a/plugins/nvm/nvm.plugin.zsh +++ b/plugins/nvm/nvm.plugin.zsh @@ -18,7 +18,12 @@ else # User can set this if they have an unusual Homebrew setup NVM_HOMEBREW="${NVM_HOMEBREW:-/usr/local/opt/nvm}" # Load nvm from Homebrew location if it exists - [[ -f "$NVM_HOMEBREW/nvm.sh" ]] && source "$NVM_HOMEBREW/nvm.sh" ${NVM_LAZY+"--no-use"} + if [[ -f "$NVM_HOMEBREW/nvm.sh" ]]; then + source "$NVM_HOMEBREW/nvm.sh" ${NVM_LAZY+"--no-use"} + else + # Exit the plugin if we couldn't find nvm + return + fi fi # Call nvm when first using node, npm or yarn @@ -42,4 +47,4 @@ for nvm_completion in "$NVM_DIR/bash_completion" "$NVM_HOMEBREW/etc/bash_complet fi done -unset NVM_HOMEBREW nvm_completion +unset NVM_HOMEBREW NVM_LAZY nvm_completion -- cgit v1.2.3-70-g09d2 From 8c8fe2a1715df916f0b5d785fee32c8a4a40c05b Mon Sep 17 00:00:00 2001 From: Danny Grove Date: Fri, 13 Jan 2017 17:15:12 -0800 Subject: nvm: add autoloading of nvm version in .nvmrc Closes #5782 Fixes #8959 Closes #8976 --- plugins/nvm/README.md | 4 ++++ plugins/nvm/nvm.plugin.zsh | 29 ++++++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/nvm/README.md b/plugins/nvm/README.md index ab71185cb..749a43403 100644 --- a/plugins/nvm/README.md +++ b/plugins/nvm/README.md @@ -20,3 +20,7 @@ plugins=(... nvm) - **`NVM_LAZY`**: if you want the plugin to defer the load of nvm to speed-up the start of your zsh session, set `NVM_LAZY` to `1`. This will use the `--no-use` parameter when loading nvm, and will create a function for `node`, `npm` and `yarn`, so when you call either of these three, nvm will load with `nvm use default`. + +- **`NVM_AUTOLOAD`**: if `NVM_AUTOLOAD` is set to `1`, the plugin will automatically load a node version when + if finds a [`.nvmrc` file](https://github.com/nvm-sh/nvm#nvmrc) in the current working directory indicating + which node version to load. diff --git a/plugins/nvm/nvm.plugin.zsh b/plugins/nvm/nvm.plugin.zsh index b2355b7ef..1e9b26e7a 100644 --- a/plugins/nvm/nvm.plugin.zsh +++ b/plugins/nvm/nvm.plugin.zsh @@ -35,6 +35,33 @@ if (( $+NVM_LAZY )); then } fi +# Autoload nvm when finding a .nvmrc file in the current directory +# Adapted from: https://github.com/nvm-sh/nvm#zsh +if (( $+NVM_AUTOLOAD )); then + load-nvmrc() { + local node_version="$(nvm version)" + local nvmrc_path="$(nvm_find_nvmrc)" + + if [[ -n "$nvmrc_path" ]]; then + local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")") + + if [[ "$nvmrc_node_version" = "N/A" ]]; then + nvm install + elif [[ "$nvmrc_node_version" != "$node_version" ]]; then + nvm use + fi + elif [[ "$node_version" != "$(nvm version default)" ]]; then + echo "Reverting to nvm default version" + nvm use default + fi + } + + autoload -U add-zsh-hook + add-zsh-hook chpwd load-nvmrc + + load-nvmrc +fi + # Load nvm bash completion for nvm_completion in "$NVM_DIR/bash_completion" "$NVM_HOMEBREW/etc/bash_completion.d/nvm"; do if [[ -f "$nvm_completion" ]]; then @@ -47,4 +74,4 @@ for nvm_completion in "$NVM_DIR/bash_completion" "$NVM_HOMEBREW/etc/bash_complet fi done -unset NVM_HOMEBREW NVM_LAZY nvm_completion +unset NVM_HOMEBREW NVM_LAZY NVM_AUTOLOAD nvm_completion -- cgit v1.2.3-70-g09d2 From 2abe4d6a2576f064c09ce78b32005e7437a93ee0 Mon Sep 17 00:00:00 2001 From: Atk Date: Fri, 9 Oct 2020 16:38:02 +0100 Subject: wd: update to v0.5.1 (#9273) --- plugins/wd/wd.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'plugins') diff --git a/plugins/wd/wd.sh b/plugins/wd/wd.sh index d5d38f25b..9085c5b7b 100644 --- a/plugins/wd/wd.sh +++ b/plugins/wd/wd.sh @@ -71,7 +71,7 @@ wd_print_msg() wd_print_usage() { - cat <<- EOF + command cat <<- EOF Usage: wd [command] [point] Commands: @@ -175,9 +175,9 @@ wd_add() elif [[ $point =~ "[[:space:]]+" ]] then wd_exit_fail "Warp point should not contain whitespace" - elif [[ $point == *:* ]] + elif [[ $point =~ : ]] || [[ $point =~ / ]] then - wd_exit_fail "Warp point cannot contain colons" + wd_exit_fail "Warp point contains illegal character (:/)" elif [[ ${points[$point]} == "" ]] || [ ! -z "$force" ] then wd_remove "$point" > /dev/null @@ -185,7 +185,7 @@ wd_add() if (whence sort >/dev/null); then local config_tmp=$(mktemp "${TMPDIR:-/tmp}/wd.XXXXXXXXXX") # use 'cat' below to ensure we respect $WD_CONFIG as a symlink - sort -o "${config_tmp}" "$WD_CONFIG" && cat "${config_tmp}" > "$WD_CONFIG" && rm "${config_tmp}" + command sort -o "${config_tmp}" "$WD_CONFIG" && command cat "${config_tmp}" > "$WD_CONFIG" && command rm "${config_tmp}" fi wd_export_static_named_directories @@ -270,7 +270,7 @@ wd_ls() wd_path() { wd_getdir "$1" - echo "$(echo "$dir" | sed "s:${HOME}:~:g")" + echo "$(echo "$dir" | sed "s:~:${HOME}:g")" } wd_show() -- cgit v1.2.3-70-g09d2 From e93a2dca0e893cd1518e98cce44b55a6dbf29c1a Mon Sep 17 00:00:00 2001 From: Geoffrey GREBERT Date: Fri, 9 Oct 2020 17:42:44 +0200 Subject: mvn: add Quarkus support in mvn completion (#9037) Co-authored-by: Geoffrey GREBERT --- plugins/mvn/README.md | 1 + plugins/mvn/mvn.plugin.zsh | 3 +++ 2 files changed, 4 insertions(+) (limited to 'plugins') diff --git a/plugins/mvn/README.md b/plugins/mvn/README.md index cbe7f30fa..815dfd57c 100644 --- a/plugins/mvn/README.md +++ b/plugins/mvn/README.md @@ -19,6 +19,7 @@ if it's found, or the mvn command otherwise. | `mvn!` | `mvn -f /pom.xml` | | `mvnag` | `mvn archetype:generate` | | `mvnboot` | `mvn spring-boot:run` | +| `mvnqdev` | `mvn quarkus:dev` | | `mvnc` | `mvn clean` | | `mvncd` | `mvn clean deploy` | | `mvnce` | `mvn clean eclipse:clean eclipse:eclipse` | diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index 7cb94b42f..c616da789 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -62,6 +62,7 @@ alias mvne='mvn eclipse:eclipse' alias mvnfmt='mvn fmt:format' alias mvnjetty='mvn jetty:run' alias mvnp='mvn package' +alias mvnqdev='mvn quarkus:dev' alias mvns='mvn site' alias mvnsrc='mvn dependency:sources' alias mvnt='mvn test' @@ -184,6 +185,8 @@ function listMavenCompletions { tomee:run tomee:run-war tomee:run-war-only tomee:stop tomee:deploy tomee:undeploy # spring-boot spring-boot:run spring-boot:repackage + # quarkus + quarkus:dev quarkus:list-extensions quarkus:add-extension quarkus:add-extensions quarkus:generate-config quarkus:help # exec exec:exec exec:java # versions -- cgit v1.2.3-70-g09d2 From a5e706d749e4218820391cb7ea374c6ddd248933 Mon Sep 17 00:00:00 2001 From: James Zhang Date: Fri, 9 Oct 2020 23:45:30 +0800 Subject: mvn: list modules (directories with pom.xml) (#8478) Co-authored-by: zhangjinyan1 --- plugins/mvn/mvn.plugin.zsh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'plugins') diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index c616da789..27d63a6f9 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -73,7 +73,7 @@ alias mvn-updates='mvn versions:display-dependency-updates' function listMavenCompletions { local file new_file - local -a profiles POM_FILES + local -a profiles POM_FILES modules # Root POM POM_FILES=(~/.m2/settings.xml) @@ -109,6 +109,9 @@ function listMavenCompletions { profiles+=($(sed 's///' "$file" | sed '//d' | grep -e "" -A 1 | grep -e ".*" | sed 's?.*\(.*\)<\/id>.*?-P\1?')) done + # List modules + modules=($(find **/pom.xml -type f | grep -v '/target/classes/META-INF/' | grep '/pom.xml' |sed 's|\(.*\)/pom\.xml|\1|')) + reply=( # common lifecycle clean initialize process-resources compile process-test-resources test-compile test package verify install deploy site @@ -271,8 +274,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 + #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=" @@ -323,6 +326,7 @@ function listMavenCompletions { -Dit.test=$(if [ -d ./src/test/java ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dit.test=\1?' ; fi) $profiles + $modules ) } -- cgit v1.2.3-70-g09d2 From 4cd5f7f9202bd062871662836ea837c9abea6e5d Mon Sep 17 00:00:00 2001 From: Joshua Bedford Date: Fri, 9 Oct 2020 16:13:00 -0500 Subject: Add lando plugin (#8748) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Joshua Bedford Co-authored-by: Marc Cornellà --- plugins/lando/LICENSE | 21 +++++++++++++++++++++ plugins/lando/README.md | 37 +++++++++++++++++++++++++++++++++++++ plugins/lando/lando.plugin.zsh | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 98 insertions(+) create mode 100644 plugins/lando/LICENSE create mode 100644 plugins/lando/README.md create mode 100644 plugins/lando/lando.plugin.zsh (limited to 'plugins') diff --git a/plugins/lando/LICENSE b/plugins/lando/LICENSE new file mode 100644 index 000000000..1d4983163 --- /dev/null +++ b/plugins/lando/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Joshua Bedford + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/plugins/lando/README.md b/plugins/lando/README.md new file mode 100644 index 000000000..928a42bca --- /dev/null +++ b/plugins/lando/README.md @@ -0,0 +1,37 @@ +# Lando ZSH (lando-zsh) + +This plugin adds aliases for using various languages and frameworks with [Lando](https://docs.lando.dev/basics/) for Docker. It will only run within lando-driven project directories. + +To use it, add `lando` to the plugins array in your zshrc file: + +```zsh +plugins=(... lando) +``` + +## ALIASES: + +| Alias | Description | +|:----------:|:----------------:| +| `artisan` | `lando artisan` | +| `composer` | `lando composer` | +| `drush` | `lando drush` | +| `gulp` | `lando gulp` | +| `npm` | `lando npm` | +| `wp` | `lando wp` | +| `yarn` | `lando yarn` | + +## How It Works: + +This plugin removes the requirement to type `lando` before a command. It utilizes the lando version of supported commands run within directories with the following criteria: +- The `.lando.yml` file is found in the current directory or any parent directory within `$LANDO_ZSH_SITES_DIRECTORY`. +- The current directory is within `$LANDO_ZSH_SITES_DIRECTORY` but is not `$LANDO_ZSH_SITES_DIRECTORY` itself. + +## Settings: + +- `LANDO_ZSH_SITES_DIRECTORY`: The plugin will stop searching through parents for `CONFIG_FILE` once it hits this directory. +- `LANDO_ZSH_CONFIG_FILE`: The plugin will check to see if this provided file exists to check for presence of Lando. + +## Author: + +- Author: Joshua Bedford +- URL: [https://github.com/joshuabedford/lando-zsh](https://github.com/joshuabedford/lando-zsh) diff --git a/plugins/lando/lando.plugin.zsh b/plugins/lando/lando.plugin.zsh new file mode 100644 index 000000000..aa74c9924 --- /dev/null +++ b/plugins/lando/lando.plugin.zsh @@ -0,0 +1,40 @@ +# Settings +: ${LANDO_ZSH_SITES_DIRECTORY:="$HOME/Sites"} +: ${LANDO_ZSH_CONFIG_FILE:=.lando.yml} + +# Enable multiple commands with lando. +function artisan \ + composer \ + drush \ + gulp \ + npm \ + wp \ + yarn { + if checkForLandoFile; then + lando "$0" "$@" + else + command "$0" "$@" + fi +} + +# Check for the file in the current and parent directories. +checkForLandoFile() { + # Only bother checking for lando within the Sites directory. + if [[ "$PWD/" != "$LANDO_ZSH_SITES_DIRECTORY"/* ]]; then + # Not within $LANDO_ZSH_SITES_DIRECTORY + return 1 + fi + + local curr_dir="$PWD" + # Checking for file: $LANDO_ZSH_CONFIG_FILE within $LANDO_ZSH_SITES_DIRECTORY... + while [[ "$curr_dir" != "$LANDO_ZSH_SITES_DIRECTORY" ]]; do + if [[ -f "$curr_dir/$LANDO_ZSH_CONFIG_FILE" ]]; then + return 0 + fi + curr_dir="${curr_dir:h}" + done + + # Could not find $LANDO_ZSH_CONFIG_FILE in the current directory + # or in any of its parents up to $LANDO_ZSH_SITES_DIRECTORY. + return 1 +} \ No newline at end of file -- cgit v1.2.3-70-g09d2 From 1744277a68101916d51cda2c67951f5981f1f216 Mon Sep 17 00:00:00 2001 From: Joshua Pratt Date: Sun, 11 Oct 2020 23:17:21 +1100 Subject: systemadmin: correct sort order for psmem aliases (#6253) --- plugins/systemadmin/README.md | 4 ++-- plugins/systemadmin/systemadmin.plugin.zsh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'plugins') diff --git a/plugins/systemadmin/README.md b/plugins/systemadmin/README.md index edca4d87d..243db03f2 100644 --- a/plugins/systemadmin/README.md +++ b/plugins/systemadmin/README.md @@ -16,8 +16,8 @@ plugins=(... systemadmin) | clr | `clear; echo Currently logged in on $TTY, as $USER in directory $PWD.` | Clears the screen and prints the current user, TTY, and directory | | path | `print -l $path` | Displays PATH with each entry on a separate line | | mkdir | `mkdir -pv` | Automatically create parent directories and display verbose output | -| psmem | `ps -e -orss=,args= \| sort -b -k1,1n` | Display the processes using the most memory | -| psmem10 | `ps -e -orss=,args= \| sort -b -k1,1n \| head -10` | Display the top 10 processes using the most memory | +| psmem | `ps -e -orss=,args= \| sort -b -k1 -nr` | Display the processes using the most memory | +| psmem10 | `ps -e -orss=,args= \| sort -b -k1 -nr \| head -10` | Display the top 10 processes using the most memory | | pscpu | `ps -e -o pcpu,cpu,nice,state,cputime,args \|sort -k1 -nr` | Display the top processes using the most CPU | | pscpu10 | `ps -e -o pcpu,cpu,nice,state,cputime,args \|sort -k1 -nr \| head -10` | Display the top 10 processes using the most CPU | | hist10 | `print -l ${(o)history%% *} \| uniq -c \| sort -nr \| head -n 10` | Display the top 10 most used commands in the history | diff --git a/plugins/systemadmin/systemadmin.plugin.zsh b/plugins/systemadmin/systemadmin.plugin.zsh index ded25c3a9..03064c035 100644 --- a/plugins/systemadmin/systemadmin.plugin.zsh +++ b/plugins/systemadmin/systemadmin.plugin.zsh @@ -25,8 +25,8 @@ alias clr='clear; echo Currently logged in on $TTY, as $USER in directory $PWD.' alias path='print -l $path' alias mkdir='mkdir -pv' # get top process eating memory -alias psmem='ps -e -orss=,args= | sort -b -k1,1n' -alias psmem10='ps -e -orss=,args= | sort -b -k1,1n| head -10' +alias psmem='ps -e -orss=,args= | sort -b -k1 -nr' +alias psmem10='ps -e -orss=,args= | sort -b -k1 -nr | head -10' # get top process eating cpu if not work try excute : export LC_ALL='C' alias pscpu='ps -e -o pcpu,cpu,nice,state,cputime,args|sort -k1,1n -nr' alias pscpu10='ps -e -o pcpu,cpu,nice,state,cputime,args|sort -k1,1n -nr | head -10' -- cgit v1.2.3-70-g09d2 From fb80eb8e05e13cfb224114688fc7d20960e26b5f Mon Sep 17 00:00:00 2001 From: Ivan Dario Piernagorda Peña <48845582+IVAN-DPP@users.noreply.github.com> Date: Sun, 11 Oct 2020 11:05:14 -0500 Subject: emacs: add ansi-term directory tracking (#9218) --- plugins/emacs/emacs.plugin.zsh | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'plugins') diff --git a/plugins/emacs/emacs.plugin.zsh b/plugins/emacs/emacs.plugin.zsh index db0ab13af..0b602d12a 100644 --- a/plugins/emacs/emacs.plugin.zsh +++ b/plugins/emacs/emacs.plugin.zsh @@ -26,6 +26,16 @@ if "$ZSH/tools/require_tool.sh" emacsclient 24 2>/dev/null ; then # create a new X frame alias eframe='emacsclient --alternate-editor "" --create-frame' + # Emacs ANSI Term tracking + if [[ -n "$INSIDE_EMACS" ]]; then + chpwd_emacs() { print -P "\033AnSiTc %d"; } + print -P "\033AnSiTc %d" # Track current working directory + print -P "\033AnSiTu %n" # Track username + + # add chpwd hook + autoload -Uz add-zsh-hook + add-zsh-hook chpwd chpwd_emacs + fi # Write to standard output the path to the file # opened in the current buffer. -- cgit v1.2.3-70-g09d2 From 82856bfbd86ac77f0f28ab741a399a04495ed3bc Mon Sep 17 00:00:00 2001 From: VectorW <15570764+VectorWpl@users.noreply.github.com> Date: Sun, 11 Oct 2020 21:23:21 +0200 Subject: globalias: allow filtering values not to be expanded (#9331) --- plugins/globalias/README.md | 19 ++++++++++++++++++- plugins/globalias/globalias.plugin.zsh | 6 ++++-- 2 files changed, 22 insertions(+), 3 deletions(-) (limited to 'plugins') diff --git a/plugins/globalias/README.md b/plugins/globalias/README.md index 0b064105d..cd7fc3cb2 100644 --- a/plugins/globalias/README.md +++ b/plugins/globalias/README.md @@ -17,6 +17,9 @@ Then just press `SPACE` to trigger the expansion of a command you've written. If you only want to insert a space without expanding the command line, press `CTRL`+`SPACE`. +if you would like to filter out any values from expanding set `GLOBALIAS_FILTER_VALUES` to +an array of said values. See [Filtered values](#filtered-values). + ## Examples #### Glob expressions @@ -37,7 +40,6 @@ $ ls folder/file.json anotherfolder/another.json $ mkdir "`date -R`" # expands to $ mkdir Tue,\ 04\ Oct\ 2016\ 13:54:03\ +0300 - ``` #### Aliases @@ -60,3 +62,18 @@ $ S # expands to: $ sudo systemctl ``` + +#### Filtered values + +``` +# .zshrc +alias l='ls -lh' +alias la='ls --color=auto -lah' +GLOBALIAS_FILTER_VALUES=(l) + +$ l +# does not expand +$ la +# expands to: +$ ls --color=auto -lah +``` diff --git a/plugins/globalias/globalias.plugin.zsh b/plugins/globalias/globalias.plugin.zsh index 9602a9606..f8c07ce43 100644 --- a/plugins/globalias/globalias.plugin.zsh +++ b/plugins/globalias/globalias.plugin.zsh @@ -1,6 +1,8 @@ globalias() { - zle _expand_alias - zle expand-word + if [[ $GLOBALIAS_FILTER_VALUES[(Ie)$LBUFFER] -eq 0 ]]; then + zle _expand_alias + zle expand-word + fi zle self-insert } zle -N globalias -- cgit v1.2.3-70-g09d2 From a39bee8d11aca960651403dddbb7dba38b00183e Mon Sep 17 00:00:00 2001 From: Gonçalo Queirós Date: Tue, 13 Oct 2020 10:28:51 +0100 Subject: git-prompt: document Python prerequisite in README (#9336) --- plugins/git-prompt/README.md | 3 +++ 1 file changed, 3 insertions(+) (limited to 'plugins') diff --git a/plugins/git-prompt/README.md b/plugins/git-prompt/README.md index e3b2d623a..83948f536 100644 --- a/plugins/git-prompt/README.md +++ b/plugins/git-prompt/README.md @@ -11,6 +11,9 @@ plugins=(... git-prompt) See the [original repository](https://github.com/olivierverdier/zsh-git-prompt). +## Prerequisites +This plugin uses `python`, so your host needs to have it installed + ## Examples The prompt may look like the following: -- cgit v1.2.3-70-g09d2 From 568a977d2076b4210a9a925c53abcf0a831e4003 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Tue, 13 Oct 2020 20:32:42 +0200 Subject: safe-paste: fix _bracketed_paste_zle_init/finish error Fixes #9337 --- plugins/safe-paste/safe-paste.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/safe-paste/safe-paste.plugin.zsh b/plugins/safe-paste/safe-paste.plugin.zsh index db524538c..d443ae8a2 100644 --- a/plugins/safe-paste/safe-paste.plugin.zsh +++ b/plugins/safe-paste/safe-paste.plugin.zsh @@ -84,7 +84,7 @@ _bracketed_paste_enqueue() { _bracketed_paste_zle_init() { _bracketed_paste_content='' # Tell terminal to send escape codes around pastes - if [ $TERM =~ '^(rxvt-unicode|xterm(-256color)?|screen(-256color)?)$' ]; then + if [[ $TERM =~ '^(rxvt-unicode|xterm(-256color)?|screen(-256color)?)$' ]]; then printf '\e[?2004h' fi } @@ -93,7 +93,7 @@ _bracketed_paste_zle_init() { _bracketed_paste_zle_finish() { # Turn off bracketed paste when we leave ZLE, so pasting in other programs # doesn't get the ^[[200~ codes around the pasted text - if [ $TERM =~ '^(rxvt-unicode|xterm(-256color)?|screen(-256color)?)$' ]; then + if [[ $TERM =~ '^(rxvt-unicode|xterm(-256color)?|screen(-256color)?)$' ]]; then printf '\e[?2004l' fi } -- cgit v1.2.3-70-g09d2 From e75aa2875eea94fcf7ceb3f246db96cc3bc61a2e Mon Sep 17 00:00:00 2001 From: "Patrick W. Healy" Date: Wed, 14 Oct 2020 09:57:59 -0500 Subject: globalias: expand filtering to anywhere in the command (#9338) --- plugins/globalias/globalias.plugin.zsh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/globalias/globalias.plugin.zsh b/plugins/globalias/globalias.plugin.zsh index f8c07ce43..d4d40c863 100644 --- a/plugins/globalias/globalias.plugin.zsh +++ b/plugins/globalias/globalias.plugin.zsh @@ -1,5 +1,7 @@ globalias() { - if [[ $GLOBALIAS_FILTER_VALUES[(Ie)$LBUFFER] -eq 0 ]]; then + # Get last word to the left of the cursor + local word=${${(A)=LBUFFER}[-1]} + if [[ $GLOBALIAS_FILTER_VALUES[(Ie)$word] -eq 0 ]]; then zle _expand_alias zle expand-word fi -- cgit v1.2.3-70-g09d2 From 53cbd658f5ae6874af0d804cee6748dfba69e786 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Wed, 14 Oct 2020 17:23:03 +0200 Subject: globalias: use ${(z)var} to split into words using shell parsing --- plugins/globalias/globalias.plugin.zsh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/globalias/globalias.plugin.zsh b/plugins/globalias/globalias.plugin.zsh index d4d40c863..bd27d589d 100644 --- a/plugins/globalias/globalias.plugin.zsh +++ b/plugins/globalias/globalias.plugin.zsh @@ -1,6 +1,8 @@ globalias() { - # Get last word to the left of the cursor - local word=${${(A)=LBUFFER}[-1]} + # Get last word to the left of the cursor: + # (z) splits into words using shell parsing + # (A) makes it an array even if there's only one element + local word=${${(Az)LBUFFER}[-1]} if [[ $GLOBALIAS_FILTER_VALUES[(Ie)$word] -eq 0 ]]; then zle _expand_alias zle expand-word -- cgit v1.2.3-70-g09d2 From 5b717ab3e4bfb627a936d7c04367a39867734d63 Mon Sep 17 00:00:00 2001 From: IsThisTheMatrix <46820823+causalityloop@users.noreply.github.com> Date: Thu, 15 Oct 2020 18:52:34 -0400 Subject: kubectl: verify kubectl is installed before running compdef (#9346) --- plugins/kubectl/kubectl.plugin.zsh | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) (limited to 'plugins') diff --git a/plugins/kubectl/kubectl.plugin.zsh b/plugins/kubectl/kubectl.plugin.zsh index 6292a0b2f..7a0c47945 100644 --- a/plugins/kubectl/kubectl.plugin.zsh +++ b/plugins/kubectl/kubectl.plugin.zsh @@ -150,19 +150,13 @@ alias kepvc='kubectl edit pvc' alias kdpvc='kubectl describe pvc' alias kdelpvc='kubectl delete pvc' -# Colored JSON output -kj() { - kubectl "$@" -o json | jq -} -compdef kj=kubectl - -kjx() { - kubectl "$@" -o json | fx -} -compdef kjx=kubectl +# Only run if the user actually has kubectl installed +if (( $+commands[kubectl] )); then + kj() { kubectl "$@" -o json | jq; } + kjx() { kubectl "$@" -o json | fx; } + ky() { kubectl "$@" -o yaml | yh; } -# Colored YAML output -ky() { - kubectl "$@" -o yaml | yh -} -compdef ky=kubectl + compdef kj=kubectl + compdef kjx=kubectl + compdef ky=kubectl +fi -- cgit v1.2.3-70-g09d2 From 176376cbc026bb5339a00a6486882649d250469a Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Sat, 17 Oct 2020 23:14:58 +0200 Subject: kubectl: check for empty cache completion file --- plugins/kubectl/kubectl.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/kubectl/kubectl.plugin.zsh b/plugins/kubectl/kubectl.plugin.zsh index 7a0c47945..0b1edb450 100644 --- a/plugins/kubectl/kubectl.plugin.zsh +++ b/plugins/kubectl/kubectl.plugin.zsh @@ -1,7 +1,7 @@ if (( $+commands[kubectl] )); then __KUBECTL_COMPLETION_FILE="${ZSH_CACHE_DIR}/kubectl_completion" - if [[ ! -f $__KUBECTL_COMPLETION_FILE ]]; then + if [[ ! -f $__KUBECTL_COMPLETION_FILE || ! -s $__KUBECTL_COMPLETION_FILE ]]; then kubectl completion zsh >! $__KUBECTL_COMPLETION_FILE fi @@ -151,7 +151,7 @@ alias kdpvc='kubectl describe pvc' alias kdelpvc='kubectl delete pvc' # Only run if the user actually has kubectl installed -if (( $+commands[kubectl] )); then +if (( ${+_comps[kubectl]} )); then kj() { kubectl "$@" -o json | jq; } kjx() { kubectl "$@" -o json | fx; } ky() { kubectl "$@" -o yaml | yh; } -- cgit v1.2.3-70-g09d2 From 7d73908223222d3df7f36ed5a362fcfccd770ca5 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Tue, 20 Oct 2020 23:48:59 +0200 Subject: fzf: add check for OpenSUSE and OpenBSD packages (#9327) --- plugins/fzf/README.md | 51 ++++++++++++------ plugins/fzf/fzf.plugin.zsh | 125 ++++++++++++++++++++++++++++++++------------- 2 files changed, 124 insertions(+), 52 deletions(-) (limited to 'plugins') diff --git a/plugins/fzf/README.md b/plugins/fzf/README.md index d9617563a..791a3eb6f 100644 --- a/plugins/fzf/README.md +++ b/plugins/fzf/README.md @@ -1,33 +1,52 @@ # fzf -This plugin enables [junegunn's fzf](https://github.com/junegunn/fzf) fuzzy auto-completion and key bindings +This plugin tries to find [junegunn's fzf](https://github.com/junegunn/fzf) based on where +it's been installed, and enables its fuzzy auto-completion and key bindings. To use it, add `fzf` to the plugins array in your zshrc file: + ```zsh plugins=(... fzf) ``` ## Settings -Add these before the `plugins=()` line in your zshrc file: +All these settings should go in your zshrc file, before Oh My Zsh is sourced. + +### `FZF_BASE` + +Set to fzf installation directory path: + +```zsh +export FZF_BASE=/path/to/fzf/install/dir +``` + +### `FZF_DEFAULT_COMMAND` + +Set default command to use when input is tty: ```zsh -# Set fzf installation directory path -# export FZF_BASE=/path/to/fzf/install/dir +export FZF_DEFAULT_COMMAND='' +``` + +If not set, the plugin will try to set it to these, in the order in which they're found: -# Uncomment to set the FZF_DEFAULT_COMMAND -# export FZF_DEFAULT_COMMAND='' +- [`rg`](https://github.com/BurntSushi/ripgrep) +- [`fd`](https://github.com/sharkdp/fd) +- [`ag`](https://github.com/ggreer/the_silver_searcher) -# Uncomment the following line to disable fuzzy completion -# DISABLE_FZF_AUTO_COMPLETION="true" +### `DISABLE_FZF_AUTO_COMPLETION` -# Uncomment the following line to disable key bindings (CTRL-T, CTRL-R, ALT-C) -# DISABLE_FZF_KEY_BINDINGS="true" +Set whether to load fzf auto-completion: + +```zsh +DISABLE_FZF_AUTO_COMPLETION="true" ``` -| Setting | Example value | Description | -|-----------------------------|----------------------------|-------------------------------------------------------------| -| FZF_BASE | `/path/to/fzf/install/dir` | Set fzf installation directory path (**export**) | -| FZF_DEFAULT_COMMAND | `fd --type f` | Set default command to use when input is tty (**export**) | -| DISABLE_FZF_AUTO_COMPLETION | `true` | Set whether to load fzf auto-completion | -| DISABLE_FZF_KEY_BINDINGS | `true` | Set whether to disable key bindings (CTRL-T, CTRL-R, ALT-C) | +### `DISABLE_FZF_KEY_BINDINGS` + +Set whether to disable key bindings (CTRL-T, CTRL-R, ALT-C): + +```zsh +DISABLE_FZF_KEY_BINDINGS="true" +``` diff --git a/plugins/fzf/fzf.plugin.zsh b/plugins/fzf/fzf.plugin.zsh index 0b831b7f7..2f48215d5 100644 --- a/plugins/fzf/fzf.plugin.zsh +++ b/plugins/fzf/fzf.plugin.zsh @@ -1,9 +1,5 @@ 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 + local fzf_base fzf_shell fzfdirs dir test -d "${FZF_BASE}" && fzf_base="${FZF_BASE}" @@ -31,38 +27,37 @@ function setup_using_base_dir() { fi fi - if [[ -d "${fzf_base}" ]]; then - # Fix fzf shell directory for Arch Linux, NixOS or Void Linux packages - if [[ ! -d "${fzf_base}/shell" ]]; then - fzf_shell="${fzf_base}" - else - fzf_shell="${fzf_base}/shell" - fi + if [[ ! -d "${fzf_base}" ]]; then + return 1 + fi - # Setup fzf binary path - if ! (( ${+commands[fzf]} )) && [[ ! "$PATH" == *$fzf_base/bin* ]]; then - export PATH="$PATH:$fzf_base/bin" - fi + # Fix fzf shell directory for Arch Linux, NixOS or Void Linux packages + if [[ ! -d "${fzf_base}/shell" ]]; then + fzf_shell="${fzf_base}" + else + fzf_shell="${fzf_base}/shell" + fi - # Auto-completion - if [[ ! "$DISABLE_FZF_AUTO_COMPLETION" == "true" ]]; then - [[ $- == *i* ]] && source "${fzf_shell}/completion.zsh" 2> /dev/null - fi + # Setup fzf binary path + if (( ! ${+commands[fzf]} )) && [[ "$PATH" != *$fzf_base/bin* ]]; then + export PATH="$PATH:$fzf_base/bin" + fi - # Key bindings - if [[ ! "$DISABLE_FZF_KEY_BINDINGS" == "true" ]]; then - source "${fzf_shell}/key-bindings.zsh" - fi - else - return 1 + # Auto-completion + if [[ -o interactive && "$DISABLE_FZF_AUTO_COMPLETION" != "true" ]]; then + 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 } function setup_using_debian_package() { - (( $+commands[dpkg] )) && dpkg -s fzf &> /dev/null - if (( $? )); then - # Either not a debian based distro, or no fzf installed. In any case skip ahead + if (( ! $+commands[dpkg] )) || ! dpkg -s fzf &>/dev/null; then + # Either not a debian based distro, or no fzf installed return 1 fi @@ -76,8 +71,8 @@ function setup_using_debian_package() { 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 + if [[ -o interactive && "$DISABLE_FZF_AUTO_COMPLETION" != "true" ]]; then + source $completions 2> /dev/null fi # Key bindings @@ -88,16 +83,74 @@ function setup_using_debian_package() { return 0 } +function setup_using_opensuse_package() { + # OpenSUSE installs fzf in /usr/bin/fzf + # If the command is not found, the package isn't installed + (( $+commands[fzf] )) || return 1 + + # The fzf-zsh-completion package installs the auto-completion in + local completions="/usr/share/zsh/site-functions/_fzf" + # The fzf-zsh-completion package installs the key-bindings file in + local key_bindings="/etc/zsh_completion.d/fzf-key-bindings" + + # If these are not found: (1) maybe we're not on OpenSUSE, or + # (2) maybe the fzf-zsh-completion package isn't installed. + if [[ ! -f "$completions" || ! -f "$key_bindings" ]]; then + return 1 + fi + + # Auto-completion + if [[ -o interactive && "$DISABLE_FZF_AUTO_COMPLETION" != "true" ]]; then + source "$completions" 2>/dev/null + fi + + # Key bindings + if [[ "$DISABLE_FZF_KEY_BINDINGS" != "true" ]]; then + source "$key_bindings" 2>/dev/null + fi + + return 0 +} + +function setup_using_openbsd_package() { + # openBSD installs fzf in /usr/local/bin/fzf + if [[ "$OSTYPE" != openbsd* ]] || (( ! $+commands[fzf] )); then + return 1 + fi + + # The fzf package installs the auto-completion in + local completions="/usr/local/share/zsh/site-functions/_fzf_completion" + # The fzf package installs the key-bindings file in + local key_bindings="/usr/local/share/zsh/site-functions/_fzf_key_bindings" + + # Auto-completion + if [[ -o interactive && "$DISABLE_FZF_AUTO_COMPLETION" != "true" ]]; then + source "$completions" 2>/dev/null + fi + + # Key bindings + if [[ "$DISABLE_FZF_KEY_BINDINGS" != "true" ]]; then + source "$key_bindings" 2>/dev/null + 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 + cat >&2 < Date: Wed, 21 Oct 2020 22:09:54 +0800 Subject: kubectl: add aliases for serviceaccount, daemonsets and cronjob (#9344) --- plugins/kubectl/README.md | 23 +++++++++++++++++++---- plugins/kubectl/kubectl.plugin.zsh | 18 ++++++++++++++++++ 2 files changed, 37 insertions(+), 4 deletions(-) (limited to 'plugins') diff --git a/plugins/kubectl/README.md b/plugins/kubectl/README.md index 84f5f8d89..7a6cdaa59 100644 --- a/plugins/kubectl/README.md +++ b/plugins/kubectl/README.md @@ -22,7 +22,7 @@ plugins=(... kubectl) | kcsc | `kubectl config set-context` | Set a context entry in kubeconfig | | kcdc | `kubectl config delete-context` | Delete the specified context from the kubeconfig | | kccc | `kubectl config current-context` | Display the current-context | -| kcgc | `kubectl config get-contexts` | List of contexts available +| kcgc | `kubectl config get-contexts` | List of contexts available | | | **General aliases** | | kdel | `kubectl delete` | Delete resources by filenames, stdin, resources and names, or by resources and label selector | | kdelf | `kubectl delete -f` | Delete a pod using the type and name specified in -f argument | @@ -91,13 +91,13 @@ plugins=(... kubectl) | keno | `kubectl edit node` | Edit nodes resource from the default editor | | kdno | `kubectl describe node` | Describe node resource in detail | | kdelno | `kubectl delete node` | Delete the node | -| | | **Persistent Volume Claim management** | +| | | **Persistent Volume Claim management** | | kgpvc | `kubectl get pvc` | List all PVCs | | kgpvcw | `kgpvc --watch` | After listing/getting the requested object, watch for changes | | kepvc | `kubectl edit pvc` | Edit pvcs from the default editor | -| kdpvc | `kubectl describe pvc` | Descirbe all pvcs | +| kdpvc | `kubectl describe pvc` | Describe all pvcs | | kdelpvc | `kubectl delete pvc` | Delete all pvcs matching passed arguments | -| | | | +| | | **StatefulSets management** | | kgss | `kubectl get statefulset` | List the statefulsets in ps format | | kgssw | `kgss --watch` | After getting the list of statefulsets, watch for changes | | kgsswide| `kgss -o wide` | After getting the statefulsets, output in plain-text format with any additional information | @@ -106,6 +106,21 @@ plugins=(... kubectl) | kdelss | `kubectl delete statefulset` | Delete the statefulset | | ksss | `kubectl scale statefulset` | Scale a statefulset | | krsss | `kubectl rollout status statefulset`| Check the rollout status of a deployment | +| | | **Service Accounts management** | +| kgsa | `kubectl get sa` | List all service accounts | +| kdsa | `kubectl describe sa` | Describe a service account in details | +| kdelsa | `kubectl delete sa` | Delete the service account | +| | | **DaemonSet management** | +| kgds | `kubectl get daemonset` | List all DaemonSets in ps output format | +| kgdsw | `kgds --watch` | After listing all DaemonSets, watch for changes | +| keds | `kubectl edit daemonset` | Edit DaemonSets from the default editor | +| kdds | `kubectl describe daemonset` | Describe all DaemonSets in detail | +| kdelds | `kubectl delete daemonset` | Delete all DaemonSets matching passed argument | +| | | **CronJob management** | +| kgcj | `kubectl get cronjob` | List all CronJobs in ps output format | +| kecj | `kubectl edit cronjob` | Edit CronJob from the default editor | +| kdcj | `kubectl describe cronjob` | Describe a CronJob in details | +| kdelcj | `kubectl delete cronjob` | Delete the CronJob | ## Wrappers diff --git a/plugins/kubectl/kubectl.plugin.zsh b/plugins/kubectl/kubectl.plugin.zsh index 0b1edb450..d509d8795 100644 --- a/plugins/kubectl/kubectl.plugin.zsh +++ b/plugins/kubectl/kubectl.plugin.zsh @@ -150,6 +150,24 @@ alias kepvc='kubectl edit pvc' alias kdpvc='kubectl describe pvc' alias kdelpvc='kubectl delete pvc' +# Service account management. +alias kgsa="kubectl get sa" +alias kdsa="kubectl describe sa" +alias kdelsa="kubectl delete sa" + +# DaemonSet management. +alias kgds='kubectl get daemonset' +alias kgdsw='kgds --watch' +alias keds='kubectl edit daemonset' +alias kdds='kubectl describe daemonset' +alias kdelds='kubectl delete daemonset' + +# CronJob management. +alias kgcj='kubectl get cronjob' +alias kecj='kubectl edit cronjob' +alias kdcj='kubectl describe cronjob' +alias kdelcj='kubectl delete cronjob' + # Only run if the user actually has kubectl installed if (( ${+_comps[kubectl]} )); then kj() { kubectl "$@" -o json | jq; } -- cgit v1.2.3-70-g09d2 From 80d2e4336b85c070e021571f8724032b204f3c4f Mon Sep 17 00:00:00 2001 From: Lucas Larson <91468+LucasLarson@users.noreply.github.com> Date: Wed, 21 Oct 2020 10:22:32 -0400 Subject: Grammar: remove hyphens from predicate adjective “up to date” (#9356) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://english.stackexchange.com/a/180617 https://web.archive.org/web/20190728053012id_/grammarist.com/usage/up-to-date/#text-60 --- plugins/cargo/_cargo | 4 ++-- plugins/golang/golang.plugin.zsh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'plugins') diff --git a/plugins/cargo/_cargo b/plugins/cargo/_cargo index 12694901e..ffc9fcdc8 100644 --- a/plugins/cargo/_cargo +++ b/plugins/cargo/_cargo @@ -12,8 +12,8 @@ _cargo() { '(-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]' + '--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]' ) diff --git a/plugins/golang/golang.plugin.zsh b/plugins/golang/golang.plugin.zsh index 47b10988e..398bd966f 100644 --- a/plugins/golang/golang.plugin.zsh +++ b/plugins/golang/golang.plugin.zsh @@ -41,7 +41,7 @@ __go_tool_complete() { return fi build_flags=( - '-a[force reinstallation of packages that are already up-to-date]' + '-a[force reinstallation of packages that are already up to date]' '-n[print the commands but do not run them]' '-p[number of parallel builds]:number' '-race[enable data race detection]' -- cgit v1.2.3-70-g09d2 From 3b1699b59527ee8095397b9909a37d55689a0481 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Wed, 21 Oct 2020 20:01:10 +0200 Subject: npx: deprecate plugin Fixes #9366 --- plugins/npx/README.md | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'plugins') diff --git a/plugins/npx/README.md b/plugins/npx/README.md index 1c052930b..41e4c1352 100644 --- a/plugins/npx/README.md +++ b/plugins/npx/README.md @@ -1,21 +1,15 @@ # NPX Plugin -> npx(1) -- execute npm package binaries. ([more info](https://github.com/zkat/npx)) -This plugin automatically registers npx command-not-found handler if `npx` exists in your `$PATH`. +> npx(1) -- execute npm package binaries. ([more info](https://github.com/npm/npx)) -## Setup +This plugin automatically registers npx command-not-found handler if `npx` exists in your `$PATH`. -- Add plugin to `~/.zshrc` +To use it, add `npx` to the plugins array in your zshrc file: -```bash +```zsh plugins=(.... npx) ``` -- Globally install npx binary (npx will be auto installed with recent versions of Node.js) -```bash -sudo npm install -g npx -``` - ## Note The shell auto-fallback doesn't auto-install plain packages. In order to get it to install something, you need to add `@`: @@ -29,3 +23,17 @@ Started It does it this way so folks using the fallback don't accidentally try to install regular typoes. +## 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. -- cgit v1.2.3-70-g09d2