diff --git a/nvim/.config/nvim/after/plugin/luasnip.lua b/nvim/.config/nvim/after/plugin/luasnip.lua new file mode 100644 index 0000000..cb3e27a --- /dev/null +++ b/nvim/.config/nvim/after/plugin/luasnip.lua @@ -0,0 +1,28 @@ +local ls = require "luasnip" + +ls.config.set_config { + history = true, + updateevents = "TextChanged,TextChangedI", +} + +vim.keymap.set({ 'i', 's' }, "", function() + if ls.expand_or_jumpable() then + ls.expand_or_jump() + end +end, { silent = true }) + +vim.keymap.set({ 'i', 's' }, "", function() + if ls.jumpable(-1) then + ls.jump(-1) + end +end, { silent = true }) + +vim.keymap.set({ 'i', 's' }, "", function() + if ls.choice_active() then + ls.change_choice(1) + end +end, { silent = true }) + +ls.add_snippets("lua", { + ls.parser.parse_snippet("tc", "-- TODO: $0."), +}, { key = "my_lua" })