From a9c14629bdb3edd1d9803b9a6e311f8ba256908e Mon Sep 17 00:00:00 2001 From: Ariel D'Alessandro Date: Fri, 21 Jan 2022 20:47:06 +0100 Subject: add completition for open buffers --- lua/alpha/completition.lua | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'lua/alpha/completition.lua') diff --git a/lua/alpha/completition.lua b/lua/alpha/completition.lua index 987763d..730004e 100644 --- a/lua/alpha/completition.lua +++ b/lua/alpha/completition.lua @@ -39,7 +39,19 @@ cmp.setup { { name = "nvim_lsp" }, { name = "path" }, { name = "luasnip" }, - { name = "buffer", keyword_length = 5 }, + { + name = "buffer", + keyword_length = 5, + option = { + 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 + } + }, }, snippet = { -- cgit v1.2.3