diff options
Diffstat (limited to 'lib/completion.zsh')
-rw-r--r-- | lib/completion.zsh | 42 |
1 files changed, 33 insertions, 9 deletions
diff --git a/lib/completion.zsh b/lib/completion.zsh index cba90179f..fdd0a8536 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -1,4 +1,4 @@ -## fixme - the load process here seems a bit bizarre +# fixme - the load process here seems a bit bizarre unsetopt menu_complete # do not autoselect the first completion entry unsetopt flowcontrol @@ -8,9 +8,6 @@ setopt always_to_end WORDCHARS='' -autoload -U compinit -compinit -i - zmodload -i zsh/complist ## case-insensitive (all),partial-word and then substring completion @@ -30,8 +27,35 @@ zstyle ':completion:*:*:*:*:*' menu select zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01' zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm -w -w" -# Load known hosts file for auto-completion with ssh and scp commands -if [ -f ~/.ssh/known_hosts ]; then - zstyle ':completion:*' hosts $( sed 's/[, ].*$//' $HOME/.ssh/known_hosts ) - zstyle ':completion:*:*:(ssh|scp):*:*' hosts `sed 's/^\([^ ,]*\).*$/\1/' ~/.ssh/known_hosts` -fi +# disable named-directories autocompletion +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)~~"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}} || _etc_hosts=() +hosts=( + "$_ssh_hosts[@]" + "$_etc_hosts[@]" + `hostname` + localhost +) +zstyle ':completion:*:hosts' hosts $hosts + +# Use caching so that commands like apt and dpkg complete are useable +zstyle ':completion::complete:*' use-cache 1 +zstyle ':completion::complete:*' cache-path ~/.oh-my-zsh/cache/ + +# Don't complete uninteresting users +zstyle ':completion:*:*:*:users' ignored-patterns \ + adm amanda apache avahi beaglidx bin cacti canna clamav daemon \ + dbus distcache dovecot fax ftp games gdm gkrellmd gopher \ + hacluster haldaemon halt hsqldb ident junkbust ldap lp mail \ + mailman mailnull mldonkey mysql nagios \ + named netdump news nfsnobody nobody nscd ntp nut nx openvpn \ + operator pcap postfix postgres privoxy pulse pvm quagga radvd \ + rpc rpcuser rpm shutdown squid sshd sync uucp vcsa xfs + +# ... unless we really want to. +zstyle '*' single-ignored show + |