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

Re: compctl -Tx 'w[0,...] ...' ...



On Sep 29,  8:29am, Sven Wischnowsky wrote:
} Subject: Re:  compctl -Tx 'w[0,...] ...' ...
}
} "Bart Schaefer" wrote:
} > 
} > Now you may be wondering, what's the point of all this?  Well, at first it
} > was just a desire to have something like compctl -T but that kicked in only
} > after everything else failed.  (You can almost get this with -D, but only
} > for commands that don't already have some other completion.)
} 
} Hm, using flags before a `-x' or `+' with no flags following it
} (continue with default completion) aren't enough?

I don't completely understand the question, I'm afraid.

What I want is a completion that applies to *all* commands, as do -D and
-T, but that is triggered *after* any other completion provided for any
specific command.  I guess I could get the effect by altering every other
completion I ever define to end with the "continue using default" switch;
but that means keeping my own edited copies of all the examples from the
zsh dist, etc.

} Could I get an example, please?

The example I was thinking of was

compctl -Tx 'n[1,=]' -f

That says to complete file names after the first `=' in any word, for any
command.  Because it's a -T, it gets used *before* something like this:

compctl -x 'C[0,conv=*,*] n[-1,,], s[conv=]' \
        -k '(ascii ebcdic ibm block unblock lcase ucase swap noerror sync)' \
        -q -S ',' -- dd

so then you can't complete conv= in a dd-specific way.  I want 'n[1,=]' -f
to apply to every command, but *after* the specific completions are tried.

} But I admit that I didn't think of using `-T' with `w[0,...]'...
} 
} > Also, if you convert all your compctls to one big -T like that, then you
} > can replace 'w[0,string]' with 'W[0,pattern]' and get an effect that a few
} > persistent zsh-users have been requesting for some years: pattern matching
} > on the command name when defining a completion.
} > 
} 
} Huh? That wouldn't be that difficult to implement (I think) and I
} don't remember a request for it...

I'm pretty sure I requested it myself ... an example would be to set up a
compctl so that every command matching `x*' would accept the standard X
toolkit completions (-display, -xrm, etc.).  The reason it might be hard
is because you could end up with multiple different compctl lines that
match the same command:

compctl -k '(-display -geometry -xrm)' x*
compctl -k hosts xhosts

How would the ambiguity be resolved?

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



Messages sorted by: Reverse Date, Date, Thread, Author