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

Re: Completing parameter names that have yet to be set.



On Aug 13, 10:51pm, Felix Rosencrantz wrote:
} Subject: Re: Completing parameter names that have yet to be set.
}
} For example, in my source code tree I might want to look at ".[ch]"
} files first, but in logs directory I want to look ".{log,out}" files
} first.  I can use tags, but I still have to list tags for ".[ch]" and
} for the ".{logs,out}" files. And if both types of directories contain
} files that match both tags, there will be at least one directory where I
} always get the incorrect completion the first time.
}
} [...]
}
} It seems that the ability to configure styles based on additional
} information not found in the context requires the ability to treat a
} group of styles as a single whole, and quickly set/unset a group of
} styles.  I vaguely remember something like this was talked about, but
} don't remember what was decided.

This is what both `zstyle -e' and the `func()' value for the tag-order
style are supposed to accomplish, I think.  In fact, given `zstyle -e',
we could probably do away with `tag-order func()'.

zstyle ':completion:*' file-patterns \
	'*.[ch]:c-sources' '*.(log|out):log-files' '%p:all-files'
zstyle -e ':completion::complete:*' tag-order \
	'if [[ -d $PREFIX/CVS ]]; then reply=(c-sources all-files);
	 else if [[ $PREFIX == */log ]]; then reply=(log-files all-files);
	 fi'

Or something like that, I didn't try it so I've probably got it cockeyed.
And of course you'd have to come up with a more sophisticated test for
$PREFIX or whatever, to tell what kind of directory is what.

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

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



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