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

Re: compctl tips needed on words with common prefix



>>>>> "Bart" == Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> writes:

    Bart> On Jun 17, 11:10am, Paul Lew wrote:
    Bart> } Subject: compctl tips needed on words with common prefix
    Bart> }
    Bart> } 	compctl -k "(ci co construct cinema)" \
    Bart> } 		-x "r[co,;]" -k "(co1 co2 co3)" \
    Bart> } 		- "r[construct,;]" -k "(cons1 cons2)" -- xxx 
    Bart> } 
    Bart> } I could not get 'construct' to be completed by <TAB>
    Bart> } because the 'co' is recognized first

    Bart> The problem is with the "r[co,;]" -- that's what is spotting
    Bart> the "co" and insisting that only 1 2 or 3 may follow it.

    Bart> What you mean to say, I think, is that any of (co1 co2 co3)
    Bart> may appear *after* "co ".  Right?  In that case, what you
    Bart> want is "c[-1,co]":

    Bart> compctl -k "(ci co construct cinema)" \
    Bart> -x "c[-1,co]" -k "(co1 co2 co3)" \
    Bart> - "c[-1,construct]" -k "(cons1 cons2)" -- xxx 

    Bart> The above will complete to produce command lines like

    Bart> xxx co co2 construct cons1 cinema
    Bart> xxx construct cons2 cinema co co1
    Bart> xxx co co2 ci construct cons1 cinema co co1

That works.  But my situation is a little different, what I would like
is to have "co1 co2 co3" be part of the completion words as long as
there is a word "co" in front, i.e.,

      xxx co co1 co2	       or
      xxx co co3 co1 co2

Do c[offset,string] require a fixed offset or can be a range?  Use -1
as offset will only work for the 1st word.  Also, I still want to be
able to complete the 'construct'.  Any option left?  Thanks...



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