support for missing .ssh/config file for ssh completion
This commit is contained in:
parent
9c0fdd9071
commit
cad5e1169c
7
.zshrc
7
.zshrc
@ -92,8 +92,11 @@ zstyle ':completion:*' squeeze-slashes true
|
|||||||
zstyle ':completion::*:kill:*:*' command 'ps xf -U $USER -o pid,%cpu,cmd'
|
zstyle ':completion::*:kill:*:*' command 'ps xf -U $USER -o pid,%cpu,cmd'
|
||||||
zstyle ':completion::*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;32'
|
zstyle ':completion::*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;32'
|
||||||
|
|
||||||
zstyle ':completion:*:ssh:*' hosts ${${${(@M)${(f)"$(cat ~/.ssh/config)"}:#Host *}#Host }:#*[*?]*}
|
|
||||||
zstyle ':completion:*:scp:*' hosts ${${${(@M)${(f)"$(cat ~/.ssh/config)"}:#Host *}#Host }:#*[*?]*}
|
list-ssh-hosts() { [[ -f $HOME/.ssh/config ]] && print -n $(cat $HOME/.ssh/config | sed '/^Host /!d;s/Host *\([^ \#]\+\)/\1/') }
|
||||||
|
|
||||||
|
zstyle ':completion:*:ssh:*' hosts $(list-ssh-hosts)
|
||||||
|
zstyle ':completion:*:scp:*' hosts $(list-ssh-hosts)
|
||||||
zstyle ':completion:*:ssh:*' users # disables users completion
|
zstyle ':completion:*:ssh:*' users # disables users completion
|
||||||
zstyle ':completion:*:scp:*' users # disables users completion
|
zstyle ':completion:*:scp:*' users # disables users completion
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user