1 files changed,
18 insertions(+),
23 deletions(-)
Author:
Smirnov Oleksandr
ss2316544@gmail.com
Committed at:
2023-05-21 19:15:42 +0300
Parent:
2385a99
M
lua/plugins/luasnip.lua
@@ -1,16 +1,28 @@
return { "L3MON4D3/LuaSnip", dependencies = { "rafamadriz/friendly-snippets" }, + 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 map = require("core.utils").map local ls = require "luasnip" local types = require "luasnip.util.types" local fmt = require("luasnip.extras.fmt").fmt local extras = require "luasnip.extras" ls.config.set_config { - history = true, - updateevents = "TextChanged,TextChangedI", + history = false, region_check_events = "CursorMoved,CursorHold,InsertEnter", delete_check_events = "InsertLeave", snip_env = {@@ -25,31 +37,14 @@ c = ls.choice_node,
d = ls.dynamic_node, i = ls.insert_node, }, + -- stylua: ignore ext_opts = { - [types.choiceNode] = { - passive = { - virt_text = { { "●", "Operator" } }, - hl_group = "LuaSnipChoiceNode", - }, - }, - [types.insertNode] = { - active = { - virt_text = { { "●", "Type" } }, - hl_group = "LuaSnipInsertNode", - }, - }, + [types.choiceNode] = { passive = { virt_text = { { "●", "Operator" } }, hl_group = "LuaSnipChoiceNode", }, }, + [types.insertNode] = { active = { virt_text = { { "●", "Type" } }, hl_group = "LuaSnipInsertNode", }, }, }, } require("luasnip.loaders.from_lua").lazy_load() require("luasnip.loaders.from_vscode").lazy_load() - - map({ "s", "i" }, "<C-l>", function() - if ls.choice_active() then - ls.change_choice(1) - elseif ls.expand_or_jumpable() then - ls.expand_or_jump() - end - end) end, }