summaryrefslogtreecommitdiff
path: root/after/plugin/luasnip.lua
diff options
context:
space:
mode:
authorGravatar Matthew Wozniak <sirtomato999@gmail.com> 2024-01-18 19:30:36 -0500
committerGravatar Matthew Wozniak <sirtomato999@gmail.com> 2024-01-18 19:30:36 -0500
commit31c7bc5258d7323658e60cb5400d5f3457fff74f (patch)
treec078a831c2eb148398428d61259e3e418a83d1fa /after/plugin/luasnip.lua
parentca3ccc842c919e42ff21382a62d23a74e31b39dc (diff)
downloadnvim-31c7bc5258d7323658e60cb5400d5f3457fff74f.tar.gz
nvim-31c7bc5258d7323658e60cb5400d5f3457fff74f.zip
vimtex
Diffstat (limited to 'after/plugin/luasnip.lua')
-rw-r--r--after/plugin/luasnip.lua24
1 files changed, 24 insertions, 0 deletions
diff --git a/after/plugin/luasnip.lua b/after/plugin/luasnip.lua
new file mode 100644
index 0000000..5ee5143
--- /dev/null
+++ b/after/plugin/luasnip.lua
@@ -0,0 +1,24 @@
+require("luasnip").config.set_config({ -- Setting LuaSnip config
+
+ -- Enable autotriggered snippets
+ enable_autosnippets = true,
+
+ -- Use Tab (or some other key if you prefer) to trigger visual selection
+ store_selection_keys = "<Tab>",
+})
+
+vim.cmd[[
+" Expand or jump in insert mode
+imap <silent><expr> <Tab> luasnip#expand_or_jumpable() ? '<Plug>luasnip-expand-or-jump' : '<Tab>'
+
+" Jump forward through tabstops in visual mode
+smap <silent><expr> <Tab> luasnip#jumpable(1) ? '<Plug>luasnip-jump-next' : '<Tab>'
+
+" Jump backward through snippet tabstops with Shift-Tab (for example)
+imap <silent><expr> <S-Tab> luasnip#jumpable(-1) ? '<Plug>luasnip-jump-prev' : '<S-Tab>'
+smap <silent><expr> <S-Tab> luasnip#jumpable(-1) ? '<Plug>luasnip-jump-prev' : '<S-Tab>'
+]]
+
+require("luasnip.loaders.from_lua").load({
+ paths = "~/etc/nvim/luasnip",
+})