[vim/vim] Add support for fuzzy completion to command-line completion (PR #9803)

98 views
Skip to first unread message

Yegappan Lakshmanan

unread,
Feb 19, 2022, 11:42:30 AM2/19/22
to vim/vim, Subscribed

Fuzzy completion is support for the following: buffer names, argument list, autocmd groups/events, built-in command
names, environment variables, built-in and user defined function names, highlight group names, menu names,
syntax group names, and sub options for commands.

Fuzzy completion is not supported for file names and directory names.


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/9803

Commit Summary

  • 64c5e0e Add support for command completion using fuzzy matches.

File Changes

(13 files)

Patch Links:


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.Message ID: <vim/vim/pull/9803@github.com>

codecov[bot]

unread,
Feb 19, 2022, 11:51:55 AM2/19/22
to vim/vim, Subscribed

Codecov Report

Merging #9803 (64c5e0e) into master (d56eb65) will increase coverage by 1.19%.
The diff coverage is 68.33%.

Impacted file tree graph

@@            Coverage Diff             @@

##           master    #9803      +/-   ##

==========================================

+ Coverage   81.83%   83.02%   +1.19%     

==========================================

  Files         167      153      -14     

  Lines      186265   174110   -12155     

  Branches    41947    39402    -2545     

==========================================

- Hits       152421   144550    -7871     

+ Misses      21456    17339    -4117     

+ Partials    12388    12221     -167     
Flag Coverage Δ
huge-clang-none 82.15% <67.91%> (-0.01%) ⬇️
huge-gcc-none ?
huge-gcc-testgui 80.95% <66.95%> (-0.02%) ⬇️
huge-gcc-unittests 2.02% <0.00%> (-0.01%) ⬇️
linux 83.02% <68.33%> (-0.74%) ⬇️
mingw-x64-HUGE-gui ?
windows ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/optionstr.c 90.76% <ø> (+0.19%) ⬆️
src/option.c 87.43% <50.76%> (-0.33%) ⬇️
src/buffer.c 86.03% <69.11%> (-0.67%) ⬇️
src/search.c 85.10% <72.91%> (-0.82%) ⬇️
src/cmdexpand.c 90.40% <83.05%> (-0.74%) ⬇️
src/libvterm/src/rect.h 0.00% <0.00%> (-96.78%) ⬇️
src/libvterm/src/state.c 38.86% <0.00%> (-50.77%) ⬇️
src/libvterm/include/vterm.h 0.00% <0.00%> (-44.45%) ⬇️
src/libvterm/src/keyboard.c 47.36% <0.00%> (-40.27%) ⬇️
src/libvterm/src/pen.c 48.81% <0.00%> (-35.46%) ⬇️
... and 133 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d56eb65...64c5e0e. Read the comment docs.


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/pull/9803/c1046058743@github.com>

Bram Moolenaar

unread,
Feb 19, 2022, 2:36:16 PM2/19/22
to vim/vim, Subscribed

Have some people tried this out? How well does it work?

The help should say a bit more about what "fuzzy" means for this. Something like ordering matches by "best match" instead of alphabetical?


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.Message ID: <vim/vim/pull/9803/c1046089647@github.com>

Yegappan Lakshmanan

unread,
Feb 19, 2022, 3:17:01 PM2/19/22
to vim/vim, Push

@yegappan pushed 1 commit.

  • e558943 Fix test failures with normal build. Add additional tests and update help


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.Message ID: <vim/vim/pull/9803/push/9150327248@github.com>

Yegappan Lakshmanan

unread,
Feb 19, 2022, 3:18:37 PM2/19/22
to vim_dev, reply+ACY5DGALULKN2IKBTO...@reply.github.com, vim/vim, Subscribed
Hi Bram,

On Sat, Feb 19, 2022 at 11:36 AM Bram Moolenaar <vim-dev...@256bit.org> wrote:

Have some people tried this out?

No. It will be good if others can try this out and give some feedback.

How well does it work?

The help should say a bit more about what "fuzzy" means for this. Something like ordering matches by "best match" instead of alphabetical?



I have updated the help text.

Regards,
Yegappan
 

vim-dev ML

unread,
Feb 19, 2022, 3:18:56 PM2/19/22
to vim/vim, vim-dev ML, Your activity

Hi Bram,

On Sat, Feb 19, 2022 at 11:36 AM Bram Moolenaar ***@***.***>

wrote:

> Have some people tried this out?
>
No. It will be good if others can try this out and give some feedback.

How well does it work?
>
The help should say a bit more about what "fuzzy" means for this. Something
> like ordering matches by "best match" instead of alphabetical?
>
>
>
I have updated the help text.

Regards,
Yegappan


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.Message ID: <vim/vim/pull/9803/c1046096168@github.com>

Yegappan Lakshmanan

unread,
Feb 19, 2022, 3:38:08 PM2/19/22
to vim/vim, vim-dev ML, Push

@yegappan pushed 1 commit.


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.Message ID: <vim/vim/pull/9803/push/9150399160@github.com>

Yegappan Lakshmanan

unread,
Feb 19, 2022, 9:04:30 PM2/19/22
to vim_dev, reply+ACY5DGALULKN2IKBTO...@reply.github.com, vim/vim, Subscribed
On Sat, Feb 19, 2022 at 12:18 PM Yegappan Lakshmanan
<yega...@gmail.com> wrote:
>
> Hi Bram,
>
> On Sat, Feb 19, 2022 at 11:36 AM Bram Moolenaar <vim-dev...@256bit.org> wrote:
>>
>> Have some people tried this out?
>
> No. It will be good if others can try this out and give some feedback.
>

Currently the cmdline fuzzy completion works in the following cases.

1. Buffer name completion for the ":buffer", ":sbuffer", ":bdelete",
":bwipeout", ":bunload", ":checktime",
"sign place file=" commands and user defined commands with
"-complete=buffer" argument.
2. Built-in and user defined Ex command names.
3. Option names in the ":set" command
4. Variable and function names in a Vim expression
5. Autocmd group and event names.
6. Environment variable names.
7. Highlight group name
8. Menu names
9. Syntax group names

It is not supported for file/directory names, tag names and color scheme names.

- Yegappan

vim-dev ML

unread,
Feb 19, 2022, 9:04:49 PM2/19/22
to vim/vim, vim-dev ML, Your activity

On Sat, Feb 19, 2022 at 12:18 PM Yegappan Lakshmanan
***@***.***> wrote:
>
> Hi Bram,
>
> On Sat, Feb 19, 2022 at 11:36 AM Bram Moolenaar ***@***.***> wrote:
>>
>> Have some people tried this out?
>
> No. It will be good if others can try this out and give some feedback.
>

Currently the cmdline fuzzy completion works in the following cases.

1. Buffer name completion for the ":buffer", ":sbuffer", ":bdelete",
":bwipeout", ":bunload", ":checktime",
"sign place file=" commands and user defined commands with
"-complete=buffer" argument.
2. Built-in and user defined Ex command names.
3. Option names in the ":set" command
4. Variable and function names in a Vim expression
5. Autocmd group and event names.
6. Environment variable names.
7. Highlight group name
8. Menu names
9. Syntax group names

It is not supported for file/directory names, tag names and color scheme names.

- Yegappan


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.Message ID: <vim/vim/pull/9803/c1046143663@github.com>

Maxim Kim

unread,
Feb 20, 2022, 4:03:47 AM2/20/22
to vim_dev
> It is not supported for file/directory names, tag names and color scheme names.

Is there a reason not to support file/directory names?


Yegappan Lakshmanan

unread,
Feb 20, 2022, 10:08:02 AM2/20/22
to vim_dev
Hi,

On Sun, Feb 20, 2022 at 1:03 AM Maxim Kim <hab...@gmail.com> wrote:
>
> > It is not supported for file/directory names, tag names and color scheme names.
>
> Is there a reason not to support file/directory names?
>

The call stack to get/expand a list of file/directory names is nested deeply. In
this function stack, the search pattern gets mangled (to add wildcard characters
and escape other special characters). So a lot of code changes are needed to
add fuzzy completion for file name/directory names. I may look at this after
adding fuzzy completion for tag names.

Regards,
Yegappan

Maxim Kim

unread,
Feb 20, 2022, 1:21:19 PM2/20/22
to vim_dev
Thank you, will look forward for this too!

воскресенье, 20 февраля 2022 г. в 18:08:02 UTC+3, yega...@gmail.com:

Yegappan Lakshmanan

unread,
Feb 21, 2022, 10:07:49 AM2/21/22
to vim/vim, vim-dev ML, Push

@yegappan pushed 1 commit.

  • cd78cd8 Add support for command completion using fuzzy matches.


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.Message ID: <vim/vim/pull/9803/push/9161847441@github.com>

Shane-XB-Qian

unread,
Feb 21, 2022, 11:03:16 AM2/21/22
to vim/vim, vim-dev ML, Comment

Have some people tried this out? How well does it work?

there was a try in the past, check #7872 around the bottom of that ticket.


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 commented.Message ID: <vim/vim/pull/9803/c1047028221@github.com>

Yegappan Lakshmanan

unread,
Feb 21, 2022, 9:52:31 PM2/21/22
to vim/vim, vim-dev ML, Push

@yegappan pushed 1 commit.


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.Message ID: <vim/vim/pull/9803/push/9166212984@github.com>

Yegappan Lakshmanan

unread,
Feb 21, 2022, 9:52:49 PM2/21/22
to vim/vim, vim-dev ML, Push

@yegappan pushed 2 commits.

  • c1902ac Add support for command completion using fuzzy matches.
  • 1880a29 Add additional tests


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.Message ID: <vim/vim/pull/9803/push/9166214776@github.com>

Bram Moolenaar

unread,
Feb 24, 2022, 8:14:31 AM2/24/22
to vim/vim, vim-dev ML, Comment

Looks like comments have quieted down, let me include this now.


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 commented.Message ID: <vim/vim/pull/9803/c1049847659@github.com>

Bram Moolenaar

unread,
Feb 24, 2022, 8:29:08 AM2/24/22
to vim/vim, vim-dev ML, Comment

Closed #9803 via 38b85cb.


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 commented.Message ID: <vim/vim/pull/9803/issue_event/6132203129@github.com>

Maxim Kim

unread,
Feb 24, 2022, 10:42:56 AM2/24/22
to vim/vim, vim-dev ML, Comment

It works okay but results are not that useful as I thought they would be.

For example, I have a FixSpaces user command and when I try to find it with :fi<tab> or :Fi<Tab> I get following:

image

It is really deep down the list:
image

vim-fuzzy

PS, :fs finds :FixSpaces right away, which is convenient indeed.


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 commented.Message ID: <vim/vim/pull/9803/c1049989191@github.com>

Maxim Kim

unread,
Feb 24, 2022, 10:45:32 AM2/24/22
to vim/vim, vim-dev ML, Comment

I also have :Sy command and whey I do :sy<tab>

image


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 commented.Message ID: <vim/vim/pull/9803/c1049991648@github.com>

Maxim Kim

unread,
Feb 24, 2022, 10:50:52 AM2/24/22
to vim/vim, vim-dev ML, Comment

And this is indeed strange...

I have my own implementation of fuzzy command selection (using built in functions) and I get this:

image


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 commented.Message ID: <vim/vim/pull/9803/c1049996795@github.com>

Yegappan Lakshmanan

unread,
Feb 24, 2022, 11:42:55 AM2/24/22
to vim_dev, reply+ACY5DGFVIHCM34HDRU...@reply.github.com, vim/vim, vim-dev ML, Comment
Hi,

Thanks for testing and reporting the problem. I found the issue (basically regular expression matching
is used instead of fuzzy matching for some matches). I will send out a PR.

Regards,
Yegappan

vim-dev ML

unread,
Feb 24, 2022, 11:43:10 AM2/24/22
to vim/vim, vim-dev ML, Your activity

Hi,

Thanks for testing and reporting the problem. I found the issue (basically
regular expression matching
is used instead of fuzzy matching for some matches). I will send out a PR.

Regards,
Yegappan

On Thu, Feb 24, 2022 at 7:42 AM Maxim Kim ***@***.***> wrote:

> It works okay but results are not that useful as I thought they would be.
>
> For example, I have a FixSpaces user command and when I try to find it
> with :fi<tab> or :Fi<Tab> I get following:
>
> [image: image]
> <https://user-images.githubusercontent.com/234774/155556151-d3cf956c-202e-4a85-8a6a-a1acfb9448b4.png>

>
> It is really deep down the list:
> [image: image]
> <https://user-images.githubusercontent.com/234774/155556292-0a3ae0e2-a1cb-4cee-9587-c6d860e47900.png>
>
> [image: vim-fuzzy]
> <https://user-images.githubusercontent.com/234774/155557091-e243cbae-e872-4a32-8b9f-312a1b70cf43.gif>

>
> PS, :fs finds :FixSpaces right away, which is convenient indeed.
>
>
>


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.Message ID: <vim/vim/pull/9803/c1050047317@github.com>

Yegappan Lakshmanan

unread,
Feb 25, 2022, 10:43:52 AM2/25/22
to vim_dev, reply+ACY5DGEJ2RS76CDVLO...@reply.github.com, vim/vim, vim-dev ML, Comment
Hi,

On Thu, Feb 24, 2022 at 7:50 AM Maxim Kim <vim-dev...@256bit.org> wrote:

And this is indeed strange...

I have my own implementation of fuzzy command selection (using built in functions) and I get this:


These issues should now be addressed by patch 8.2.4465. Can you try the latest image?

Thanks,
Yegappan

vim-dev ML

unread,
Feb 25, 2022, 10:44:09 AM2/25/22
to vim/vim, vim-dev ML, Your activity

Hi,


On Thu, Feb 24, 2022 at 7:50 AM Maxim Kim ***@***.***> wrote:

> And this is indeed strange...
>
> I have my own implementation of fuzzy command selection (using built in
> functions) and I get this:
>

These issues should now be addressed by patch 8.2.4465. Can you try the
latest image?

Thanks,
Yegappan


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.Message ID: <vim/vim/pull/9803/c1050965472@github.com>

Maxim Kim

unread,
Feb 25, 2022, 11:58:54 AM2/25/22
to vim/vim, vim-dev ML, Comment

Yes, it works very well now, thank you!


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 commented.Message ID: <vim/vim/pull/9803/c1051026331@github.com>

Reply all
Reply to author
Forward
0 new messages