]> git.donarmstrong.com Git - zsh.git/blob - .zsh/zshrc/20_compsys
command complete faf
[zsh.git] / .zsh / zshrc / 20_compsys
1 # -*- mode: sh -*-
2 # zshrc/20_compsys
3 #
4 # Configures the completions system
5 #
6 # Copyright © 1994–2008 martin f. krafft <madduck@madduck.net>
7 # Released under the terms of the Artistic Licence 2.0
8 #
9 # Source repository: git://git.madduck.net/etc/zsh.git
10 #
11
12 zstyle :compinstall filename '$ZDOTDIR/zshrc/20_compsys'
13
14 # automatically list choices on an ambiguous completion
15 setopt auto_list
16
17 # use menu after the second completion request
18 setopt auto_menu
19
20 # recognise exact matches even if they're ambiguous
21 setopt rec_exact
22
23 # move cursor to end of word being completed
24 setopt always_to_end
25
26 # correct the command if mistyped
27 setopt correct
28
29 # correct all arguments, not just the command
30 #setopt correctall
31
32 # be magic about adding/removing final characters on tab completion
33 setopt auto_param_keys auto_param_slash auto_remove_slash
34
35 # load fancy completion list and menu handler
36 zmodload zsh/complist
37
38 # initialise the completion system
39 autoload -U compinit
40 compinit -d $ZVARDIR/comp-$HOST
41
42 # cache results
43 zstyle ':completion:*' use-cache on
44 zstyle ':completion:*' cache-path $ZVARDIR/compcache
45
46 #zstyle ':completion:*' completer _list _expand _complete _ignored _match _correct _approximate _prefix
47 zstyle ':completion:*' completer _complete _ignored _match _correct _approximate
48
49 # allow cursor-key navigation through completion set
50 zstyle ':completion:*:*:*:*' menu select
51
52 # use colours in completion lists and menus
53 zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
54
55 # ignore working and backup copies, and compiled objects
56 zstyle ':completion:*:(all-|)files' ignored-patterns \
57   '*.bk' '*.bak' '*.old' '*~' '.*.sw?' '*.o' '*.pyc'
58
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
63
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
70
71 # functions which start with _ are internal and ignored
72 zstyle ':completion:*:functions' ignored-patterns '_*'
73
74 # do not offer files already specified on the line
75 zstyle ':completion:*:rm:*' ignore-line yes
76
77 #zstyle ':completion:*:*:-subscript-:*' tag-order indexes parameters
78 #zstyle ':completion::*:(-command-|export):*' fake-parameters ${${${_comps[(I)-value-*]#*,}%%,*}:#-*-}
79
80 # ignore current directory when completing in ../
81 #zstyle ':completion:*:cd:*' ignore-parents parent pwd
82 zstyle ':completion:*' ignore-parents parent pwd
83
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=()'
88
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"'
91
92 # commands that take commands as arguments
93 compdef _precommand gdb
94 compdef _precommand nohup
95 compdef _precommand strace
96 compdef _precommand faf
97
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 ''
103
104 # #527301
105 zstyle :completion::complete:xmms2:\*:values list-grouped false
106 zstyle :completion::complete:xmms2:\*:values sort false
107
108 # vim:ft=zsh