diff --git a/plugins/cargo/cargo.plugin.zsh b/plugins/cargo/cargo.plugin.zsh index 51a80d4f1..20aeb6652 100644 --- a/plugins/cargo/cargo.plugin.zsh +++ b/plugins/cargo/cargo.plugin.zsh @@ -1,8 +1,12 @@ 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'} +# TODO: 2021-12-28: remove this block +# 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}" # Remove old generated completion file -# TODO: 2021-12-28: remove this line command rm -f "${0:A:h}/_cargo" (( ${fpath[(Ie)$ZSH/plugins/rust]} )) || { diff --git a/plugins/colemak/colemak.plugin.zsh b/plugins/colemak/colemak.plugin.zsh index 8d3393c44..de0b5b866 100644 --- a/plugins/colemak/colemak.plugin.zsh +++ b/plugins/colemak/colemak.plugin.zsh @@ -19,6 +19,11 @@ bindkey -a 'N' vi-join bindkey -a 'j' vi-forward-word-end bindkey -a 'J' vi-forward-blank-word-end +# 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}" + # New less versions will read this file directly export LESSKEYIN="${0:h:A}/colemak-less" diff --git a/plugins/colored-man-pages/colored-man-pages.plugin.zsh b/plugins/colored-man-pages/colored-man-pages.plugin.zsh index 37faed672..040e74fc9 100644 --- a/plugins/colored-man-pages/colored-man-pages.plugin.zsh +++ b/plugins/colored-man-pages/colored-man-pages.plugin.zsh @@ -16,6 +16,11 @@ less_termcap[se]="${reset_color}" less_termcap[us]="${fg_bold[green]}" less_termcap[ue]="${reset_color}" +# 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}" + # Absolute path to this file's directory. typeset __colored_man_pages_dir="${0:A:h}" diff --git a/plugins/deno/deno.plugin.zsh b/plugins/deno/deno.plugin.zsh index eb7191971..88df55af7 100644 --- a/plugins/deno/deno.plugin.zsh +++ b/plugins/deno/deno.plugin.zsh @@ -13,6 +13,11 @@ alias dup='deno upgrade' # COMPLETION FUNCTION if (( $+commands[deno] )); then + # 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}" + # remove old generated completion file command rm -f "${0:A:h}/_deno" diff --git a/plugins/emacs/emacs.plugin.zsh b/plugins/emacs/emacs.plugin.zsh index 027c7550f..258e57f24 100644 --- a/plugins/emacs/emacs.plugin.zsh +++ b/plugins/emacs/emacs.plugin.zsh @@ -13,6 +13,11 @@ autoload -Uz is-at-least is-at-least 24 "${${(Az)"$(emacsclient --version 2>/dev/null)"}[2]}" || return 0 +# 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}" + # Path to custom emacsclient launcher export EMACS_PLUGIN_LAUNCHER="${0:A:h}/emacsclient.sh" diff --git a/plugins/emoji/emoji.plugin.zsh b/plugins/emoji/emoji.plugin.zsh index f70e09320..60d00d976 100644 --- a/plugins/emoji/emoji.plugin.zsh +++ b/plugins/emoji/emoji.plugin.zsh @@ -4,6 +4,11 @@ # # See the README for documentation. +# 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}" + _omz_emoji_plugin_dir="${0:h}" () { diff --git a/plugins/emotty/emotty.plugin.zsh b/plugins/emotty/emotty.plugin.zsh index 4511275d6..959390a31 100644 --- a/plugins/emotty/emotty.plugin.zsh +++ b/plugins/emotty/emotty.plugin.zsh @@ -10,6 +10,11 @@ # % export emotty_set=nature # ------------------------------------------------------------------------------ +# 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}" + typeset -gAH _emotty_sets local _emotty_plugin_dir="${0:h}" source "$_emotty_plugin_dir/emotty_stellar_set.zsh" diff --git a/plugins/fnm/fnm.plugin.zsh b/plugins/fnm/fnm.plugin.zsh index c161b27cd..a5b0d0900 100644 --- a/plugins/fnm/fnm.plugin.zsh +++ b/plugins/fnm/fnm.plugin.zsh @@ -1,4 +1,9 @@ if (( $+commands[fnm] )); then + # 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}" + # remove old generated completion file command rm -f "${0:A:h}/_fnm" diff --git a/plugins/gh/gh.plugin.zsh b/plugins/gh/gh.plugin.zsh index 3e4cdee5e..3092bfa4a 100644 --- a/plugins/gh/gh.plugin.zsh +++ b/plugins/gh/gh.plugin.zsh @@ -1,5 +1,10 @@ # Autocompletion for the GitHub CLI (gh). if (( $+commands[gh] )); then + # 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}" + # remove old generated completion file command rm -f "${0:A:h}/_gh" diff --git a/plugins/git-prompt/git-prompt.plugin.zsh b/plugins/git-prompt/git-prompt.plugin.zsh index a4c952471..122542e65 100644 --- a/plugins/git-prompt/git-prompt.plugin.zsh +++ b/plugins/git-prompt/git-prompt.plugin.zsh @@ -1,3 +1,8 @@ +# 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}" + __GIT_PROMPT_DIR="${0:A:h}" ## Hook function definitions diff --git a/plugins/gitfast/gitfast.plugin.zsh b/plugins/gitfast/gitfast.plugin.zsh index 7b6b67e92..f28e3808c 100644 --- a/plugins/gitfast/gitfast.plugin.zsh +++ b/plugins/gitfast/gitfast.plugin.zsh @@ -1,3 +1,8 @@ +# 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}" + source "${0:A:h}/git-prompt.sh" function git_prompt_info() { diff --git a/plugins/history-substring-search/history-substring-search.plugin.zsh b/plugins/history-substring-search/history-substring-search.plugin.zsh index d2c749bc3..bac2c3ab9 100644 --- a/plugins/history-substring-search/history-substring-search.plugin.zsh +++ b/plugins/history-substring-search/history-substring-search.plugin.zsh @@ -1,4 +1,8 @@ -0=${(%):-%N} +# 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}" + source ${0:A:h}/history-substring-search.zsh diff --git a/plugins/hitchhiker/hitchhiker.plugin.zsh b/plugins/hitchhiker/hitchhiker.plugin.zsh index aeafaf01e..6d0e40052 100644 --- a/plugins/hitchhiker/hitchhiker.plugin.zsh +++ b/plugins/hitchhiker/hitchhiker.plugin.zsh @@ -1,3 +1,8 @@ +# 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}" + HITCHHIKER_DIR="${0:h}/fortunes" # Aliases diff --git a/plugins/macos/macos.plugin.zsh b/plugins/macos/macos.plugin.zsh index 6a91be336..144c17ab2 100644 --- a/plugins/macos/macos.plugin.zsh +++ b/plugins/macos/macos.plugin.zsh @@ -1,3 +1,8 @@ +# 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}" + # Open the current directory in a Finder window alias ofd='open_command $PWD' diff --git a/plugins/rustup/rustup.plugin.zsh b/plugins/rustup/rustup.plugin.zsh index 0ca745b7e..698c081e5 100644 --- a/plugins/rustup/rustup.plugin.zsh +++ b/plugins/rustup/rustup.plugin.zsh @@ -1,8 +1,12 @@ 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'} +# TODO: 2021-12-28: remove this block +# 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}" # Remove old generated completion file -# TODO: 2021-12-28: remove this line command rm -f "${0:A:h}/_rustup" (( ${fpath[(Ie)$ZSH/plugins/rust]} )) || { diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index 0ea3aa02a..648d12bbf 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -46,6 +46,11 @@ else export ZSH_TMUX_TERM=$ZSH_TMUX_FIXTERM_WITHOUT_256COLOR 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}" + # Set the correct local config file to use. if [[ "$ZSH_TMUX_ITERM2" == "false" && -e "$ZSH_TMUX_CONFIG" ]]; then export ZSH_TMUX_CONFIG diff --git a/plugins/wd/wd.plugin.zsh b/plugins/wd/wd.plugin.zsh index 87d1d0858..222a1483a 100644 --- a/plugins/wd/wd.plugin.zsh +++ b/plugins/wd/wd.plugin.zsh @@ -7,4 +7,9 @@ # # @github.com/mfaerevaag/wd +# 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 "wd() { source '${0:A:h}/wd.sh' }" diff --git a/plugins/z/z.plugin.zsh b/plugins/z/z.plugin.zsh index 96abee890..7ce13afa7 100644 --- a/plugins/z/z.plugin.zsh +++ b/plugins/z/z.plugin.zsh @@ -1 +1,6 @@ +# 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}" + source "${0:h}/z.sh" diff --git a/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh b/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh index 85ce87ca4..54c819810 100644 --- a/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh +++ b/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh @@ -11,6 +11,7 @@ # https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html 0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}" 0="${${(M)0:#/*}:-$PWD/$0}" + export ZNT_REPO_DIR="${0:h}" export ZNT_CONFIG_DIR="$HOME/.config/znt"