[nvim] rewrite: has_words_before in cmp.lua

This commit is contained in:
David JULIEN 2022-04-29 00:18:25 +02:00
parent d9e7f76a5f
commit 4669337540

View File

@ -7,7 +7,7 @@ local cmp = require("cmp")
local luasnip = require("luasnip")
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
local check_backspace = function()
local has_words_before = function()
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]:
@ -64,7 +64,7 @@ cmp.setup {
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif check_backspace() then
elseif has_words_before() then
cmp.complete()
else
fallback()