m/fzf
1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-11-17 07:43:39 -05:00

[bash,zsh] Skip comments in ~/.ssh/config

For the line "Host host1 # this is a comment", the current
implementation generates words in an inline comment as hostnames.
This patch removes the comment before generating the hostname.
This commit is contained in:
Koichi Murase
2025-06-04 12:30:31 +09:00
committed by Junegunn Choi
parent 2bd29c3172
commit f6c589c606
2 changed files with 2 additions and 0 deletions

View File

@@ -499,6 +499,7 @@ if ! declare -F __fzf_list_hosts > /dev/null; then
# 16-year-old mawk unfortunately. We need to use [ \t] instead.
match(tolower($0), /^[ \t]*host(name)?[ \t]*[ \t=]/) {
$0 = substr($0, RLENGTH + 1) # Remove "Host(name)?=?"
sub(/#.*/, "")
for (i = 1; i <= NF; i++)
if ($i !~ /[*?%]/)
print $i