From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: Zsh workers <zsh-workers@zsh.org>
Subject: matching control to ignore initial zeros on numbers
Date: Sun, 25 Jan 2015 01:29:35 +0100 [thread overview]
Message-ID: <15301.1422145775@quattro> (raw)
Just as I hit send on the last message, it occurred to me that perhaps
matching control can be used to ignore initial zeroes on numbers.
Using -M "B:0=" does seem to work. I'm not quite sure I understand why
it ignores multiple zeroes but that's what we want anyway.
Have I perhaps missed something with this?
Oliver
diff --git a/Completion/Zsh/Command/_fc b/Completion/Zsh/Command/_fc
index 08806d3..1331456 100644
--- a/Completion/Zsh/Command/_fc
+++ b/Completion/Zsh/Command/_fc
@@ -69,10 +69,9 @@ if [[ -n $state ]]; then
if [[ -z ${line:#*=*} ]] && compset -P '*='; then
_message -e replacements 'replacement'
elif [[ -prefix [0-9] ]]; then
- compset -P '0##' # allows initial 0 to force this style
events=( ${(ps.\0.)"$(printf '%s:%s\0' ${(kv)history})"} )
zformat -a list " -- " "$events[@]"
- _wanted -2V events expl "$state_descr" compadd -ld list - \
+ _wanted -2V events expl "$state_descr" compadd -M "B:0=" -ld list - \
"${events[@]%%:*}"
elif [[ -prefix - ]]; then
for num cmd in ${(kv)history}; do
reply other threads:[~2015-01-25 0:35 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=15301.1422145775@quattro \
--to=okiddle@yahoo.co.uk \
--cc=zsh-workers@zsh.org \
/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).