2023-10-27 11:29:23 +00:00
|
|
|
-- Snippets engine. A must have for me.
|
|
|
|
return {
|
|
|
|
{
|
|
|
|
"L3MON4D3/LuaSnip",
|
|
|
|
dependencies = {
|
|
|
|
"rafamadriz/friendly-snippets",
|
|
|
|
},
|
2023-10-28 03:59:02 +00:00
|
|
|
version = "^2",
|
2023-12-04 12:53:37 +00:00
|
|
|
build = "make install_jsregexp",
|
2023-10-28 03:59:02 +00:00
|
|
|
module = true,
|
2023-10-27 11:29:23 +00:00
|
|
|
config = function()
|
|
|
|
require("luasnip.loaders.from_vscode").lazy_load()
|
|
|
|
require("luasnip.loaders.from_lua").lazy_load()
|
|
|
|
|
|
|
|
local ls = require("luasnip")
|
|
|
|
local types = require("luasnip.util.types")
|
|
|
|
ls.config.set_config({
|
|
|
|
history = true,
|
|
|
|
update_events = "TextChanged,TextChangedI",
|
|
|
|
ext_opts = {
|
|
|
|
[types.choiceNode] = {
|
|
|
|
active = {
|
|
|
|
virt_text = { { "<- Current choice", "Comment" } },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
vim.keymap.set({ "i", "s" }, "<c-j>", function()
|
|
|
|
if ls.jumpable(1) then
|
|
|
|
ls.jump(1)
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
|
|
|
|
vim.keymap.set({ "i", "s" }, "<c-k>", function()
|
|
|
|
if ls.jumpable(-1) then
|
|
|
|
ls.jump(-1)
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
|
|
|
|
vim.keymap.set({ "i", "s" }, "<c-l>", function()
|
|
|
|
if ls.expand_or_jumpable() then
|
|
|
|
ls.expand_or_jump()
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
|
|
|
|
vim.keymap.set({ "i", "s" }, "<c-u>", function()
|
|
|
|
require("luasnip.extras.select_choice")()
|
|
|
|
end)
|
|
|
|
end,
|
2023-10-28 04:39:05 +00:00
|
|
|
},
|
2023-10-27 11:29:23 +00:00
|
|
|
}
|