[vim/vim] Line completion with fuzzy doesn't insert the best candidate (Issue #20153)

5 views
Skip to first unread message

Maxim Kim

unread,
May 6, 2026, 7:40:31 PM (yesterday) May 6
to vim/vim, Subscribed
habamax created an issue (vim/vim#20153)

Steps to reproduce

  1. vim --clean
  2. :set completeopt=menu,popup,fuzzy
  3. insert following text into a buffer
set completeopt=menu,popup,fuzzy
set autoindent shiftwidth=4 softtabstop=-1 expandtab
set diffopt+=hiddenoff,algorithm:histogram,linematch:100
  1. Goset diff<C-x><C-l>

Expected behaviour

Line set diffopt+=hiddenoff,algorithm:histogram,linematch:100 should be completed/inserted.

However the line set autoindent shiftwidth=4 softtabstop=-1 expandtab is completed instead.

https://asciinema.org/a/NwEnsx96KHriigxj

Fuzzy matching itself is correct, the best candidate is on the top of the completion list, however the line completion selects the last completion menu item, basically the worst matching.

Version of Vim

9.2.449

Environment

debian13, bash

Logs and stack traces


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/20153@github.com>

zeertzjq

unread,
May 6, 2026, 8:15:48 PM (yesterday) May 6
to vim/vim, Subscribed
zeertzjq left a comment (vim/vim#20153)

The behavior with completeopt=menu,popup,nearest is also strange. With that the first selected item is the nearest one, but pressing Ctrl-L again selects the farthest one.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/20153/4393123201@github.com>

zeertzjq

unread,
May 6, 2026, 8:35:45 PM (yesterday) May 6
to vim/vim, Subscribed
zeertzjq left a comment (vim/vim#20153)

Also, :h i_CTRL-X_CTRL-L explicitly says "search backwards":

							*i_CTRL-X_CTRL-L*
CTRL-X CTRL-L		Search backwards for a line that starts with the
			same characters as those in the current line before
			the cursor.  Indent is ignored.  The matching line is
			inserted in front of the cursor.

It's not entirely clear how exactly this should interact with fuzzy or nearest.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/20153/4393205314@github.com>

Maxim Kim

unread,
May 6, 2026, 9:41:35 PM (23 hours ago) May 6
to vim/vim, Subscribed
habamax left a comment (vim/vim#20153)

It's not entirely clear how exactly this should interact with fuzzy or nearest.

Indeed. I think line completion should

  • either ignore fuzzy or nearest
  • or select the first candidate if fuzzy or nearest is in completeopt.
  • or sort it backwards so that the best candidates are the latest ones?


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/20153/4393478025@github.com>

Reply all
Reply to author
Forward
0 new messages