local M = { "L3MON4D3/LuaSnip", dependencies = { "rafamadriz/friendly-snippets", config = function() require("luasnip.loaders.from_vscode").lazy_load() end, }, } function M.config() local util = require("util") local luasnip = require("luasnip") require("neogen") luasnip.config.setup({ history = true, enable_autosnippets = true, -- Update more often, :h events for more info. -- updateevents = "TextChanged,TextChangedI", }) --- to jump to next snippet's placeholder local function on_tab() return luasnip.jump(1) and "" or util.t("") end --- to jump to next snippet's placeholder local function on_s_tab() return luasnip.jump(-1) and "" or util.t("") end -- vim.keymap.set("i", "", on_tab, { expr = true }) -- vim.keymap.set("s", "", on_tab, { expr = true }) -- vim.keymap.set("i", "", on_s_tab, { expr = true }) -- vim.keymap.set("s", "", on_s_tab, { expr = true }) vim.cmd([[ " press to expand or jump in a snippet. These can also be mapped separately " via luasnip-expand-snippet and luasnip-jump-next. imap luasnip#expand_or_jumpable() ? 'luasnip-expand-or-jump' : '' " -1 for jumping backwards. inoremap lua require'luasnip'.jump(-1) snoremap lua require('luasnip').jump(1) snoremap lua require('luasnip').jump(-1) ]]) end return M