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

Re: completion tricks



On Monday 19 March 2001, at 13 h 14, the keyboard of Jeff Shipman 
<shippy@xxxxxxx> wrote:

> 2) Using ssh, rlogin, telnet, etc will complete
>    different hosts on my network.

Did you notice the 'ssh_completion' file in zsh's distribution?

Anyway, here is how I do it:

# Construct an array of common hosts
etchosts=( ${(s: :)${(ps:\t:)${${(f)"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blan
k:]]#}} )
sshhosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[^0-9]*}%%\ *}%%,*})
hosts=($etchosts $sshhosts)

# SSH (scp is much more difficult)
compctl -k hosts \
	-x "c[-1,-l]" -u \
	- "c[-1,-i]" -f \
	- "c[-1,-e]" -k "(~ none)" \
	- "c[-1,-c]" -k "(idea des 3des tss arcfour none)" \
	- "c[-1,-p]" -k ports \
	- "c[-1,-L] c[-1,-R] c[-1,-o]" -k "()" \
	-- ssh slogin

# various network programs
compctl -x 'N[-1,@]' -k hosts - 's[]' -u -qS '@' -- finger
compctl -k hosts traceroute mtr ping 





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