1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-27 16:50:58 +01:00

unposted: bracketed-paste-url-magic: actually do what the comment says

This commit is contained in:
Mikael Magnusson 2015-10-01 20:14:55 +02:00
parent 807a8338a3
commit 99aff5bb0c

View file

@ -2,8 +2,10 @@
# paste exactly starts with a url, eg no spaces or other characters precede it # paste exactly starts with a url, eg no spaces or other characters precede it
# #
# If the numeric argument is provided (eg, pressing alt-0 or alt-1 in emacs mode, # If the numeric argument is provided (eg, pressing alt-0 or alt-1 in emacs mode,
# or just the number by itself in vi command mode), then override the url detection # or just the number by itself in vi command mode), then
# and if it was 0, never quote, and if it was 1, always quote. # 0 is the default and means auto detect urls
# 1 means always quote
# any other value means never quote
# #
# To use this widget, put this in your startup files (eg, .zshrc) # To use this widget, put this in your startup files (eg, .zshrc)
# #
@ -25,13 +27,13 @@ local start=$#LBUFFER
zle .$WIDGET -N content zle .$WIDGET -N content
if ! (( $wantquote )); then if (( $wantquote == 0 )); then
if [[ $content = (${(~j:|:)schema})://* ]]; then if [[ $content = (${(~j:|:)schema})://* ]]; then
wantquote=1 wantquote=1
fi fi
fi fi
if (( $wantquote )); then if (( $wantquote == 1 )); then
content=${(q-)content} content=${(q-)content}
fi fi