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

Re: compctl tips needed on words with common prefix



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

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

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

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

The above will complete to produce command lines like

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

That is, always requiring "co co[123]" and "construct cons[12]" to be
paired, but allowing the pairs of them to appear anywhere and to be
interspersed with "ci" and "cinema".

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



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