cmp-buffer
cmp-buffer copied to clipboard
Missing completions after longer period of time
Thank you for the plugin, it's awesome! I've configured it to autocomplete from all the buffers as described in the readme but I've noticed that after having Neovim opened for the whole day, the plugin misses some of the words (sometimes even from the same buffer so I have to fallback to ctrl-x ctrl-n). I'd love to provide more info but I'm not sure how to debug it. Any idea?
Thanks!
I think I've found the problem. I was using BufOnly plugin to cleanup unused buffers. Unfortunately, it uses bdelete instead of bwipeout which doesn't remove buffer from vim.api.nvim_list_bufs() results. This led to having huge list of buffers (like 50-100) after a few hours of use.
I'm going to try to use BufOnly.nvim instead and see how it goes. This plugin uses vim.api.nvim_buf_delete to delete a buffer (which according to documentation, behaves like bwipeout).
Same problem here, using barbar to delete unused buffers
@otavioschwanck with BufOnly.nvim, it has been working fine for me for a couple of weeks already.
@lcmen to really fix i did this:
-- at lua/valid_lister_buffers.lua
local function return_listed_valid_buffers()
local buffers = vim.api.nvim_list_bufs()
local buffersToUse = {}
local bufferIndex = 1
for i=1,table.getn(buffers),1 do
local buf = buffers[i]
local byte_size = vim.api.nvim_buf_get_offset(buf, vim.api.nvim_buf_line_count(buf))
if not (byte_size > 1024 * 128) and (vim.fn.buflisted(buf) == 1 or vim.fn.getbufvar(buf, '&buftype', 'ERROR') == 'terminal') then -- 1 Megabyte max
buffersToUse[bufferIndex] = buf
bufferIndex = bufferIndex + 1
end
end
return buffersToUse
end
return return_listed_valid_buffers
-- at your config
{ name = "buffer", option = { get_bufnrs = function()
return require('valid_listed_buffers')()
end } }
@otavioschwanck why do you need custom function?
@otavioschwanck why do you need custom function?
with this function i get only the buffers that are really open and the file size uns lower then 128kbs.