Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Catch URLs (was: "Literal" command execution)
- X-seq: zsh-users 16759
- From: mark+lists@xxxxxxxxxxxxxx
- To: <zsh-users@xxxxxxx>
- Subject: Catch URLs (was: "Literal" command execution)
- Date: Mon, 13 Feb 2012 12:38:55 +0000
- In-reply-to: <CAEcrOvBuCq2QbHMUORw-22bUU=G-=JSp=AdSoc_EFgnzhvZWuA@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <20120123205150.27077e4eea9d7be1e632508f@users.sf.net> <CAEcrOvBuCq2QbHMUORw-22bUU=G-=JSp=AdSoc_EFgnzhvZWuA@mail.gmail.com>
Hi,
I want to reduce escaping to the bare minimum. Dollars are not
really a problem, but I discovered myself to escape '<' '>' and '!'
too often.
For URLs I'm using something called url-quote-magic: when I start
writing an URL, it's detected and then all special characters are
escaped (&, <, >, !).
autoload -U url-quote-magic ; zle -N self-insert url-quote-magic
This is really great for copying+pasting URLs, for example to use it
in wget.
It's almost really great. :)
I have setopt warncreateglobal enabled by default because it helps me
to catch global variables that should be local, especially in my own
functions.
Now, when I run the autoload line above and then paste an URL I am
warned every time the URL is being escaped.
Try something like this to reproduce it. In this example I'll just use
an arbitrary URL I happen to have on my clipboard:
setopt warncreateglobal
autoload -U url-quote-magic; zle -N self-insert url-quote-magic
curl -LO
https://git.kernel.org/?p=linux/kernel/git/stable/stable-queue.git;a=blob_plain;f=queue-3.2/mm-fix-up-thp-spin_is_locked-bugs.patch;hb=50c8f68647a605333fe78c86966e802c07a105c0
output:
8 of these:
url-quote-magic:68: array parameter reply created globally in function
url-quote-magic:72: array parameter reply created globally in function
I'm not sure how to fix this, tips for that are appreciated.
Mark
Messages sorted by:
Reverse Date,
Date,
Thread,
Author