Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(completion): fuzzy on default completion #15193

Closed
wants to merge 4 commits into from

Conversation

glepnir
Copy link
Member

@glepnir glepnir commented Jul 9, 2024

make fuzzy works on keyword completion.

@zeertzjq zeertzjq changed the title fix(completion): fuzzy on defaule keyword completion fix(completion): fuzzy on default keyword completion Jul 9, 2024
@glepnir
Copy link
Member Author

glepnir commented Jul 9, 2024

need a rebase after revert pr merge.

@zeertzjq zeertzjq marked this pull request as draft July 9, 2024 11:31
@glepnir glepnir force-pushed the fuzzy_keyword branch 2 times, most recently from 8565df6 to 68ee15c Compare July 10, 2024 06:54
@glepnir glepnir marked this pull request as ready for review July 10, 2024 06:54
@glepnir glepnir force-pushed the fuzzy_keyword branch 3 times, most recently from 66ada0a to 2eaa568 Compare July 10, 2024 12:13
@chrisbra
Copy link
Member

thanks. Can someone test this please?

@techntools
Copy link

@chrisbra @glepnir

Thanks for working on this.

Its working but in the screencast below, is it updating the match message correctly ?

fuzzy-keyword.mp4

@glepnir
Copy link
Member Author

glepnir commented Jul 11, 2024

try remove fuzzy in completeopt there will still get a wrong status msg. xyz xyb xbc then x -> xy msg still is match x of 3 . because cp_matches not update. I am not sure this is a bug ? if have an issue about this I can try to fix it

@techntools
Copy link

@chrisbra What do you think ?

src/insexpand.c Outdated Show resolved Hide resolved
src/insexpand.c Outdated Show resolved Hide resolved
src/insexpand.c Outdated Show resolved Hide resolved
@glepnir glepnir force-pushed the fuzzy_keyword branch 2 times, most recently from 8f18d50 to 8cead51 Compare July 11, 2024 10:50
@chrisbra
Copy link
Member

@chrisbra What do you think ?

I find it hard to follow. What keys did you press? And does it also happen without fuzzy as @glepnir mentions?

@techntools
Copy link

@chrisbra @glepnir

It does also happen without fuzzy as @glepnir mentions

I started with vim -u NONE. Used C-N.

To clear further, as seen in my ss:

  1. I type x, press C-N, browse through candidates with C-N, message is match 1 of 4
  2. I type z after x while the completion menu still visible, completion menu shows total candidates are only 2, browse through candidates with C-N, message is match 1 of 4. But I think message should be match 1 of 2

But if I press ESC, press C-N, completion menu opens and shows the right value for total matches

@glepnir
Copy link
Member Author

glepnir commented Jul 12, 2024

because cp_matches is the count of all candidate words. statusmsg uses it. But when the leader adds or deletes the pum array regenerates , cp_matches is not updated. So it is still the initial count. It should be easy to fix. I just don't know why no one has raised an issue. The default completion has existed for a long time. Someone should have noticed it.

I think it's better to file an issue. this has nothing to do with fuzzy. If others think it's a bug, I can fix it immediately.

@habamax
Copy link
Contributor

habamax commented Jul 12, 2024

Tried it, looks good to me.

@habamax
Copy link
Contributor

habamax commented Jul 12, 2024

However the help topic now incorrect:

	   fuzzy    Enable |fuzzy-matching| for completion candidates. This
		    allows for more flexible and intuitive matching, where
		    characters can be skipped and matches can be found even
		    if the exact sequence is not typed.  Only makes a
		    difference how completion candidates are reduced from the
		    list of alternatives, but not how the candidates are
		    collected (using different completion types).

This part

                                                         Only makes a
		    difference how completion candidates are reduced from the
		    list of alternatives, but not how the candidates are
		    collected (using different completion types).

Currently it also affects how candidates are collected. At least for keywords. Let me check other methods.

@habamax
Copy link
Contributor

habamax commented Jul 12, 2024

okay, there is a regression, at least for line completion, doesn't work at all when fuzzy is in completeopt.

