From: "Bart Schaefer" <schaefer@brasslantern.com>
To: Paul Lew <paullew@cisco.com>, zsh-users@sunsite.dk
Subject: Re: Bart's urlglobber question
Date: Thu, 3 Oct 2002 16:09:43 +0000 [thread overview]
Message-ID: <1021003160943.ZM20996@candle.brasslantern.com> (raw)
In-Reply-To: <15772.25139.506561.955462@paullew-ultra.cisco.com>
On Oct 3, 8:28am, Paul Lew wrote:
}
} Seems noglob does not handle the '&'
Of course not. It's not a glob character, it's a statement separator.
} then how can I ever achieve the original goal of not supplying quotes
} when using w3m?
Did you see my url-magic-space posting?
http://www.zsh.org/cgi-bin/mla/redirect?USERNUMBER=5319
Here's a slight variation on it:
---- 8< ---- snip ---- 8< ----
function url-quote-magic {
local words back=0
words=("${(@Q)${(q)=LBUFFER}}")
[[ "$KEYS" != [[:space:]] ]] && back=1
case "$words[-1]" in
(*[\'\"]*) back=0;;
(ftp://(|localhost)/(~|*([][?#*]|\(|\)))*)
local left="${(qqM)${words[-1]}##ftp://(localhost|)}"
local right="${${words[-1]}##ftp://(localhost|)}"
right="${right/#\/~/~}"
words[-1]="$left"'"${(f)^$(print -lr -- '"$right"')}"'
((back)) && back=3;;
(http(|s)|ftp):*) words[-1]="${(qq)words[-1]}" ;;
esac
LBUFFER="${(j: :)words}"
((CURSOR-=back))
zle .self-insert
}
zle -N url-quote-magic
for key in ' ' '?' '&'; do bindkey "$key" url-quote-magic; done
---- 8< ---- snip ---- 8< ----
The above could use some improvement in for multi-line buffers; check the
value of BUFFERLINES and save and elide everything not on the current line
before manipulating $words, then restore it to the beginning of LBUFFER at
the end. I don't have time to fiddle with that just now.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
next prev parent reply other threads:[~2002-10-03 16:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-10-03 15:28 Paul Lew
2002-10-03 16:09 ` Bart Schaefer [this message]
2002-10-03 17:25 ` Bart's urlglobber question [url-magic-space] Paul Lew
2002-10-03 17:55 ` Bart Schaefer
2002-10-05 19:43 ` Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1021003160943.ZM20996@candle.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=paullew@cisco.com \
--cc=zsh-users@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).