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

Helpful username completion

Just a helpful bit of compctl for zsh users at sites with a large number
of user accounts.

At York we have 11000 users which means a LONG wait for zsh to hash all
of them if you accidentally hit TAB too early...

This compctl was written by a friend and is great:

	trusted=(auser anotheruser myfriend)
	compctl -C -c -x 'W[0,\~*/*]' -g '*(-*,-/)' - 's[~]' -k trusted -S '/'
	compctl -g '*(D,-/)' -x 'C[0,\~*/*]' -g '*(D,-/)' - 's[~]' -k\
		trusted -S '/' -- cd

[\ denotes line continuation at the end of the second compctl line]

The net result is that zsh will only complete the list of users in the
trusted array after a ~

[example: before]

% ~a
 [Press Tab]
 [Long Wait]
 Do you wish to see all 1000 possibilities?

[example2: after]

% ~a
 [Press Tab]
 auser	anotheruser

Much nicer :)

Hope some of you find it helpful; full credit goes to my friend Alan who
is also a student here at York.


Wez - Electronics Undergraduate at the University of York
URL : http://www.twinklestar.demon.co.uk/

Insult Of The Day: Thou clouted swag-bellied flirt-gill!

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