@glepnir pls check following:

  1. vim -Nu NONE
  2. add 2 lines of text:
world is on fire
no one can save me but you
  1. set completeopt+=fuzzy
  2. in the new line type w<ctrl-x><ctrl-l>

"world is on fire" should be completed. But it is not:

asciicast

src/search.c Show resolved Hide resolved
src/insexpand.c Outdated Show resolved Hide resolved
src/search.c Outdated Show resolved Hide resolved
@Shane-XB-Qian
Copy link
Contributor

Shane-XB-Qian commented Jul 12, 2024 via email

@glepnir glepnir force-pushed the fuzzy_keyword branch 3 times, most recently from e82a7f6 to 38b450a Compare July 12, 2024 12:54
zeertzjq added a commit to zeertzjq/neovim that referenced this pull request Oct 7, 2024
…etion

Problem:  fuzzy completion does not work with default completion
Solution: Make it work (glepnir)

closes: vim/vim#15193

vim/vim@8159fb1

Cherry-pick insexpand.c changes from patch 9.1.0608.

N/A patch:
vim-patch:9.1.0632: MS-Windows: Compiler Warnings

Co-authored-by: glepnir <[email protected]>
zeertzjq added a commit to zeertzjq/neovim that referenced this pull request Oct 7, 2024
…pt's fuzzy documentation

Originally, `:set completeopt+=fuzzy` did not affect how the candidate
list is collected in default keyword completion. A comment was added to
documentation as part of vim/vim#14912 to clarify it. vim/vim#15193 later changed the
fuzzy behavior to now change the candidate collection behavior as well
so the clarification in docs is now wrong. Remove them here.

closes: vim/vim#15656

vim/vim@26e4b00

Co-authored-by: Yee Cheng Chin <[email protected]>
zeertzjq added a commit to zeertzjq/neovim that referenced this pull request Oct 15, 2024
…etion

Problem:  fuzzy completion does not work with default completion
Solution: Make it work (glepnir)

closes: vim/vim#15193

vim/vim@8159fb1

Cherry-pick insexpand.c changes from patch 9.1.0608.

N/A patch:
vim-patch:9.1.0632: MS-Windows: Compiler Warnings

Co-authored-by: glepnir <[email protected]>
zeertzjq added a commit to zeertzjq/neovim that referenced this pull request Oct 15, 2024
…pt's fuzzy documentation

Originally, `:set completeopt+=fuzzy` did not affect how the candidate
list is collected in default keyword completion. A comment was added to
documentation as part of vim/vim#14912 to clarify it. vim/vim#15193 later changed the
fuzzy behavior to now change the candidate collection behavior as well
so the clarification in docs is now wrong. Remove them here.

closes: vim/vim#15656

vim/vim@26e4b00

Co-authored-by: Yee Cheng Chin <[email protected]>
zeertzjq added a commit to zeertzjq/neovim that referenced this pull request Oct 20, 2024
…etion

Problem:  fuzzy completion does not work with default completion
Solution: Make it work (glepnir)

closes: vim/vim#15193

vim/vim@8159fb1

Cherry-pick insexpand.c changes from patch 9.1.0608.

N/A patch:
vim-patch:9.1.0632: MS-Windows: Compiler Warnings

Co-authored-by: glepnir <[email protected]>
zeertzjq added a commit to zeertzjq/neovim that referenced this pull request Oct 20, 2024
…pt's fuzzy documentation

Originally, `:set completeopt+=fuzzy` did not affect how the candidate
list is collected in default keyword completion. A comment was added to
documentation as part of vim/vim#14912 to clarify it. vim/vim#15193 later changed the
fuzzy behavior to now change the candidate collection behavior as well
so the clarification in docs is now wrong. Remove them here.

closes: vim/vim#15656

vim/vim@26e4b00

Co-authored-by: Yee Cheng Chin <[email protected]>
zeertzjq added a commit to zeertzjq/neovim that referenced this pull request Oct 29, 2024
…etion

Problem:  fuzzy completion does not work with default completion
Solution: Make it work (glepnir)

closes: vim/vim#15193

vim/vim@8159fb1

