summaryrefslogtreecommitdiff
path: root/lua/config/luasnips.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/config/luasnips.lua')
-rw-r--r--lua/config/luasnips.lua21
1 files changed, 21 insertions, 0 deletions
diff --git a/lua/config/luasnips.lua b/lua/config/luasnips.lua
new file mode 100644
index 0000000..22fc94f
--- /dev/null
+++ b/lua/config/luasnips.lua
@@ -0,0 +1,21 @@
+return function()
+ local ls = require("luasnip")
+
+ -- Expand snippet
+ vim.keymap.set("i", "<C-K>", function() ls.expand() end, { silent = true })
+
+ -- Jump forward/backward
+ vim.keymap.set({ "i", "s" }, "<C-L>", function() ls.jump(1) end, { silent = true })
+ vim.keymap.set({ "i", "s" }, "<C-J>", function() ls.jump(-1) end, { silent = true })
+
+ -- Change choice in choice node
+ vim.keymap.set({ "i", "s" }, "<C-E>", function()
+ if ls.choice_active() then
+ ls.change_choice(1)
+ end
+ end, { silent = true })
+
+ -- Optionally, load snippets here if you have them
+ -- require("luasnip.loaders.from_vscode").lazy_load()
+end
+