From 89fd2eb367174888a3cbe1184b728fbbc5c39f58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Pankowski?= Date: Mon, 28 Aug 2023 21:10:16 +0200 Subject: [PATCH] after luasnip --- nvim/.config/nvim/after/plugin/luasnip.lua | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 nvim/.config/nvim/after/plugin/luasnip.lua 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" })