cmp-buffer icon indicating copy to clipboard operation
cmp-buffer copied to clipboard

Document if completion from all visible buffers is default or how to set it up

Open matu3ba opened this issue 3 years ago • 5 comments
trafficstars

With the defaults and typing Oth I dont get a completion to the word Other in the other open bufffer.

matu3ba avatar Jul 11 '22 11:07 matu3ba

But it is documented. https://github.com/hrsh7th/cmp-buffer#get_bufnrs-type-fun-number

gegoune avatar Jul 11 '22 11:07 gegoune

Ah. Why not adding the defaults into https://github.com/hrsh7th/cmp-buffer#configuration like what is the convention for plugins?

matu3ba avatar Jul 11 '22 11:07 matu3ba

I can make a PR, if that would be okay for you.

matu3ba avatar Jul 11 '22 11:07 matu3ba

Mhm, for some reason that did not work and I cant find the symbols from the other file. My session file should not interfere with that and file size is not huge either. Changing the file with saving did not fix it either.

matu3ba avatar Jul 11 '22 12:07 matu3ba

How do I go about using:

get_bufnrs = function()
  return vim.api.nvim_list_bufs()
end

To complete from all open buffers?

for people that come here looking:

cmp.setup.cmdline("/", {
  mapping = cmp.mapping.preset.cmdline(),
  sources = {
    {
      name = "buffer",
      option = {
        get_bufnrs = function()
          return vim.api.nvim_list_bufs()
        end,
      },
    },
  },
})

AlaaSaadAbdo avatar Aug 08 '22 11:08 AlaaSaadAbdo