From 9465ba0de456d270418457b486c308a2d49ed9c6 Mon Sep 17 00:00:00 2001 From: gwjo Date: Wed, 3 Nov 2010 16:57:15 -0400 Subject: [PATCH] Completion fixes Use /etc/hosts in addtion to $HOME/.ssh/known_hosts as the source for hostname completion Turn on completion caching to speed up certain comands When completing usernames, don't include system accounts by default --- lib/completion.zsh | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/lib/completion.zsh b/lib/completion.zsh index 52cc5b53c..9c2dfecca 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -34,9 +34,31 @@ zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories cdpath=(.) +# use /etc/hosts and known_hosts for hostname completion +[ -r ~/.ssh/known_hosts ] && _ssh_hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _ssh_hosts=() +[ -r /etc/hosts ] && : ${(A)_etc_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$(