hrsh7th / cmp-cmdline

nvim-cmp source for vim's cmdline
MIT License
505 stars 41 forks source link

does not complete vim.ui.input #16

Open rebelot opened 2 years ago

rebelot commented 2 years ago

vim.ui.input accepts a completion option, however cmp-cmdline will not complete candidates, but wildmenu will. I presume same problem with vim.ui.select

es:

:lua vim.ui.input({prompt = "complete me: ", completion = 'dir'}, function(input) print(input) end)
hrsh7th commented 2 years ago

Yes. because the nvim-cmp's cmdline completion focueses to the : and / mode only at the moment.

petobens commented 1 year ago

Hi @hrsh7th! How can I make the regular Tab (wildmode) completion work in vim.ui.input while still using nvim cmp cmdline? If I have the following config:

cmp.setup.cmdline(':', {
    mapping = cmp.mapping.preset.cmdline({
        -- Select candidate but don't execute with enter (do that with C-y)
        ['<CR>'] = {
            c = cmp.mapping.confirm({
                select = true,
            }),
        },
    }),
    sources = cmp.config.sources({
        { name = 'cmdline' },
    }, {
        { name = 'path' },
    }),
})

And try @rebelot snippet above then there is neither cmp nor regular Tab completion available. Any pointers are appreciated.

dsych commented 1 year ago

you can do the following:

cmp.setup.cmdline("@", {
    sources = cmp.config.sources({
        { name = "path" },
        { name = "cmdline" },           
    }),
})

:h getcmdtype(), look at @

petobens commented 1 year ago

Awesome. Thanks @dsych