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