summaryrefslogtreecommitdiff
path: root/dot-oh-my-zsh/custom/plugins/zsh-autocomplete/functions/.autocomplete.zle-flags
blob: 3080ca90dff81e6d4af90676f112f45c38a1a1c4 (plain)
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
32
#!/bin/zsh
typeset -gH _autocomplete__last_widget=

.autocomplete.zle-flags() {
  emulate -L zsh
  setopt $_autocomplete__func_opts[@]

  # If no arg, assume same widget as last time.
  [[ -v 1 && -n $1 ]] &&
      typeset -gH _autocomplete__last_widget="$1"

  # Return 0 to continue, 1 to abort.
  case $_autocomplete__last_widget in
    ( *kill-*~vi-* )
      builtin zle -f kill
      return 0
    ;;
    ( *yank*~vi-* | vi-*put-*after | bracketed-paste )
      builtin zle -f yank
      return 1
    ;;
    ( vi-*put-*before )
      builtin zle -f yankbefore
      return 1
    ;;
    ( * )
      return 0
    ;;
  esac
}

.autocomplete.zle-flags "$@"