Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Bug#430146: zsh: please add .ssh/config Hosts to the hosts zstyle completion
- X-seq: zsh-workers 23592
- From: Clint Adams <schizo@xxxxxxxxxx>
- To: Pierre Habouzit <madcoder@xxxxxxxxxx>, 430146@xxxxxxxxxxxxxxx
- Subject: Re: Bug#430146: zsh: please add .ssh/config Hosts to the hosts zstyle completion
- Date: Sun, 24 Jun 2007 07:57:27 -0400
- Cc: zsh-workers@xxxxxxxxxx
- In-reply-to: <20070623113320.GA25562@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Mail-followup-to: Pierre Habouzit <madcoder@xxxxxxxxxx>, 430146@xxxxxxxxxxxxxxx, zsh-workers@xxxxxxxxxx
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <20070622180648.14337.68045.reportbug@localhost> <20070622211507.GA16349@xxxxxxxxxxx> <20070622222216.GA9656@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> <20070623074721.GA28769@xxxxxxxxxxx> <20070623113320.GA25562@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
On Sat, Jun 23, 2007 at 12:33:21PM +0100, Pierre Habouzit wrote:
> Anyways, I'm not using it anymore because I fancy the
> .ssh/known_hosts more, but I miss it :)
We could do something like this to generate matches from ~/.ssh/config .
Anyone have better ideas?
Index: Completion/Unix/Type/_hosts
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Type/_hosts,v
retrieving revision 1.10
diff -u -r1.10 _hosts
--- Completion/Unix/Type/_hosts 5 Apr 2006 10:04:32 -0000 1.10
+++ Completion/Unix/Type/_hosts 24 Jun 2007 11:52:08 -0000
@@ -48,6 +48,11 @@
_cache_hosts+=($khosts)
fi
done
+
+ if zstyle -t ":completion:${curcontext}:hosts" use-ssh-config; then
+ [[ -r ~/.ssh/config ]] && _cache_hosts+=(${=${${(M)${(f)"$(<~/.ssh/config)"}:#Host*}#Host }:#*\**})
+ fi
+
fi
_hosts=( "$_cache_hosts[@]" )
Messages sorted by:
Reverse Date,
Date,
Thread,
Author