amarakon / nvim-cmp-buffer-lines

nvim-cmp completion source for buffer lines

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Only trigger line-completion with CTRL-X CTRL-L

tummetott opened this issue · comments

Hey there,

I'm wondering if it's possible to turn off automatic completion for this cmp source and instead activate it only when using a special key combination, like the native CTRL-X CTRL-L. When I trigger it manually, I'd like to see only completions from this source, and I don't want any other cmp sources to appear in the popup menu.

Thanks!

I don’t know if this needs to be implemented in this plugin or if you can already do that with your nvim-cmp configuration. I think you should open an issue on https://github.com/hrsh7th/nvim-cmp/issues and ask about this.

It is actually already working with the right cmp configuration. Thank you!

Can you share your nvim-cmp configuration so that I can update the README with instructions on how to do this?

This it how it works: Don't list the buffer-lines source in cmp-config.sources. Only create a keymap under cmp-config.mapping as follows

require('cmp').setup {
    mapping = {
        ['<C-x><C-l>'] = cmp.mapping.complete {
            config = {
                sources = {
                    {
                        name = 'buffer-lines',
                        option = { ... },
                    }
                },
            }
        }
    }
}

This was useful to me. Suggest adding it to the README.md.