Cherry-pick insexpand.c changes from patch 9.1.0608.

N/A patch:
vim-patch:9.1.0632: MS-Windows: Compiler Warnings

Co-authored-by: glepnir <[email protected]>
zeertzjq added a commit to zeertzjq/neovim that referenced this pull request Oct 29, 2024
…pt's fuzzy documentation

Originally, `:set completeopt+=fuzzy` did not affect how the candidate
list is collected in default keyword completion. A comment was added to
documentation as part of vim/vim#14912 to clarify it. vim/vim#15193 later changed the
fuzzy behavior to now change the candidate collection behavior as well
so the clarification in docs is now wrong. Remove them here.

closes: vim/vim#15656

vim/vim@26e4b00

Co-authored-by: Yee Cheng Chin <[email protected]>
zeertzjq added a commit to zeertzjq/neovim that referenced this pull request Nov 21, 2024
…etion

Problem:  fuzzy completion does not work with default completion
Solution: Make it work (glepnir)

closes: vim/vim#15193

vim/vim@8159fb1

Cherry-pick insexpand.c changes from patch 9.1.0608.

N/A patch:
vim-patch:9.1.0632: MS-Windows: Compiler Warnings

Co-authored-by: glepnir <[email protected]>
zeertzjq added a commit to zeertzjq/neovim that referenced this pull request Nov 21, 2024
…pt's fuzzy documentation

Originally, `:set completeopt+=fuzzy` did not affect how the candidate
list is collected in default keyword completion. A comment was added to
documentation as part of vim/vim#14912 to clarify it. vim/vim#15193 later changed the
fuzzy behavior to now change the candidate collection behavior as well
so the clarification in docs is now wrong. Remove them here.

closes: vim/vim#15656

vim/vim@26e4b00

Co-authored-by: Yee Cheng Chin <[email protected]>
zeertzjq added a commit to zeertzjq/neovim that referenced this pull request Nov 23, 2024
…etion

Problem:  fuzzy completion does not work with default completion
Solution: Make it work (glepnir)

closes: vim/vim#15193

vim/vim@8159fb1

Cherry-pick insexpand.c changes from patch 9.1.0608.

N/A patch:
vim-patch:9.1.0632: MS-Windows: Compiler Warnings

Co-authored-by: glepnir <[email protected]>
zeertzjq added a commit to zeertzjq/neovim that referenced this pull request Nov 23, 2024
…pt's fuzzy documentation

Originally, `:set completeopt+=fuzzy` did not affect how the candidate
list is collected in default keyword completion. A comment was added to
documentation as part of vim/vim#14912 to clarify it. vim/vim#15193 later changed the
fuzzy behavior to now change the candidate collection behavior as well
so the clarification in docs is now wrong. Remove them here.

closes: vim/vim#15656

vim/vim@26e4b00

Co-authored-by: Yee Cheng Chin <[email protected]>
zeertzjq added a commit to zeertzjq/neovim that referenced this pull request Nov 23, 2024
…etion

Problem:  fuzzy completion does not work with default completion
Solution: Make it work (glepnir)

closes: vim/vim#15193

vim/vim@8159fb1

Cherry-pick insexpand.c changes from patch 9.1.0608.

N/A patch:
vim-patch:9.1.0632: MS-Windows: Compiler Warnings

Co-authored-by: glepnir <[email protected]>
zeertzjq added a commit to zeertzjq/neovim that referenced this pull request Nov 23, 2024
…pt's fuzzy documentation

Originally, `:set completeopt+=fuzzy` did not affect how the candidate
list is collected in default keyword completion. A comment was added to
documentation as part of vim/vim#14912 to clarify it. vim/vim#15193 later changed the
fuzzy behavior to now change the candidate collection behavior as well
so the clarification in docs is now wrong. Remove them here.

closes: vim/vim#15656

vim/vim@26e4b00

Co-authored-by: Yee Cheng Chin <[email protected]>
zeertzjq added a commit to zeertzjq/neovim that referenced this pull request Dec 7, 2024
…etion

Problem:  fuzzy completion does not work with default completion
Solution: Make it work (glepnir)

