fix tab/s-tab with snippets

This commit is contained in:
2026-07-02 13:04:19 +00:00
parent aa093b7601
commit d8470a7517
+11 -5
View File
@@ -77,7 +77,11 @@ NV_Darcula_Coc_Shift_Tab_Complete = function()
return vim.fn["coc#pum#prev"](1) return vim.fn["coc#pum#prev"](1)
end end
return "<C-h>" if vim.fn["coc#jumpable"](-1) == 1 then
return vim.fn["coc#rpc#request"]("doKeymap", {"snippets-previous"})
end
return "<S-Tab>"
end end
NV_Darcula_Coc_Tab_Complete = function() NV_Darcula_Coc_Tab_Complete = function()
@@ -85,15 +89,17 @@ NV_Darcula_Coc_Tab_Complete = function()
return vim.fn["coc#pum#next"](1) return vim.fn["coc#pum#next"](1)
end end
if vim.fn["coc#expandableOrJumpable"]() == 1 then
return vim.fn["coc#rpc#request"]("doKeymap", {"snippets-expand-jump"})
end
local check_backspace = function() local check_backspace = function()
local col = vim.api.nvim_win_get_cursor(0)[2] local col = vim.api.nvim_win_get_cursor(0)[2]
return (col == 0 or return col == 0 or vim.api.nvim_get_current_line():sub(col, col):match("%s")
vim.api.nvim_get_current_line():sub(col, col):match("%s")) and
true
end end
if check_backspace() then if check_backspace() then
return "<tab>" return "<Tab>"
end end
return vim.fn["coc#refresh"]() return vim.fn["coc#refresh"]()