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

Re: ssh scp completion



On Fri, Jul 16, 2004 at 11:40:47AM +0200, Martin Marcher wrote:
>   from the ~/.ssh/config file syntax is:
> 
>   Host foo
>     .
>     .
> 
>   Host bar
>     .
>     .
> 
>   Host *
>     general options
> 
> 
>   now i want to only have the following completions: 'foo' and 'bar' the
>   manpages are way to big for me to find what I want, especially that i
>   don't really have an idea what sections i should have a look at.

You can set up directly the style hosts:

zstyle ':completion:*:*:*' hosts foo bar

or use something like what I have in my .zshrc:

[ -f ~/.ssh/config ] && : ${(A)ssh_config_hosts:=${${${${(@M)${(f)"$(<~/.ssh/config)"}:#Host *}#Host }:#*\**}:#*\?*}}
[ -f ~/.ssh/known_hosts ] && : ${(A)ssh_known_hosts:=${${${(f)"$(<$HOME/.ssh/known_hosts)"}%%\ *}%%,*}}
zstyle ':completion:*:*:*' hosts $ssh_config_hosts $ssh_known_hosts

Remove $ssh_known_hosts if you do not want to add the content of
.ssh/known_hosts



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