fix(luasnip): move mappings to cmp spec so that they dont conflict with native snippets

This commit is contained in:
Folke Lemaitre
2024-06-02 18:43:44 +02:00
parent 83c0c9405a
commit da7b7738eb

View File

@ -1,34 +1,38 @@
return { return {
"L3MON4D3/LuaSnip", {
build = (not LazyVim.is_win()) "L3MON4D3/LuaSnip",
and "echo 'NOTE: jsregexp is optional, so not a big deal if it fails to build'; make install_jsregexp" build = (not LazyVim.is_win())
or nil, and "echo 'NOTE: jsregexp is optional, so not a big deal if it fails to build'; make install_jsregexp"
dependencies = { or nil,
{ dependencies = {
"rafamadriz/friendly-snippets", {
config = function() "rafamadriz/friendly-snippets",
require("luasnip.loaders.from_vscode").lazy_load() config = function()
end, require("luasnip.loaders.from_vscode").lazy_load()
}, end,
{
"nvim-cmp",
dependencies = {
"saadparwaiz1/cmp_luasnip",
}, },
opts = function(_, opts) {
opts.snippet = { "nvim-cmp",
expand = function(args) dependencies = {
require("luasnip").lsp_expand(args.body) "saadparwaiz1/cmp_luasnip",
end, },
} opts = function(_, opts)
table.insert(opts.sources, { name = "luasnip" }) opts.snippet = {
end, expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
}
table.insert(opts.sources, { name = "luasnip" })
end,
},
},
opts = {
history = true,
delete_check_events = "TextChanged",
}, },
}, },
opts = { {
history = true, "nvim-cmp",
delete_check_events = "TextChanged",
},
-- stylua: ignore -- stylua: ignore
keys = { keys = {
{ {
@ -41,4 +45,5 @@ return {
{ "<tab>", function() require("luasnip").jump(1) end, mode = "s" }, { "<tab>", function() require("luasnip").jump(1) end, mode = "s" },
{ "<s-tab>", function() require("luasnip").jump(-1) end, mode = { "i", "s" } }, { "<s-tab>", function() require("luasnip").jump(-1) end, mode = { "i", "s" } },
}, },
},
} }