init.lua/lua/plugins/luasnip.lua(view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
---@type LazySpec
return {
"L3MON4D3/LuaSnip",
dependencies = { "rafamadriz/friendly-snippets" },
build = "make install_jsregexp",
keys = {
{
"<C-l>",
function()
local ls = require "luasnip"
if ls.choice_active() then
ls.change_choice(1)
elseif ls.expand_or_jumpable() then
ls.expand_or_jump()
end
end,
mode = { "s", "i" },
},
},
config = function()
local ls = require "luasnip"
local types = require "luasnip.util.types"
ls.config.set_config {
ext_opts = {
[types.choiceNode] = {
passive = {
virt_text = { { "●", "Operator" } },
hl_group = "LuaSnipChoiceNode",
},
},
[types.insertNode] = {
active = {
virt_text = { { "●", "Type" } },
hl_group = "LuaSnipInsertNode",
},
},
},
}
require("luasnip.loaders.from_vscode").lazy_load()
end,
}
|