about summary refs log tree commit diff
path: root/Completion/Core/_menu
blob: e9558fe050baada404bb7dd91993b6af0b03b032 (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
26
27
#autoload

local curcontext="$curcontext"

# Probably set initial context.

[[ -z "$curcontext" ]] && curcontext=':menu'

# This completer is an example showing how menucompletion can be
# implemented with the new completion system.
# Use this one before the normal _complete completer, as in:
#
#   compstyle "*" completer _menu _complete

if [[ -n "$compstate[old_list]" ]]; then

  # We have an old list, keep it and insert the next match.

  compstate[old_list]=keep
  compstate[insert]=$((compstate[old_insert]+1))
else
  # No old list, make completion insert the first match.

  compstate[insert]=1
fi

return 1