refactor: still not ideal...

This commit is contained in:
Folke Lemaitre 2024-11-11 00:49:05 +01:00
parent b2e012cb83
commit 0270a39a7b
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
6 changed files with 89 additions and 59 deletions

View file

@ -106,10 +106,22 @@ return {
table.insert(opts.sources, { name = "snippets" })
end
end,
-- stylua: ignore
keys = {
{
"<tab>",
function()
return vim.snippet.active({ direction = 1 }) and "<cmd>lua vim.snippet.jump(1)<cr>"
or LazyVim.cmp.ai_accept()
or "<Tab>"
end,
expr = true, silent = true, mode = "i",
},
},
init = function()
-- Neovim enabled snippet navigation mappings by default in v0.11
if vim.fn.has("nvim-0.11") == 0 then
vim.keymap.set({ "i", "s" }, "<Tab>", function()
vim.keymap.set({ "s" }, "<Tab>", function()
return vim.snippet.active({ direction = 1 }) and "<cmd>lua vim.snippet.jump(1)<cr>" or "<Tab>"
end, { expr = true, silent = true })
vim.keymap.set({ "i", "s" }, "<S-Tab>", function()