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

Re: {(t)...} usage



Mario Lang <mlang@xxxxxxxxxxx> writes:

> Can anyone give me an example on how to do this?

Here's how i do host completion based purely on ssh known_hosts
files.  This strips newlines and comments.

my_hosts=(${(M)${${${${(f)"$(<~/.ssh/known_hosts2)"}:#[0-9]*}%%\ *}%%,*}:#^\#})
etc_file=/etc/ssh/ssh_known_hosts2
if [[ -f $etc_file ]]; then
    etc_hosts=(${(M)${${${${(f)"$(<$etc_file)"}:#[0-9]*}%%\ *}%%,*}:#^\#})
fi
zstyle ':completion:*:*:(ping|nc|s(sh|cp)):*' hosts $etc_hosts $my_hosts

--  
Eric Gillespie <*> epg@xxxxxxxxxxxxxx

Conformity is a sin.



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