diff --git a/modules/environment/init.zsh b/modules/environment/init.zsh index 76655a6c..e77a107c 100644 --- a/modules/environment/init.zsh +++ b/modules/environment/init.zsh @@ -9,8 +9,24 @@ # Smart URLs # -autoload -Uz url-quote-magic -zle -N self-insert url-quote-magic +# This logic comes from an old version of zim. Essentially, bracketed-paste was +# added as a requirement of url-quote-magic in 5.1, but in 5.1.1 bracketed +# paste had a regression. Additionally, 5.2 added bracketed-paste-url-magic +# which is generally better than url-quote-magic so we load that when possible. +autoload -Uz is-at-least +if [[ ${ZSH_VERSION} != 5.1.1 ]]; then + if is-at-least 5.2; then + autoload -Uz bracketed-paste-url-magic + zle -N bracketed-paste bracketed-paste-url-magic + else + if is-at-least 5.1; then + autoload -Uz bracketed-paste-magic + zle -N bracketed-paste bracketed-paste-magic + fi + fi + autoload -Uz url-quote-magic + zle -N self-insert url-quote-magic +fi # # General