diff --git a/vim/lua/nvim_cmp_config.lua b/vim/lua/nvim_cmp_config.lua index bad5322..d005d08 100644 --- a/vim/lua/nvim_cmp_config.lua +++ b/vim/lua/nvim_cmp_config.lua @@ -1,9 +1,15 @@ local cmp = require("cmp") -- local cmp_buffer = require("cmp_buffer") +local has_words_before = function() + unpack = unpack or table.unpack + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil +end + cmp.setup({ completion = { - completeopt = "menu,menuone,noselect", + completeopt = "menu,menuone,noinsert,noselect", }, snippet = { expand = function(args)