local ls = require('luasnip') local ll = require('luasnip.loaders.from_lua') local types = require('luasnip.util.types') ls.config.set_config({ enable_autosnippets = true, store_selection_keys = '', history = true, updateevents = 'TextChanged,TextChangedI', delete_check_events = 'TextChanged', ext_opts = { [types.insertNode] = { active = {}, unvisited = { virt_text = { { '<- insert', 'DiagnosticVirtualTextHint' } } }, visited = {}, passive = {}, snippet_passive = {}, }, [types.choiceNode] = { active = { virt_text = { { '<- insert', 'DiagnosticVirtualTextError' } }, }, } }, }) ll.load({ paths = { vim.fn.stdpath('config') .. '/snippets' } }) 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('n', 's', function() vim.cmd('source ' .. vim.fn.stdpath('config') .. '/after/plugin/luasnip.lua') vim.notify('Sourced snippets', 'info', { title = 'LuaSnip' }) end)