]> git.rmz.io Git - dotfiles.git/blob - zsh/lib/completion.zsh
d81b6eb2c5e021276c6407b3932a187d694dc5f2
[dotfiles.git] / zsh / lib / completion.zsh
1 unsetopt menu_complete # do not autoselect the first completion entry
2 unsetopt flowcontrol
3 setopt no_auto_menu # don't show completion menu on succesive tab press
4 setopt complete_in_word
5 setopt always_to_end
6
7 WORDCHARS=''
8
9 zmodload -i zsh/complist
10
11 CASE_SENSITIVE='true'
12 # case-(in)sensitive (all),partial-word and then substring completion
13 if [ "x$CASE_SENSITIVE" = "xtrue" ]; then
14 zstyle ':completion:*' matcher-list 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
15 unset CASE_SENSITIVE
16 else
17 zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
18 fi
19
20 zstyle ':completion:*' list-colors ''
21
22 zstyle ':completion:*:*:*:*:*' menu select
23 zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
24 zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm -w -w"
25
26 # disable named-directories autocompletion
27 zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories
28 cdpath=(.)
29
30 # use /etc/hosts and known_hosts for hostname completion
31 [ -r /etc/ssh/ssh_known_hosts ] && _global_ssh_hosts=(${${${${(f)"$(</etc/ssh/ssh_known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _global_ssh_hosts=()
32 [ -r ~/.ssh/known_hosts ] && _ssh_hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _ssh_hosts=()
33 [ -r /etc/hosts ] && : ${(A)_etc_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}} || _etc_hosts=()
34 hosts=(
35 "$_global_ssh_hosts[@]"
36 "$_ssh_hosts[@]"
37 "$_etc_hosts[@]"
38 "$HOST"
39 localhost
40 )
41 zstyle ':completion:*:hosts' hosts $hosts
42
43 # Use caching so that commands like apt and dpkg complete are useable
44 zstyle ':completion::complete:*' use-cache 1
45 zstyle ':completion::complete:*' cache-path $ZSH/cache/
46
47 # Don't complete uninteresting users
48 zstyle ':completion:*:*:*:users' ignored-patterns \
49 adm amanda apache avahi beaglidx bin cacti canna clamav daemon \
50 dbus distcache dovecot fax ftp games gdm gkrellmd gopher \
51 hacluster haldaemon halt hsqldb ident junkbust ldap lp mail \
52 mailman mailnull mldonkey mysql nagios \
53 named netdump news nfsnobody nobody nscd ntp nut nx openvpn \
54 operator pcap postfix postgres privoxy pulse pvm quagga radvd \
55 rpc rpcuser rpm shutdown squid sshd sync uucp vcsa xfs
56
57 # ... unless we really want to.
58 zstyle '*' single-ignored show