Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
matching control to ignore initial zeros on numbers
- X-seq: zsh-workers 34374
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Zsh workers <zsh-workers@xxxxxxx>
- Subject: matching control to ignore initial zeros on numbers
- Date: Sun, 25 Jan 2015 01:29:35 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1422145776; bh=UQvSOMMSzj5MZ2W/TagrLv2WWwsaTAjGQO3j3S8khCI=; h=From:To:Subject:Date:From:Subject; b=prFRaiT+6uJTlzLWHk77Sefg1iYfoDNxC8i9qCJjTm5ISRXECH6L50+uzD3cHRtGUUNO2lLv6f4mDnnekN/2vsRdmRIV6Wn4guzCAzqGHQzLQU7x+sRg33MtBifpmhJBz/hnH2/H9Sz7+bu7D5aUEb8+/Sr15db5ur8fEqUkQ6BWPYPv38a1wrN4W0iw+oqXg7KsxFJXTS18zbFyZIJfKJd2wDQKgI8YaHYFeYTD7hv6kIlGQT8oZG+KDn41TEohLaFUDkNOaLBW02HjfWSVY2AKWunnbNg7SmNsjd5f3KYddR1eZ9z6PxJ8rGu5Uit7hIQSqhXnx+I8uEnVZiSyOQ==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author