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