From: Peter Stephenson <pws@csr.com>
To: zsh-workers@sunsite.dk (Zsh hackers list)
Subject: Re: delete-word does not delete the entire word...
Date: Mon, 13 Oct 2003 18:19:36 +0100 [thread overview]
Message-ID: <20086.1066065576@csr.com> (raw)
In-Reply-To: "Bart Schaefer"'s message of "Mon, 13 Oct 2003 16:49:45 -0000." <1031013164945.ZM20594@candle.brasslantern.com>
Bart Schaefer wrote:
> One question:
>
> } +local curcontext=:zle:delete-whole-word
>
> Wouldn't
>
> local curcontext=:zle:$WIDGET
> or
> local curcontext=:zle:${WIDGET%-match}
>
> be better?
Yes. The former is how all the others work.
Talking of underwhelming responses :-), did anyone ever look at the
additions I posted to match-words-by-style which would allow you to have
different subcontexts in different bits of the command line? The one
where you could do
zstyle ':zle:*' word-context "[[:space:]]" whitespace "*/*" \
filename "" end "*" other
zstyle ':zle:transpose-words:whitespace' word-style shell
zstyle ':zle:transpose-words:filename' word-style normal
zstyle ':zle:transpose-words:filename' word-chars ''
Anyway, I'm not happy with this; I think there must be a better way of
picking context. For example, instead of putting the onus on the user
to pick out the contexts, it would probably be more natural simply to
extend the existing contexts. Perhaps something like
"<context>:<pattern>" or "<context>:<wordnum>:<pattern>" where context
is just an alphanumeric string would carry more information. In other
words, word-context would go and the other styles would look like
zstyle ':zle:transpose-words:between:<->:*' word-style shell
zstyle ':zle:transpose-words:word:<->:*/*' word-style normal
zstyle ':zle:transpose-words:word:<->:*/*' word-chars ''
where that third word would be a set like
empty an empty line
before the unusual case of whitespace before any text
word a shell word, matched by the last element of the style
between whitespace between words (next arg is number of word before)
end after all words
and the fourth word could be e.g. 1 or <2-> to pick the command word or
not the command word.
Half an input is better than no bread.
Index: Functions/Zle/delete-whole-word-match
===================================================================
RCS file: /cvsroot/zsh/zsh/Functions/Zle/delete-whole-word-match,v
retrieving revision 1.1
diff -u -r1.1 delete-whole-word-match
--- Functions/Zle/delete-whole-word-match 13 Oct 2003 16:50:19 -0000 1.1
+++ Functions/Zle/delete-whole-word-match 13 Oct 2003 17:05:19 -0000
@@ -11,7 +11,7 @@
emulate -L zsh
setopt extendedglob
-local curcontext=:zle:delete-whole-word
+local curcontext=:zle:$WIDGET
local -a matched_words
# Start and end of range of characters to remove.
integer pos1 pos2
--
Peter Stephenson <pws@csr.com> Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK Tel: +44 (0)1223 692070
**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential
and/or privileged material.
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by
persons or entities other than the intended recipient is
prohibited.
If you received this in error, please contact the sender and
delete the material from any computer.
**********************************************************************
prev parent reply other threads:[~2003-10-13 17:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <3762.1066039448@csr.com>
2003-10-13 12:00 ` Peter Stephenson
2003-10-13 16:49 ` Bart Schaefer
2003-10-13 17:19 ` Peter Stephenson [this message]
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=20086.1066065576@csr.com \
--to=pws@csr.com \
--cc=zsh-workers@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).