if vim.g.snippets ~= "luasnip" or not pcall(require, "luasnip") then return end --local luasnip = require("luasnip") local ls = require "luasnip" -- local types = require "luasnip.util.types" -- local options = { history = true, updateevents = "TextChanged,TextChangedI", -- Autosnippets: enable_autosnippets = true, -- ext_opts = { -- [types.choiceNode] = { -- active = { -- virt_text = { { " « ", "NonTest" } }, -- }, -- }, -- }, -- } -- is my expansion key -- this will expand the current item or jump to the next item within the snippet. vim.keymap.set({ "i", "s" }, "", function() if ls.expand_or_jumpable() then ls.expand_or_jump() end end, { silent = true }) -- is my jump backwards key. -- this always moves to the previous item within the snippet vim.keymap.set({ "i", "s" }, "", function() if ls.jumpable(-1) then ls.jump(-1) end end, { silent = true }) -- is selecting within a list of options. -- This is useful for choice nodes (introduced in the forthcoming episode 2) vim.keymap.set("i", "", function() if ls.choice_active() then ls.change_choice(1) end end) vim.keymap.set("i", "", require "luasnip.extras.select_choice") -- shorcut to source my luasnips file again, which will reload my snippets vim.keymap.set("n", "s", "source ~/.config/nvim/lua/plugins/luasnip.lua") -- ls.parser.parse_snippet(, ) ls.snippets = { all = { -- Available in any filetype ls.parser.parse_snippet("expand", "-- this is what was expanded!"), }, lua = { -- Lua specific snippets go here. }, } --luasnip.config.set_config(options) --require("luasnip.loaders.from_vscode").lazy_load() --require("luasnip.loaders.from_vscode").lazy_load { paths = vim.g.luasnippets_path or "" } -- --vim.api.nvim_create_autocmd("InsertLeave", { -- callback = function() -- if -- require("luasnip").session.current_nodes[vim.api.nvim_get_current_buf()] -- and not require("luasnip").session.jump_active -- then -- require("luasnip").unlink_current() -- end -- end, --})