closes: vim/vim#15193

vim/vim@8159fb1

Cherry-pick insexpand.c changes from patch 9.1.0608.

N/A patch:
vim-patch:9.1.0632: MS-Windows: Compiler Warnings

Co-authored-by: glepnir <[email protected]>
zeertzjq added a commit to zeertzjq/neovim that referenced this pull request Dec 7, 2024
…pt's fuzzy documentation

Originally, `:set completeopt+=fuzzy` did not affect how the candidate
list is collected in default keyword completion. A comment was added to
documentation as part of vim/vim#14912 to clarify it. vim/vim#15193 later changed the
fuzzy behavior to now change the candidate collection behavior as well
so the clarification in docs is now wrong. Remove them here.

closes: vim/vim#15656

vim/vim@26e4b00

Co-authored-by: Yee Cheng Chin <[email protected]>
zeertzjq added a commit to zeertzjq/neovim that referenced this pull request Dec 18, 2024
…etion

Problem:  fuzzy completion does not work with default completion
Solution: Make it work (glepnir)

closes: vim/vim#15193

vim/vim@8159fb1

Cherry-pick insexpand.c changes from patch 9.1.0608.

N/A patch:
vim-patch:9.1.0632: MS-Windows: Compiler Warnings

Co-authored-by: glepnir <[email protected]>
zeertzjq added a commit to zeertzjq/neovim that referenced this pull request Dec 18, 2024
…pt's fuzzy documentation

Originally, `:set completeopt+=fuzzy` did not affect how the candidate
list is collected in default keyword completion. A comment was added to
documentation as part of vim/vim#14912 to clarify it. vim/vim#15193 later changed the
fuzzy behavior to now change the candidate collection behavior as well
so the clarification in docs is now wrong. Remove them here.

closes: vim/vim#15656

vim/vim@26e4b00

Co-authored-by: Yee Cheng Chin <[email protected]>
zeertzjq added a commit to zeertzjq/neovim that referenced this pull request Dec 31, 2024
…etion

Problem:  fuzzy completion does not work with default completion
Solution: Make it work (glepnir)

closes: vim/vim#15193

vim/vim@8159fb1

Cherry-pick insexpand.c changes from patch 9.1.0608.

N/A patch:
vim-patch:9.1.0632: MS-Windows: Compiler Warnings

Co-authored-by: glepnir <[email protected]>
zeertzjq added a commit to zeertzjq/neovim that referenced this pull request Dec 31, 2024
…pt's fuzzy documentation

Originally, `:set completeopt+=fuzzy` did not affect how the candidate
list is collected in default keyword completion. A comment was added to
documentation as part of vim/vim#14912 to clarify it. vim/vim#15193 later changed the
fuzzy behavior to now change the candidate collection behavior as well
so the clarification in docs is now wrong. Remove them here.

closes: vim/vim#15656

vim/vim@26e4b00

Co-authored-by: Yee Cheng Chin <[email protected]>
zeertzjq added a commit to zeertzjq/neovim that referenced this pull request Jan 9, 2025
…etion

Problem:  fuzzy completion does not work with default completion
Solution: Make it work (glepnir)

closes: vim/vim#15193

vim/vim@8159fb1

Cherry-pick insexpand.c changes from patch 9.1.0608.

N/A patch:
vim-patch:9.1.0632: MS-Windows: Compiler Warnings

Co-authored-by: glepnir <[email protected]>
zeertzjq added a commit to zeertzjq/neovim that referenced this pull request Jan 9, 2025
…pt's fuzzy documentation

Originally, `:set completeopt+=fuzzy` did not affect how the candidate
list is collected in default keyword completion. A comment was added to
documentation as part of vim/vim#14912 to clarify it. vim/vim#15193 later changed the
fuzzy behavior to now change the candidate collection behavior as well
so the clarification in docs is now wrong. Remove them here.

closes: vim/vim#15656

vim/vim@26e4b00

Co-authored-by: Yee Cheng Chin <[email protected]>
zeertzjq added a commit to zeertzjq/neovim that referenced this pull request Jan 11, 2025
…etion

