this post was submitted on 15 Jun 2023
7 points (100.0% liked)

Neovim

496 readers
1 users here now

Neovim is a modal text editor forked off of Vim in 2014. Being modal means that you do not simply type text on screen, but the behavior and functionality of the editor changes entirely depending on the mode.

The most common and most used mode, the "normal mode" for Neovim is to essentially turn your keyboard in to hotkeys with which you can navigate and manipulate text. Several modes exist, but two other most common ones are "insert mode" where you type in text directly as if it was a traditional text editor, and "visual mode" where you select text.

Neovim seeks to enable further community participation in its development and to make drastic changes without turning it in to something that is "not Vim". Neovim also seeks to enable embedding the editor within GUI applications.

The Neovim logo by Jason Long is licensed under the Creative Commons Attribution 3.0 Unported License.

founded 3 years ago
MODERATORS
 

Am I the only one who struggle with cmp comparators? I can't make any setup to work like I want it to work.

Like come on, diagramIds is literally on the line above ...

The comparators aren't even documented: https://github.com/hrsh7th/nvim-cmp/issues/883

This is the closest thing I could find to usefull: https://github.com/hrsh7th/nvim-cmp/issues/183 but it didn't help either

How did you manage to cope with this? Is there some reasonable setup for cmp comparators?

top 3 comments
sorted by: hot top controversial new old
[–] muntoo 3 points 11 months ago

Not sure if this helps, but here's my ordering:

        sorting = {
          priority_weight = 2,
          comparators = {
            require("copilot_cmp.comparators").prioritize,
            compare.offset,
            compare.exact,
            compare.recently_used,
            compare.score,
            compare.scopes,
            compare.locality,
            compare.kind,
            compare.sort_text,
            compare.length,
            compare.order,
          },
        },

...Realistically copilot is so good that it knows what the next word I'm completing is without even typing in a single character, so this doesn't bother me like it used to.

[–] [email protected] 1 points 1 year ago

For me the LSP (via lsp-zero) would produce the completion you are looking for in the example. I don't know how to make that work without lsp.

[–] [email protected] 1 points 1 year ago

Unfortunately having similar issues. It is okayish, but sometimes I feel like there must be something smarter and more context aware too. But I would kind of take the language servers into account here. Though, the specification provides no scoring mechanism. Only a preselect flag which nvim-cmp already supports.

At the same time this feels like a quite complicate topic. How to actually sort/compare them? In our special case above you would add something based on symbol usage/definition close to your cursor. Which might be a relevant factor. It would be interesting if there some knowledge/science about what actually works best for such a problem.