[nvim] rewrite: has_words_before in cmp.lua
This commit is contained in:
parent
d9e7f76a5f
commit
4669337540
@ -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()
|
||||
|
Reference in New Issue
Block a user