Skip to content

Commit

Permalink
environment: Fix logic around url quoting in zsh >= 5.1
Browse files Browse the repository at this point in the history
Closes sorin-ionescu#1015, Fixes sorin-ionescu#978

Thanks to @Eriner for pointing us in right direction.

The code for this comes from zim. This is the last commit with the code we're using:
zimfw/zimfw@537f076#diff-30465d78a41f73dc0f6967d3f34d7964

Note that we need this workaround because we currently support back to
4.3.11.

I believe that originally came from here:
ohmyzsh/ohmyzsh#4473
  • Loading branch information
belak authored and ivanalejandro0 committed Feb 22, 2021
1 parent 299a429 commit 6180208
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions modules/environment/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6180208

Please sign in to comment.