about summary refs log tree commit diff
path: root/Completion/Commands/_expand_word
blob: 4ff24c3f5b35dc8250f979e713b721921e02e788 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#compdef -K _expand_word complete-word \C-xe _list_expansions list-choices \C-xd

# Simple completion front-end implementing expansion.

setopt localoptions nullglob rcexpandparam extendedglob noshglob
unsetopt markdirs globsubst shwordsplit nounset ksharrays

local curcontext="$curcontext"
local -ah completers

if [[ -z "$curcontext" ]]; then
  curcontext="expand-word:::"
else
  curcontext="expand-word:${curcontext#*:}"
fi

if zstyle -t ":completion:${curcontext}:" completions; then
    zstyle -a ":completion:${curcontext}:" completer completers
    completers[1,(i)_expand]=_expand
    (( $#completers == 1 )) && completers=(_expand _complete)
else
    completers=(_expand)
fi

_main_complete $completers