- Applied solution for boo#1227119. In case you configured hostnames in
~/.ssh/config file, now TAB completion is working as expected. OBS-URL: https://build.opensuse.org/package/show/shells/zsh?expand=0&rev=256
This commit is contained in:
parent
64495ffe95
commit
9626a37df7
@ -1,3 +1,9 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Mar 3 15:52:59 UTC 2025 - Paolo Perego <paolo.perego@suse.com>
|
||||||
|
|
||||||
|
- Applied solution for boo#1227119. In case you configured hostnames in
|
||||||
|
~/.ssh/config file, now TAB completion is working as expected.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Mon Mar 3 13:41:20 UTC 2025 - Paolo Perego <paolo.perego@suse.com>
|
Mon Mar 3 13:41:20 UTC 2025 - Paolo Perego <paolo.perego@suse.com>
|
||||||
|
|
||||||
|
15
zshrc
15
zshrc
@ -311,5 +311,20 @@ if test -t && type -p tty > /dev/null 2>&1 ; then
|
|||||||
export GPG_TTY
|
export GPG_TTY
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Correct hostname tab completion when relevant names are configured in $HOME/.ssh/config file.
|
||||||
|
# https://bugzilla.suse.com/show_bug.cgi?id=1227119
|
||||||
|
# Taken from: https://serverfault.com/questions/170346/how-to-edit-command-completion-for-ssh-on-zsh/170481#170481
|
||||||
|
h=()
|
||||||
|
if [[ -r ~/.ssh/config ]]; then
|
||||||
|
h=($h ${${${(@M)${(f)"$(cat ~/.ssh/config)"}:#Host *}#Host }:#*[*?]*})
|
||||||
|
fi
|
||||||
|
if [[ -r ~/.ssh/known_hosts ]]; then
|
||||||
|
h=($h ${${${(f)"$(cat ~/.ssh/known_hosts{,2} || true)"}%%\ *}%%,*}) 2>/dev/null
|
||||||
|
fi
|
||||||
|
if [[ $#h -gt 0 ]]; then
|
||||||
|
zstyle ':completion:*:ssh:*' hosts $h
|
||||||
|
zstyle ':completion:*:slogin:*' hosts $h
|
||||||
|
fi
|
||||||
|
|
||||||
# Read custom system-wide config if exists
|
# Read custom system-wide config if exists
|
||||||
test -s /etc/zsh.zshrc.local && . /etc/zsh.zshrc.local
|
test -s /etc/zsh.zshrc.local && . /etc/zsh.zshrc.local
|
||||||
|
Loading…
x
Reference in New Issue
Block a user