Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

matching control to ignore initial zeros on numbers



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