1
0
Fork 0
mirror of synced 2024-11-22 23:35:35 -05:00

[completion] Fix ssh completion for ~/.ssh/config

I think this change results in the _expected_ behavior. Users can always
override this by overriding the zstyle, as that is a benefit of using
zstyles.

Ref: https://www.zsh.org/mla/users/2015/msg00467.html

and `which _ssh_hosts`

Fixes #46. Closes #294.
This commit is contained in:
Matt Hamilton 2018-09-17 01:28:26 -04:00 committed by Eric Nielsen
parent edd4e82d8a
commit 2436a6da28

View file

@ -92,3 +92,8 @@ zstyle ':completion:*:history-words' menu yes
# ignore multiple entries. # ignore multiple entries.
zstyle ':completion:*:(rm|kill|diff):*' ignore-line other zstyle ':completion:*:(rm|kill|diff):*' ignore-line other
zstyle ':completion:*:rm:*' file-patterns '*:all-files' zstyle ':completion:*:rm:*' file-patterns '*:all-files'
# If the _my_hosts function is defined, it will be called to add the ssh hosts
# completion, otherwise _ssh_hosts will fall through and read the ~/.ssh/config
zstyle -e ':completion:*:*:ssh:*:my-accounts' users-hosts \
'[[ -f ${HOME}/.ssh/config && ${key} == hosts ]] && key=my_hosts reply=()'