Problem:  fuzzy completion does not work with default completion
Solution: Make it work (glepnir)

closes: vim/vim#15193

vim/vim@8159fb1

Cherry-pick insexpand.c changes from patch 9.1.0608.

N/A patch:
vim-patch:9.1.0632: MS-Windows: Compiler Warnings

Co-authored-by: glepnir <[email protected]>
zeertzjq added a commit to zeertzjq/neovim that referenced this pull request Jan 11, 2025
…pt's fuzzy documentation

Originally, `:set completeopt+=fuzzy` did not affect how the candidate
list is collected in default keyword completion. A comment was added to
documentation as part of vim/vim#14912 to clarify it. vim/vim#15193 later changed the
fuzzy behavior to now change the candidate collection behavior as well
so the clarification in docs is now wrong. Remove them here.

closes: vim/vim#15656

vim/vim@26e4b00

Co-authored-by: Yee Cheng Chin <[email protected]>
zeertzjq added a commit to zeertzjq/neovim that referenced this pull request Jan 12, 2025
…etion

Problem:  fuzzy completion does not work with default completion
Solution: Make it work (glepnir)

closes: vim/vim#15193

vim/vim@8159fb1

Cherry-pick insexpand.c changes from patch 9.1.0608.

N/A patch:
vim-patch:9.1.0632: MS-Windows: Compiler Warnings

Co-authored-by: glepnir <[email protected]>
zeertzjq added a commit to zeertzjq/neovim that referenced this pull request Jan 12, 2025
…pt's fuzzy documentation

Originally, `:set completeopt+=fuzzy` did not affect how the candidate
list is collected in default keyword completion. A comment was added to
documentation as part of vim/vim#14912 to clarify it. vim/vim#15193 later changed the
fuzzy behavior to now change the candidate collection behavior as well
so the clarification in docs is now wrong. Remove them here.

closes: vim/vim#15656

vim/vim@26e4b00

Co-authored-by: Yee Cheng Chin <[email protected]>
zeertzjq added a commit to zeertzjq/neovim that referenced this pull request Jan 20, 2025
…etion

Problem:  fuzzy completion does not work with default completion
Solution: Make it work (glepnir)

closes: vim/vim#15193

vim/vim@8159fb1

Cherry-pick insexpand.c changes from patch 9.1.0608.

N/A patch:
vim-patch:9.1.0632: MS-Windows: Compiler Warnings

Co-authored-by: glepnir <[email protected]>
zeertzjq added a commit to zeertzjq/neovim that referenced this pull request Jan 20, 2025
…pt's fuzzy documentation

Originally, `:set completeopt+=fuzzy` did not affect how the candidate
list is collected in default keyword completion. A comment was added to
documentation as part of vim/vim#14912 to clarify it. vim/vim#15193 later changed the
fuzzy behavior to now change the candidate collection behavior as well
so the clarification in docs is now wrong. Remove them here.

closes: vim/vim#15656

vim/vim@26e4b00

Co-authored-by: Yee Cheng Chin <[email protected]>
zeertzjq added a commit to zeertzjq/neovim that referenced this pull request Jan 25, 2025
…etion

Problem:  fuzzy completion does not work with default completion
Solution: Make it work (glepnir)

closes: vim/vim#15193

vim/vim@8159fb1

Cherry-pick insexpand.c changes from patch 9.1.0608.

N/A patch:
vim-patch:9.1.0632: MS-Windows: Compiler Warnings

Co-authored-by: glepnir <[email protected]>
zeertzjq added a commit to zeertzjq/neovim that referenced this pull request Jan 25, 2025
…pt's fuzzy documentation

Originally, `:set completeopt+=fuzzy` did not affect how the candidate
list is collected in default keyword completion. A comment was added to
documentation as part of vim/vim#14912 to clarify it. vim/vim#15193 later changed the
fuzzy behavior to now change the candidate collection behavior as well
so the clarification in docs is now wrong. Remove them here.

closes: vim/vim#15656

vim/vim@26e4b00

Co-authored-by: Yee Cheng Chin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants