From ec0267bf8f5729bdd204c0549f30de70b0cd405d Mon Sep 17 00:00:00 2001 From: Alexandros Kozak Date: Fri, 10 Sep 2021 22:19:40 -0700 Subject: [PATCH 1/3] More refinements to prompt unload and cleanup --- agkozak-zsh-prompt.plugin.zsh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/agkozak-zsh-prompt.plugin.zsh b/agkozak-zsh-prompt.plugin.zsh index aaae622..16f647e 100644 --- a/agkozak-zsh-prompt.plugin.zsh +++ b/agkozak-zsh-prompt.plugin.zsh @@ -1105,8 +1105,7 @@ agkozak-zsh-prompt_plugin_unload() { if is-at-least 5.3; then add-zle-hook-widget -D zle-keymap-select _agkozak_zle-keymap-select else - # TODO: Make sure this is the right thing to do. - zle -N zle-keymap-select + zle -D zle-keymap-select fi for x in ${=AGKOZAK[FUNCTIONS]}; do @@ -1131,7 +1130,7 @@ _agkozak_prompt_cleanup() { if is-at-least 5.3; then add-zle-hook-widget -D zle-keymap-select _agkozak_zle-keymap-select else - zle -D _agkozak_zle-keymap_select + zle -D zle-keymap-select fi } From f65a3aa59fb9aa2a37224f5060d6213665a89f1d Mon Sep 17 00:00:00 2001 From: Alexandros Kozak Date: Sat, 11 Sep 2021 09:02:24 -0700 Subject: [PATCH 2/3] Refinements to unload plugin --- agkozak-zsh-prompt.plugin.zsh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/agkozak-zsh-prompt.plugin.zsh b/agkozak-zsh-prompt.plugin.zsh index aaae622..ffcdca6 100644 --- a/agkozak-zsh-prompt.plugin.zsh +++ b/agkozak-zsh-prompt.plugin.zsh @@ -1088,16 +1088,15 @@ prompt_agkozak-zsh-prompt_help() { # See https://github.com/zdharma/Zsh-100-Commits-Club/blob/master/Zsh-Plugin-Standard.adoc#unload-fun ############################################################ agkozak-zsh-prompt_plugin_unload() { - setopt LOCAL_OPTIONS NO_KSH_ARRAYS NO_SH_WORD_SPLIT local x [[ ${AGKOZAK_OLD_OPTIONS[promptsubst]} == 'off' ]] && unsetopt PROMPT_SUBST [[ ${AGKOZAK_OLD_OPTIONS[promptbang]} == 'on' ]] && setopt PROMPT_BANG - PROMPT=${AGKOZAK[OLD_PROMPT]} - RPROMPT=${AGKOZAK[OLD_RPROMPT]} + PROMPT="${AGKOZAK[OLD_PROMPT]}" + RPROMPT="${AGKOZAK[OLD_RPROMPT]}" - psvar=( $AGKOZAK_OLD_PSVAR ) + psvar=( "${AGKOZAK_OLD_PSVAR[@]}" ) add-zsh-hook -D preexec prompt_agkozak_preexec add-zsh-hook -D precmd prompt_agkozak_precmd From 9d1e9beb8e1cb4dfdeac77d0a81d1698e8b621d7 Mon Sep 17 00:00:00 2001 From: Alexandros Kozak Date: Sat, 11 Sep 2021 09:20:24 -0700 Subject: [PATCH 3/3] Some notes --- agkozak-zsh-prompt.plugin.zsh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/agkozak-zsh-prompt.plugin.zsh b/agkozak-zsh-prompt.plugin.zsh index fd4709a..1154a2d 100644 --- a/agkozak-zsh-prompt.plugin.zsh +++ b/agkozak-zsh-prompt.plugin.zsh @@ -1058,7 +1058,7 @@ prompt_agkozak-zsh-prompt_setup() { (( $+VSCODE_PID )) && ZLE_RPROMPT_INDENT=6 fi - # For promptinit + # For promptinit (introduced in Zsh v5.4) (( ${+functions[prompt_cleanup]} )) && prompt_cleanup _agkozak_prompt_cleanup @@ -1119,6 +1119,8 @@ agkozak-zsh-prompt_plugin_unload() { ############################################################ # promptinit cleanup function +# +# prompt_cleanup was introduced in Zsh v5.4 ############################################################ _agkozak_prompt_cleanup() { setopt LOCAL_OPTIONS NO_KSH_ARRAYS NO_SH_WORD_SPLIT