2022-10-13 01:05:38 +02:00
|
|
|
local M = {}
|
|
|
|
local luasnip = require("luasnip")
|
|
|
|
|
2022-11-01 16:48:18 +01:00
|
|
|
local function reload()
|
|
|
|
require("luasnip.loaders.from_vscode").lazy_load()
|
|
|
|
end
|
|
|
|
|
2022-10-13 01:05:38 +02:00
|
|
|
function M.setup()
|
|
|
|
vim.keymap.set("i", "<Tab>", function()
|
|
|
|
if luasnip.jumpable(1) then
|
|
|
|
return "<cmd>lua require('luasnip').jump(1)<cr>"
|
|
|
|
else
|
|
|
|
return "<Tab>"
|
|
|
|
end
|
|
|
|
end, { expr = true })
|
|
|
|
vim.keymap.set("i", "<S-Tab>", function()
|
|
|
|
luasnip.jump(-1)
|
|
|
|
end)
|
2022-11-01 16:48:18 +01:00
|
|
|
|
|
|
|
vim.keymap.set("n", "<leader>rs", reload, {
|
|
|
|
desc = "Reload luasnip snippets"
|
|
|
|
})
|
|
|
|
|
|
|
|
reload()
|
2022-10-13 01:05:38 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
return M
|