hrsh7th / cmp-cmdline

nvim-cmp source for vim's cmdline
MIT License
566 stars 45 forks source link

fix regexes #43

Closed max397574 closed 2 years ago

max397574 commented 2 years ago

This fixes the regexes to only match at the beginning of the file before all the completions which included any of the regexes (e.g. to) didn't work

hrsh7th commented 2 years ago

It looks ok but I didn't understand why this is needed. Could you explain the fail case?

max397574 commented 2 years ago

for me Neorg toc didn't work When I printed cmdline just before the vim.fn.getcompletion call it was just c

hrsh7th commented 2 years ago

Sorry. I can't reproduce with neorg... (I'd install it but I can't see :Neorg toc command)

max397574 commented 2 years ago

did you load the toc module?

vsedov commented 2 years ago

Sorry. I can't reproduce with neorg... (I'd install it but I can't see :Neorg toc command)

Hi, So if you quickly open a norg file, so something like nvim test.norg - you should be able to use Neorg toc [options] in maxes branch he fixed this issue, but to replicate

setup neorg config - open neorg file like nvim test.norg :Neorg toc [tab or what ever you use to get to the next argument] and that should be able to replicate it :)

hrsh7th commented 2 years ago

Sorry. neorg looks like a powerful plugin. I didn't know how to use it easily.

max397574 commented 2 years ago
require("neorg").setup({
    load = {
        ["core.defaults"] = {}, -- Load all the default modules
        ["core.norg.qol.toc"] = {}
    }
})
hrsh7th commented 2 years ago

Thank you! I can see :Neorg toc completion.

But I can't reproduce issue. I think the latest cmp-cmdline has not this issue.

vsedov commented 2 years ago

-cmdline has not this

ah for me cmp here reverts back to normal cmd mode if that makes sense ?

so with maxes branch i can do the following :

image image

While in master i get :

image image

In this case you revert back to normal cmd if that makes sense


cmp.setup.cmdline(":", {
    window = {
        completion = {
            border = { "🭽", "▔", "🭾", "▕", "🭿", "▁", "🭼", "▏" },
            scrollbar = { "║" },
        },
        documentation = {
            border = { "🭽", "▔", "🭾", "▕", "🭿", "▁", "🭼", "▏" },
            scrollbar = { "║" },
        },
    },
    sources = cmp.config.sources({

        { name = "cmdline", group_index = 1 },
        -- { name = "cmdline_history", group_index = 2 },
    }),
    enabled = function()
        return true
    end,
})```
is the config im using 
max397574 commented 2 years ago

normal mode -> native completion ig

WhoIsSethDaniel commented 2 years ago

This fixes my #38 . I don't know if it's the right fix, but it works.

hrsh7th commented 2 years ago

I've fixed this problem with another commit that including this approach. Thank you!