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