fix cmp bug
This commit is contained in:
parent
1c59815bcf
commit
eaebce583c
1 changed files with 7 additions and 2 deletions
|
|
@ -38,7 +38,12 @@ _:
|
||||||
"<C-Y>" = "cmp.config.disable";
|
"<C-Y>" = "cmp.config.disable";
|
||||||
"<C-E>" = "cmp.mapping { i = cmp.mapping.abort(), c = cmp.mapping.close() }";
|
"<C-E>" = "cmp.mapping { i = cmp.mapping.abort(), c = cmp.mapping.close() }";
|
||||||
"<CR>" = "cmp.mapping.confirm { select = false }";
|
"<CR>" = "cmp.mapping.confirm { select = false }";
|
||||||
"<Tab>" = "cmp.mapping(function(fallback)
|
"<Tab>" = ''cmp.mapping(function(fallback)
|
||||||
|
local function has_words_before()
|
||||||
|
local line, col = (unpack or table.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
|
||||||
|
|
||||||
if (cmp.core.view:visible() or vim.fn.pumvisible() == 1) then
|
if (cmp.core.view:visible() or vim.fn.pumvisible() == 1) then
|
||||||
cmp.select_next_item()
|
cmp.select_next_item()
|
||||||
elseif vim.snippet and vim.snippet.active { direction = 1 } then
|
elseif vim.snippet and vim.snippet.active { direction = 1 } then
|
||||||
|
|
@ -48,7 +53,7 @@ _:
|
||||||
else
|
else
|
||||||
fallback()
|
fallback()
|
||||||
end
|
end
|
||||||
end, { 'i', 's' })";
|
end, { 'i', 's' })'';
|
||||||
"<S-Tab>" = "cmp.mapping(function(fallback)
|
"<S-Tab>" = "cmp.mapping(function(fallback)
|
||||||
if (cmp.core.view:visible() or vim.fn.pumvisible() == 1) then
|
if (cmp.core.view:visible() or vim.fn.pumvisible() == 1) then
|
||||||
cmp.select_prev_item()
|
cmp.select_prev_item()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue