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
Diff
1diff --git a/lib/completion.zsh b/lib/completion.zsh
2index 52cc5b53c0fe14d4b65953d04cee4342122794de..9c2dfecca3cc82ee5f3b1231f11b7a9f75e2e3a4 100644
3--- a/lib/completion.zsh
4+++ b/lib/completion.zsh
5@@ -34,9 +34,31 @@ zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm
6 zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories
7 cdpath=(.)
8 9+# use /etc/hosts and known_hosts for hostname completion
10+[ -r ~/.ssh/known_hosts ] && _ssh_hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _ssh_hosts=()
11+[ -r /etc/hosts ] && : ${(A)_etc_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}} || _etc_hosts=()
12+hosts=(
13+ "$_ssh_hosts[@]"
14+ "$_etc_hosts[@]"
15+ `hostname`
16+ localhost
17+)
18+zstyle ':completion:*:hosts' hosts $hosts
19+
20+# Use caching so that commands like apt and dpkg complete are useable
21+zstyle ':completion::complete:*' use-cache 1
22+zstyle ':completion::complete:*' cache-path ~/.oh-my-zsh/cache/
23+
24+# Don't complete uninteresting users
25+zstyle ':completion:*:*:*:users' ignored-patterns \
26+ adm amanda apache avahi beaglidx bin cacti canna clamav daemon \
27+ dbus distcache dovecot fax ftp games gdm gkrellmd gopher \
28+ hacluster haldaemon halt hsqldb ident junkbust ldap lp mail \
29+ mailman mailnull mldonkey mysql nagios \
30+ named netdump news nfsnobody nobody nscd ntp nut nx openvpn \
31+ operator pcap postfix postgres privoxy pulse pvm quagga radvd \
32+ rpc rpcuser rpm shutdown squid sshd sync uucp vcsa xfs
33+
34+# ... unless we really want to.
35+zstyle '*' single-ignored show
3637-# Load known hosts file for auto-completion with ssh and scp commands
38-if [ -f ~/.ssh/known_hosts ]; then
39- zstyle ':completion:*' hosts $( sed 's/[, ].*$//' $HOME/.ssh/known_hosts )
40- zstyle ':completion:*:*:(ssh|scp):*:*' hosts `sed 's/^\([^ ,]*\).*$/\1/' ~/.ssh/known_hosts`
41-fi