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