mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-12-12 20:21:02 +01:00
refactor: handle $0
according to the Zsh plugin standard (#10518)
For details and rationale, see: https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html Closes #10518
This commit is contained in:
parent
89a740be2d
commit
2d32e9be66
19 changed files with 91 additions and 3 deletions
|
@ -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]} )) || {
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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}"
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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}"
|
||||
|
||||
() {
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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'
|
||||
|
||||
|
|
|
@ -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]} )) || {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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' }"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
Loading…
Reference in a new issue