vim --clean:echo getcompletion('e', 'command') returns many commands:set wildoptions=fuzzy:echo getcompletion('e', 'command') returns empty listgetcompletion() does not take effect of 'wildoptions'.
Actually I want getcompletion('e', 'command') to take effect of 'wildoptions' and returns commands that are same as what are shown when I hit :e<Tab>, but that can break some plugins.
It may be good to add fourth argument to getcompletion() to specify whether to use fuzzy completion.
8.2.4522
OS: Windows 11 Pro
Terminal: Windows Terminal and GUI
No response
—
Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
Steps to reproduce
vim --clean- Confirm
:echo getcompletion('e', 'command')returns many commands:set wildoptions=fuzzy- Confirm
:echo getcompletion('e', 'command')returns empty listExpected behaviour
getcompletion()does not take effect of 'wildoptions'.Actually I want
getcompletion('e', 'command')to take effect of 'wildoptions' and returns commands that are same as what are shown when I hit:e<Tab>, but that can break some plugins.
It may be good to add fourth argument togetcompletion()to specify whether to use fuzzy completion.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub.
You are receiving this because you commented.![]()
A plugin can save/restore the 'wildoptions' setting if needed to get the
completion
matches with fuzzy matching and without fuzzy matching.
There might be existing scripts which work under the assumption that getcompletion() is not fuzzy. I have a few of them. But if a user with a recent Vim enables the fuzzy algorithm, then these scripts might break.
I wonder whether we should change the default behavior, and ignore the fuzzy algorithm, unless an optional flag is passed. getcompletion() already accepts a third optional argument: filtered. Maybe it could accept a fourth one. Or – to avoid too many optional flags – getcompletion() could accept a dictionary as third argument:
echo getcompletion('ignorecase', 'option', {
filtered: false,
fuzzy: false,
})
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.![]()
A plugin can save/restore the 'wildoptions' setting if needed to get the
completion
matches with fuzzy matching and without fuzzy matching.There might be existing scripts which work under the assumption that
getcompletion()is not fuzzy. I have a few of them. But if a user with a recent Vim enables the fuzzy algorithm, then these scripts might break.
I wonder whether we should change the default behavior, and ignore the fuzzy algorithm, unless an optional flag is passed.
getcompletion()already accepts a third optional argument:filtered. Maybe it could accept a fourth one. Or – to avoid too many optional flags –getcompletion()could accept a dictionary as third argument:echo getcompletion('ignorecase', 'option', { filtered: false, fuzzy: false, })
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
As Bram mentioned in his reply, using the 'wildoption' value in getcompletion() will match with what a user will see.
That's a good point. Indeed the semantics of the function is to match whatever happens on the command-line.
There are many built-in functions which are affected by the different option values. For example, the 'ignorecase' option affects the match() function and 'wildignorecase' option affects the getcompletion() function.
I think I would have preferred for these functions to be immune to user settings, but obviously we can no longer change this.
In this case, the third argument to getcompletion() will either be a dict or an boolean?
Yes, that's what I was thinking. But maybe that's not possible; or maybe it would make the signature of the function too complex (because the type of the last argument would change from bool to any).
I guess we should just wait to see if anybody complains about broken scripts. If nobody does, then there's no reason to change anything.
Anyway, thank you for for the answer.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you commented.![]()