1

It seems like in Zsh, if you're using menucomplete, even if there is only one completion suggestion, you still have to hit tab again in order to accept it. Is it possible to configure Zsh to use menu completion, but if there's only one completion, to accept it on the first tab press?

Here's the relevant lines from my .zshrc:

zstyle ':completion:*' completer _list _oldlist _expand _complete _ignored _correct _approximate
zstyle ':completion:*' completions 1
zstyle ':completion:*' glob 1
zstyle ':completion:*' insert-unambiguous true
zstyle ':completion:*' list-colors ''
zstyle ':completion:*' matcher-list 'm:{[:lower:]}={[:upper:]}' 'r:|[._-/]=* r:|=*' 'l:|=* r:|=*'
zstyle ':completion:*' max-errors 3
zstyle ':completion:*' menu select=1
zstyle ':completion:*' original true
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
zstyle ':completion:*' substitute 1
zstyle ':completion:*' verbose true
zstyle :compinstall filename '/Users/aaronstacy/.zshrc'

autoload -Uz compinit
compinit

And the output of setopt:

§ setopt                                     
combiningchars
interactive
login
monitor
promptsubst
shinstdin
zle
1
  • 1
    Maybe share output of setopt too
    – dza
    Sep 20, 2020 at 8:49

1 Answer 1

2

zstyle ':completion:*' completer _expand _complete _list _oldlist

If you change the order of _complete further to the left (before _list and _oldlist), the completion will happen before the list.

And when you type vim long<TAB> it expands fully without list to vim_longfilename

5
  • 1
    this just makes my day thank you
    – aaron
    Sep 21, 2020 at 12:38
  • According to documentation _expand should be before _complete. > Note also this completer should be called before the _complete completer function
    – Tun
    Sep 29, 2022 at 22:50
  • @Tun thanks for the correction. Can you quote where it says so? I tried searching but couldn't find it.
    – dza
    Oct 2, 2022 at 7:03
  • @dza find with "Note also this completer should be called before the _complete" phrase. It is around the middle of the page under _expand completer.
    – Tun
    Oct 3, 2022 at 12:12
  • @Tun ty, just edited answer.
    – dza
    Oct 3, 2022 at 13:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .