mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-10-28 05:00:59 +01:00
unposted: bracketed-paste-url-magic: actually do what the comment says
This commit is contained in:
parent
807a8338a3
commit
99aff5bb0c
1 changed files with 6 additions and 4 deletions
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue