api.nvim_create_autocmd("TextChangedI", {
pattern = "*",
callback = function ()
local cursor_left = utils.get_cursor_content(-1, -1)
if vim.fn.pumvisible() == 0 and cursor_left:match("%a") then
api.nvim_input("<C-n>")
end
end
})
this snippets can auto popup completion window but in some case it seems will cause infinity loop such as input lua| <------ Cursor stay here
local key_str = "a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:p:q:r:s:t:u:v:w:x:y:z:_:-"
for key in string.gmatch(key_str, "[^:]") do
vim.keymap.set("i", key, function ()
if vim.fn.pumvisible() == 0 then
return key .. "<C-n>"
end
return key
end, { expr = true })
end
this implementation wont get any bad performance issue but itโs not that elegant
is there any cool way can implement that?