Add scp completion.
This commit is contained in:
parent
683e887e07
commit
d8f26558ed
@ -75,3 +75,22 @@ if [ "x$COMPLETION_WAITING_DOTS" = "xtrue" ]; then
|
|||||||
zle -N expand-or-complete-with-dots
|
zle -N expand-or-complete-with-dots
|
||||||
bindkey "^I" expand-or-complete-with-dots
|
bindkey "^I" expand-or-complete-with-dots
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# ssh, scp, ping, host
|
||||||
|
zstyle ':completion:*:scp:*' tag-order \
|
||||||
|
'hosts:-host hosts:-domain:domain hosts:-ipaddr:IP\ address *'
|
||||||
|
zstyle ':completion:*:scp:*' group-order \
|
||||||
|
users files all-files hosts-domain hosts-host hosts-ipaddr
|
||||||
|
zstyle ':completion:*:ssh:*' tag-order \
|
||||||
|
users 'hosts:-host hosts:-domain:domain hosts:-ipaddr:IP\ address *'
|
||||||
|
zstyle ':completion:*:ssh:*' group-order \
|
||||||
|
hosts-domain hosts-host users hosts-ipaddr
|
||||||
|
|
||||||
|
zstyle ':completion:*:(ssh|scp):*:hosts-host' ignored-patterns \
|
||||||
|
'*.*' loopback localhost
|
||||||
|
zstyle ':completion:*:(ssh|scp):*:hosts-domain' ignored-patterns \
|
||||||
|
'<->.<->.<->.<->' '^*.*' '*@*'
|
||||||
|
zstyle ':completion:*:(ssh|scp):*:hosts-ipaddr' ignored-patterns \
|
||||||
|
'^<->.<->.<->.<->' '127.0.0.<->'
|
||||||
|
zstyle ':completion:*:(ssh|scp):*:users' ignored-patterns \
|
||||||
|
adm bin daemon halt lp named shutdown sync
|
||||||
|
26
dotfiles/zshenv
Normal file
26
dotfiles/zshenv
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# ssh, scp, ping, host
|
||||||
|
zstyle ':completion:*:scp:*' tag-order \
|
||||||
|
'hosts:-host hosts:-domain:domain hosts:-ipaddr:IP\ address *'
|
||||||
|
zstyle ':completion:*:scp:*' group-order \
|
||||||
|
users files all-files hosts-domain hosts-host hosts-ipaddr
|
||||||
|
zstyle ':completion:*:ssh:*' tag-order \
|
||||||
|
users 'hosts:-host hosts:-domain:domain hosts:-ipaddr:IP\ address *'
|
||||||
|
zstyle ':completion:*:ssh:*' group-order \
|
||||||
|
hosts-domain hosts-host users hosts-ipaddr
|
||||||
|
|
||||||
|
zstyle ':completion:*:(ssh|scp):*:hosts-host' ignored-patterns \
|
||||||
|
'*.*' loopback localhost
|
||||||
|
zstyle ':completion:*:(ssh|scp):*:hosts-domain' ignored-patterns \
|
||||||
|
'<->.<->.<->.<->' '^*.*' '*@*'
|
||||||
|
zstyle ':completion:*:(ssh|scp):*:hosts-ipaddr' ignored-patterns \
|
||||||
|
'^<->.<->.<->.<->' '127.0.0.<->'
|
||||||
|
zstyle ':completion:*:(ssh|scp):*:users' ignored-patterns \
|
||||||
|
adm bin daemon halt lp named shutdown sync
|
||||||
|
If you also want tab completion of the hosts listed in your ~/.ssh/known_hosts and /etc/hosts files, you can add:
|
||||||
|
|
||||||
|
zstyle -e ':completion:*:(ssh|scp):*' hosts 'reply=(
|
||||||
|
${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) \
|
||||||
|
/dev/null)"}%%[# ]*}//,/ }
|
||||||
|
${=${(f)"$(cat /etc/hosts(|)(N) <<(ypcat hosts 2>/dev/null))"}%%\#*}
|
||||||
|
${=${${${${(@M)${(f)"$(<~/.ssh/config)"}:#Host *}#Host }:#*\**}:#*\?*}}
|
||||||
|
)'
|
Loading…
Reference in New Issue
Block a user