From 5762d37163b040bd1b8e9141cc38477100c8ec37 Mon Sep 17 00:00:00 2001 From: Rob Watson Date: Sun, 1 Oct 2023 08:10:27 +0200 Subject: [PATCH] fix(nvim): cmp config --- vim/lua/nvim_cmp_config.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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)