Sample Header Ad - 728x90

zsh: Menu is not activated for custom completion widget

1 vote
0 answers
18 views
A custom completion widget is defined as follows, and menu completion is enabled. With this config, when I press ``, the candidates are displayed as expected, but the menu is not activated. The menu is activated when completing file names, etc. with ``. Also strangely, once the menu is enabled for file name completion, it will also be enabled for `` from the next time. I would like the menu to be enabled by `` even immediately after starting the shell. How can I do this?
setopt menu_complete
autoload -Uz compinit && compinit -u
zstyle ':completion:*' menu select=1

my-complete() {
  local suggestions=(foo bar baz)
  compadd -J word -o nosort -U $suggestions
}
zle -C my-complete .complete-word my-complete
bindkey '^O' my-complete
Asked by aosho235 (227 rep)
Jun 15, 2025, 12:15 PM