Skip to content

completeopt=menuone,noinsert,fuzzy leads to selecting second candidate instead of the first #18802

@echasnovski

Description

@echasnovski

Steps to reproduce

  1. vim --clean
  2. :set completeopt=menuone,noinsert,fuzzy
  3. Add lines "aa", "aaa", and "aaaa" to the current buffer.
  4. On the fourth line in Insert mode press a and <C-n>. Three candidates appear and the second ("aaa") is selected. While I'd expect the first one being selected.

Each of the following changes make it work as expected (order of :

  • Use :set completeopt=menuone,noinsert - first item selected.
  • Use :set completeopt=menuone,noinsert,fuzzy,nosort - first item selected.
  • Use :set completeopt=menuone,noselect,fuzzy - no item is selected.

The likely source of this is #18497 (@girishji). I've bisected it in Neovim codebase.

Expected behaviour

Presence of fuzzy flag in 'completeopt' does not affect how 'noinsert' flag works.

Version of Vim

9.1.1908

Environment

OS: EndeavourOS Linux x86_64, 6.17.8-arch1-1
Terminal: Ghostty 1.2.3-arch2
Value of $TERM: xterm-ghostty
Shell: nushell 0.108.0

Logs and stack traces

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions