cmp: finally fix the annoying tab jump issue

This commit is contained in:
Tigor Hutasuhut 2024-07-31 21:24:28 +07:00
parent 38e3c66ab2
commit b47ef5fbe0
2 changed files with 40 additions and 9 deletions

View file

@ -6,10 +6,6 @@ require "config.neovide"
vim.keymap.set("t", "<c-d>", "<C-\\><C-n>", { silent = true, desc = "Exit Terminal Mode" }) vim.keymap.set("t", "<c-d>", "<C-\\><C-n>", { silent = true, desc = "Exit Terminal Mode" })
-- LazyVim hardcode tabs to jump snippet completions. Very fucking annoying.
vim.keymap.del({ "i" }, "<tab>")
vim.keymap.del({ "i" }, "<s-tab>")
vim.keymap.set( vim.keymap.set(
"n", "n",
"<leader>z", "<leader>z",

View file

@ -1,7 +1,42 @@
return { return {
{
"L3MON4D3/LuaSnip", "L3MON4D3/LuaSnip",
opts = function(_, opts) opts = function(_, opts)
require "snippets" require "snippets"
return opts return opts
end, end,
},
{
"nvim-cmp",
keys = {
{
"<tab>",
false,
mode = "i",
},
{
"<c-j>",
function()
return require("luasnip").jumpable(1) and "<Plug>luasnip-jump-next" or "<c-j>"
end,
expr = true,
silent = true,
mode = { "i", "s" },
},
{
"<c-k>",
function()
return require("luasnip").jumpable(-1) and "<Plug>luasnip-jump-prev" or "<c-k>"
end,
expr = true,
silent = true,
mode = "i",
},
{
"<s-tab>",
false,
mode = { "i" },
},
},
},
} }