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

Re: hostname completion for ssh / scp



On Nov 6,  9:49am, Fourhundred Thecat wrote:
}
} > On 2016-11-05 23:53, Bart Schaefer wrote:
} > 
} > zstyle -e ':completion:*:(ssh|scp):*:my-accounts' users-hosts \
} > 	'_hosts "$@"; trap false EXIT; return 1' 
} 
} But it's only using /etc/hosts, and not ~/.ssh/config.

There has been a small change to ssh-config parsing in 5.something,
but nothing that would make it miss the file entirely.

Note that _ssh stores the hosts it finds in $_cache_hosts, so it may
not work to add the above style to a running zsh where you have tried
ssh host completions before.  "unset _cache_hosts" or restart zsh.

If it still seems not to be working, try:

    ssh s<c-x ?>

That is, control-x question-mark, which invokes _complete_debug.  This
will write a file in /tmp with a backtrace of the completion process.

If you then do:

    grep '\+_ssh_hosts' /tmp/zsh$$ssh? | less

You should be able to see ~/.ssh/config being parsed.  This will most
likely show you what's going on.



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