about summary refs log tree commit diff
path: root/Completion/Commands/_history_complete_word
blob: f459046d2c577845e9740038438c98d7176dee26 (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
28
29
30
31
#compdef -k complete-word \e/

local expl

if [[ -n "$compstate[old_list]" && -n "$compconfig[history_stop]" ]]; then
  if [[ -z "$_hist_menu_end" &&
        compstate[old_insert] -lt _hist_menu_length ]]; then
    compstate[old_list]=keep
    compstate[insert]=$((compstate[old_insert]+1))
  else
    _hist_menu_end=yes
    if [[ "$compconfig[history_stop]" = verbose ]]; then
      _message 'end of history reached'
    else
      compstate[old_list]=keep
      compstate[insert]=_hist_menu_length
    fi
  fi
else
  if [[ -n "$compconfig[history_sort]" ]]; then
    _description expl 'history word'
  else
    _description -V expl 'history word'
  fi
  compgen "$expl[@]" -Q -H 0 ''
  if [[ -n "$compconfig[history_stop]" ]]; then
    compstate[insert]=1
    _hist_menu_length="$compstate[nmatches]"
    _hist_menu_end=''
  fi
fi