Skip to content
Myr

[bash/zsh] Take SSH completion hints from known_hosts

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Jim Howell · committed by Junegunn Choi · parent cd5e4d9 · Browse files · 2 files+2 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Signed-off-by: Junegunn Choi <junegunn.c@gmail.com>

Diff stats

2 files+2 added−0 removed

  • other:+2 added−0 removed

2 files+2 added−0 removed

modified:shell/completion.bash+1 added
219 unmodified lines
220221_fzf_complete_ssh() {222 _fzf_complete '+m' "$@" < <(223 cat <(cat ~/.ssh/config /etc/ssh/ssh_config 2> /dev/null | \grep -i '^host' | \grep -v '*') \224 <(\grep -oE '^[^ ]+' ~/.ssh/known_hosts | tr ',' '\n' | awk '{ print $1 " " $1 }') \225 <(\grep -v '^\s*\(#\|$\)' /etc/hosts | \grep -Fv '0.0.0.0') |226 awk '{if (length($2) > 0) {print $2}}' | sort -u227 )228}
86 unmodified lines
modified:shell/completion.zsh+1 added