Something went wrong. Try again.
Neovim config
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475local ls = require("luasnip")
local M = {}
function M.setup_mappings() local key = require("utils.map") local tab = vim.api.nvim_replace_termcodes("<TAB>", true, false, true)
key.ismap({ { "<TAB>", function() if ls.expand_or_locally_jumpable() then ls.expand_or_jump() else vim.api.nvim_feedkeys(tab, "n", false) end end, }, { "<S-TAB>", function() if ls.jumpable(-1) then ls.jump(-1) end end, }, { "<C-j>", function() if ls.choice_active() then ls.change_choice(1) end end, }, { "<C-k>", function() if ls.choice_active() then require("luasnip.extras.select_choice")() end end, }, })end
function M.setup() local types = require("luasnip.util.types") ls.config.setup({ history = true, updateevents = "TextChanged,TextChangedI", region_check_events = "CursorMoved,CursorHold,InsertEnter", delete_check_events = "TextChanged", enable_autosnippets = false, ext_opts = { [types.choiceNode] = { active = { virt_text = { { "", "SnipChoiceNode" } }, }, }, [types.insertNode] = { active = { virt_text = { { "", "SnipInsertNode" } }, }, }, }, }) require("luasnip.loaders.from_lua").lazy_load({ paths = vim.fn.stdpath("config") .. "/lua/plugin/completion/luasnip/snippets", }) M.setup_mappings()end
return M