diff --git a/lua/cmp_buffer/buffer.lua b/lua/cmp_buffer/buffer.lua index c333b29..478c035 100644 --- a/lua/cmp_buffer/buffer.lua +++ b/lua/cmp_buffer/buffer.lua @@ -99,7 +99,7 @@ function buffer.index_line(self, i, line) local s, e = self:matchstrpos(buf) if s then local word = string.sub(buf, s, e - 1) - if #word > 1 and string.match(word, '%a$') then + if #word > 1 and string.match(word, '[%a%d]$') then table.insert(words, word) end end diff --git a/lua/cmp_buffer/init.lua b/lua/cmp_buffer/init.lua index f0626d4..9381567 100644 --- a/lua/cmp_buffer/init.lua +++ b/lua/cmp_buffer/init.lua @@ -28,11 +28,12 @@ source.complete = function(self, request, callback) end vim.defer_fn(vim.schedule_wrap(function() + local input = string.sub(request.context.cursor_before_line, request.offset) local items = {} local words = {} for _, buf in ipairs(self:_get_buffers(request)) do for _, word in ipairs(buf:get_words()) do - if not words[word] then + if not words[word] and input ~= word then words[word] = true table.insert(items, { label = word,