4 # Configures the completions system
6 # Copyright © 1994–2008 martin f. krafft <madduck@madduck.net>
7 # Released under the terms of the Artistic Licence 2.0
9 # Source repository: git://git.madduck.net/etc/zsh.git
12 zstyle :compinstall filename '$ZDOTDIR/zshrc/20_compsys'
14 # automatically list choices on an ambiguous completion
17 # use menu after the second completion request
20 # recognise exact matches even if they're ambiguous
23 # move cursor to end of word being completed
26 # correct the command if mistyped
29 # correct all arguments, not just the command
32 # be magic about adding/removing final characters on tab completion
33 setopt auto_param_keys auto_param_slash auto_remove_slash
35 # load fancy completion list and menu handler
38 # initialise the completion system
40 compinit -d $ZVARDIR/comp-$HOST
43 zstyle ':completion:*' use-cache on
44 zstyle ':completion:*' cache-path $ZVARDIR/compcache
46 #zstyle ':completion:*' completer _list _expand _complete _ignored _match _correct _approximate _prefix
47 zstyle ':completion:*' completer _complete _ignored _match _correct _approximate
49 # allow cursor-key navigation through completion set
50 zstyle ':completion:*:*:*:*' menu select
52 # use colours in completion lists and menus
53 zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
55 # ignore working and backup copies, and compiled objects
56 zstyle ':completion:*:(all-|)files' ignored-patterns \
57 '*.bk' '*.bak' '*.old' '*~' '.*.sw?' '*.o' '*.pyc'
59 zstyle -e ':completion:*:approximate:*' max-errors 'reply=($((($#PREFIX+$#SUFFIX)/3)) not-numeric )'
60 zstyle -e ':completion:*:correct:*' max-errors 'reply=($((($#PREFIX+$#SUFFIX)/2)) numeric )'
61 #zstyle ':completion:*:correct:::' max-errors 1 not-numeric
62 #zstyle ':completion:*:approximate:::' max-errors 2 numeric
64 #zstyle ':completion:*' list-suffixes true
65 #zstyle ':completion:*' match-original both
66 #zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'
67 #zstyle ':completion:*:match:*' original only
68 #zstyle ':completion:*' original true
69 #zstyle ':completion:*' squeeze-slashes true
71 # functions which start with _ are internal and ignored
72 zstyle ':completion:*:functions' ignored-patterns '_*'
74 # do not offer files already specified on the line
75 zstyle ':completion:*:rm:*' ignore-line yes
77 #zstyle ':completion:*:*:-subscript-:*' tag-order indexes parameters
78 #zstyle ':completion::*:(-command-|export):*' fake-parameters ${${${_comps[(I)-value-*]#*,}%%,*}:#-*-}
80 # ignore current directory when completing in ../
81 #zstyle ':completion:*:cd:*' ignore-parents parent pwd
82 zstyle ':completion:*' ignore-parents parent pwd
84 # http://xana.scru.org/2005/08/20#ignorelatexjunk
85 zstyle -e ':completion:*:*:vim#:*:*' ignored-patterns \
86 'texfiles=$(echo ${PREFIX}*.tex); [[ -n "$texfiles" ]] &&
87 reply=(*.(aux|dvi|log|ps|pdf|bbl|toc|lot|lof|latexmain)) || reply=()'
89 # http://madism.org/~madcoder/dotfiles/zsh/40_completion
90 zstyle ':completion:*:processes' command 'ps -au$USER -o pid,time,cmd|grep -v "ps -au$USER -o pid,time,cmd"'
92 # commands that take commands as arguments
93 compdef _precommand gdb
94 compdef _precommand nohup
95 compdef _precommand strace
96 compdef _precommand faf
98 zstyle ':completion:*' verbose yes
99 zstyle ':completion:*:descriptions' format '%B%d%b'
100 zstyle ':completion:*:messages' format '%d'
101 zstyle ':completion:*:warnings' format 'no matches for: %d'
102 zstyle ':completion:*' group-name ''
105 zstyle :completion::complete:xmms2:\*:values list-grouped false
106 zstyle :completion::complete:xmms2:\*:values sort false