Go to file
2021-08-25 15:33:47 +09:00
after/plugin Initial commit 2021-08-08 17:38:47 +09:00
lua/cmp_buffer Fix keyword pattern 2021-08-25 13:10:56 +09:00
README.md Add source name 2021-08-25 15:33:47 +09:00

cmp-buffer

nvim-cmp source for buffer words.

Setup

require'cmp'.setup {
  sources = {
    { name = 'buffer' }
  }
}

Configuration

The below source configuration are available.

keyword_pattern (type: string)

Default: %(-?\d+%(.\d+)?

A vim's regular expression for creating a word list from buffer content.

get_bufnrs (type: fun(): number[])

Default: function() return { vim.api.nvim_get_current_buf() } end

A function that specifies the buffer numbers to complete.

You can use the following pre-defined recipes.

All buffers
get_bufnrs = function()
  return vim.api.nvim_list_bufs()
end
Visible buffers
get_bufnrs = function()
  local bufs = {}
  for _, win in ipairs(vim.api.nvim_list_wins()) do
    bufs[vim.api.nvim_win_get_buf(win)] = true
  end
  return vim.tbl_keys(bufs)
end