Skip to content
Myr

[completion] Add support for HostName lines in ~/.ssh/config (#1785)

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

Close #1783

authored by David Gray · committed by Junegunn Choi · parent a59e846 · Browse files · 2 files+2 added−2 removed
This commit

State

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

Diff stats

2 files+2 added−2 removed

  • other:+2 added−2 removed

2 files+2 added−2 removed

modified:shell/completion.bash+1 added-1 removed
242 unmodified lines
243}244245_fzf_complete_ssh() {246 _fzf_complete '+m' "$@" < <(247 cat <(cat ~/.ssh/config ~/.ssh/config.d/* /etc/ssh/ssh_config 2> /dev/null | command grep -i '^host ' | command grep -v '[*?]' | awk '{for (i = 2; i <= NF; i++) print $1 " " $i}') \247 cat <(cat ~/.ssh/config ~/.ssh/config.d/* /etc/ssh/ssh_config 2> /dev/null | command grep -i '^\s*host\(name\)\? ' | command grep -v '[*?]' | awk '{for (i = 2; i <= NF; i++) print $1 " " $i}') \248 <(command grep -oE '^[[a-z0-9.,:-]+' ~/.ssh/known_hosts | tr ',' '\n' | tr -d '[' | awk '{ print $1 " " $1 }') \249 <(command grep -v '^\s*\(#\|$\)' /etc/hosts | command grep -Fv '0.0.0.0') |250 awk '{if (length($2) > 0) {print $2}}' | sort -u251 )
102 unmodified lines
modified:shell/completion.zsh+1 added-1 removed
113 unmodified lines
114115_fzf_complete_ssh() {116 _fzf_complete '+m' "$@" < <(117 setopt localoptions nonomatch118 command cat <(cat ~/.ssh/config ~/.ssh/config.d/* /etc/ssh/ssh_config 2> /dev/null | command grep -i '^host ' | command grep -v '[*?]' | awk '{for (i = 2; i <= NF; i++) print $1 " " $i}') \118 command cat <(cat ~/.ssh/config ~/.ssh/config.d/* /etc/ssh/ssh_config 2> /dev/null | command grep -i '^\s*host\(name\)\? ' | command grep -v '[*?]' | awk '{for (i = 2; i <= NF; i++) print $1 " " $i}') \119 <(command grep -oE '^[[a-z0-9.,:-]+' ~/.ssh/known_hosts | tr ',' '\n' | tr -d '[' | awk '{ print $1 " " $1 }') \120 <(command grep -v '^\s*\(#\|$\)' /etc/hosts | command grep -Fv '0.0.0.0') |121 awk '{if (length($2) > 0) {print $2}}' | sort -u122 )
83 unmodified lines