]> Sergey Matveev's repositories - dotfiles.git/blob - zsh/.zsh/rc/015completion.zsh
98d2283cd6a7e59e50ec386c4b21cbd19fa277c0
[dotfiles.git] / zsh / .zsh / rc / 015completion.zsh
1 zstyle ":completion:*" list-colors ""
2
3 zstyle ":completion:*:functions" ignored-patterns "_*"
4 zstyle ":completion:*:manuals" separate-sections true
5
6 zstyle ":completion:*" group-name ""
7 zstyle ":completion:*:messages" format "%d"
8 zstyle ":completion:*:warnings" format "%F{red}no matches: %d%f"
9 zstyle ":completion:*:*:*:*:descriptions" format "%B... %d%b"
10 zstyle ":completion:*:files:*:*:descriptions" format ""
11
12 zstyle ":completion:*" file-patterns "%p:globbed" "*"
13 zstyle ":completion:*" matcher-list "" "m:{a-z-}={A-Z_}" "r:|?=** m:{a-z-}={A-Z_}"
14 zstyle ":completion:*:man:*:*:*" matcher-list "" "m:{a-zA-Z}={A-Za-z} l:|=* r:|=*"
15 zstyle ":completion:*" completer _mycomp _mycomp_man:man _parameters _ignored
16
17 _mycomp () {
18     [[ $CURRENT -eq 1 ]] && curcontext="${curcontext%:*:*}:-command-:" \
19         _command_names && return
20     [[ $IPREFIX =~ ~.* ]] && _tilde && return
21     local has_files
22     curcontext=:files:${curcontext#:*:} _files && has_files=1
23     [[ $has_files ]] && return
24
25     # MAGIC_EQUAL_SUBST {{{
26     [[ $PREFIX = *\=* ]] || return 1
27     compstate[parameter]=${PREFIX%%\=*}
28     compset -P 1 "*="
29     _value
30     # }}}
31 }
32
33 _mycomp_man () {
34     [[ ${words[1]} == man ]] && curcontext=:man:${curcontext#:*:} \
35         _dispatch "" man man "" -default- && _value && return
36     [[ ${words[1]} == info ]] && curcontext=:info:${curcontext#:*:} \
37         _dispatch "" info info "" -default- && return
38 }
39
40 autoload -U compinit ; compinit -d /tmp/.zcompdump
41 autoload -U complist