summaryrefslogtreecommitdiff
path: root/after/plugin/luasnip.lua
diff options
context:
space:
mode:
Diffstat (limited to 'after/plugin/luasnip.lua')
-rw-r--r--after/plugin/luasnip.lua31
1 files changed, 31 insertions, 0 deletions
diff --git a/after/plugin/luasnip.lua b/after/plugin/luasnip.lua
new file mode 100644
index 0000000..e14a1a5
--- /dev/null
+++ b/after/plugin/luasnip.lua
@@ -0,0 +1,31 @@
+local ls = require("luasnip")
+local s = ls.snippet
+local i = ls.insert_node
+local t = ls.text_node
+
+local map = vim.keymap.set
+
+map("i", "<C-k>", function()
+ if ls.expand_or_locally_jumpable() then
+ ls.expand_or_jump()
+ end
+end, { silent = true })
+map({ "i", "s" }, "<C-J>", function()
+ ls.locally_jumpable(-1)
+end, { silent = true })
+map({ "i", "s" }, "<C-l>", function()
+ if ls.choice_active() then
+ ls.change_choice(1)
+ end
+end, { silent = true })
+
+-- temporary keybind to play around
+map("n", " s", "<cmd>source ~/.config/nvim/after/plugin/luasnip.lua<cr>")
+
+ls.config.set_config({
+ history = true,
+})
+
+ls.add_snippets("all", {
+ ls.parser.parse_snippet("expand", "-- this is $1 expanded $2 $3!"),
+})