[vim/vim] `wildoptions` affects insert mode completion (Issue #21355)

21 views
Skip to first unread message

Mateo Gjika

unread,
Sep 21, 2026, 5:55:58 AM (5 days ago) Sep 21
to vim/vim, Subscribed
mateoxh created an issue (vim/vim#21355)

Steps to reproduce

  1. Save the following content in bug.vim
filetype plugin indent on
syntax on
set wildoptions+=fuzzy
set completeopt=menu,noselect,longest
  1. From the shell type vim -u bug.vim example.vim
  2. Type set co and then press <C-x><C-o> to use omni completion
  3. The prefix co is deleted

Expected behaviour

Since longest is in &completeopt, the omni completion should just show me the options starting with the prefix (e.g. co) but with set wildoptions+=fuzzy (which should only affect command-line completion) the completion is fuzzy and the common prefix is removed.

Version of Vim

9.2.1122

Environment

Not needed

Logs and stack traces

—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/21355@github.com>

zeertzjq

unread,
Sep 21, 2026, 9:16:01 PM (4 days ago) Sep 21
to vim/vim, Subscribed
zeertzjq left a comment (vim/vim#21355)

The reverse is also true: If 'completeopt' contains "fuzzy" but 'wildoptions' doesn't, the omnifunc completion still isn't fuzzy.

However :h ft-vim-omni does say "fallback to command line completion" and isn't really clear about which "fuzzy" flag should apply to it...

cc @habamax

—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

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

Maxim Kim

unread,
Sep 21, 2026, 9:32:16 PM (4 days ago) Sep 21
to vim/vim, Subscribed
habamax left a comment (vim/vim#21355)

vim's omnifunc uses getcompletion() to get items, e.g:

        if empty(items) && !empty(base)
            items = getcompletion(base, 'expression')
                ->mapnew((_, v) => ({word: v, kind: 'v', menu: 'Expression', dup: 0}))
        endif

And the it's help topics states following:

		If the 'wildoptions' option contains 'fuzzy', then fuzzy
		matching is used to get the completion matches.  Otherwise
		regular expression matching is used.  Thus this function
		follows the user preference, what happens on the command line.
		If you do not want this you can make 'wildoptions' empty
		before calling getcompletion() and restore it afterwards.

I can set/reset wildoptions in the omnifunc, but not sure of the side effects.

—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

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

Maxim Kim

unread,
Sep 21, 2026, 9:49:25 PM (4 days ago) Sep 21
to vim/vim, Subscribed
habamax left a comment (vim/vim#21355)

basically this:

    # -----added------
    var save_wildoptions = &wildoptions
    &wildoptions = ""
    defer () => {
        &wildoptions = save_wildoptions
    }()
    # -----added------
    var items = []
    if trigger == 'function'
        items = getcompletion(base, 'function')

—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

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

Maxim Kim

unread,
Sep 21, 2026, 9:56:10 PM (4 days ago) Sep 21
to vim/vim, Subscribed
habamax left a comment (vim/vim#21355)

this "works" but still the function still returns:

set wildoptions=
echo getcompletion('col', 'option')
# ['colorcolumn', 'columns', 'conceallevel']
Image: Image (view on web) Image: Image (view on web)

—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

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

Mateo Gjika

unread,
Sep 22, 2026, 7:49:42 AM (4 days ago) Sep 22
to vim/vim, Subscribed
mateoxh left a comment (vim/vim#21355)

The reverse is also true: If 'completeopt' contains "fuzzy" but 'wildoptions' doesn't, the omnifunc completion still isn't fuzzy.

I'm not able to reproduce this, set completeopt+=fuzzy works as expected even with an empty &wildoptions.

—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

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

Mateo Gjika

unread,
Sep 22, 2026, 8:06:09 AM (4 days ago) Sep 22
to vim/vim, Subscribed
mateoxh left a comment (vim/vim#21355)

@habamax What about all the other omnifuncs that use getcompletion()?

I initially noticed this behavior using the omnifunc from yegappan/lsp but that was actually another problem in which the fuzzy completion was happening server-side. I then tested vim's omnifunc and, apparently by accident, it had the same problem which I was able to attribute to &wildoptions.

—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

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

zeertzjq

unread,
Sep 22, 2026, 6:30:17 PM (3 days ago) Sep 22
to vim/vim, Subscribed
zeertzjq left a comment (vim/vim#21355)

What other omnifuncs?

—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

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

Maxim Kim

unread,
Sep 22, 2026, 7:28:03 PM (3 days ago) Sep 22
to vim/vim, Subscribed
habamax left a comment (vim/vim#21355)

@habamax What about all the other omnifuncs that use getcompletion()?

I am not aware of other omnifuncs that use getcompletion(). Vim's omnicomple uses it to complete vimscript, I am not sure if other filetypes would benefit from it.

I initially noticed this behavior using the omnifunc from yegappan/lsp but that was actually another problem in which the fuzzy completion was happening server-side. I then tested vim's omnifunc and, apparently by accident, it had the same problem which I was able to attribute to &wildoptions.

That is probably a different issue then and it needs reproducible steps.

—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

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

Reply all
Reply to author
Forward
0 new messages