mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 06:39:14 +00:00
35 lines
925 B
Lua
35 lines
925 B
Lua
local cmp = require("cmp")
|
|
local luasnip = require("luasnip")
|
|
|
|
luasnip.setup { update_events = { "TextChanged", "TextChangedI" } }
|
|
|
|
cmp.setup {
|
|
snippet = {
|
|
expand = function(args) luasnip.lsp_expand(args.body) end,
|
|
},
|
|
mapping = cmp.mapping.preset.insert {
|
|
["<Tab>"] = cmp.mapping(function(fallback)
|
|
if luasnip.locally_jumpable(1) then
|
|
luasnip.jump(1)
|
|
else
|
|
fallback()
|
|
end
|
|
end, { "i", "s" }),
|
|
|
|
["<S-Tab>"] = cmp.mapping(function(fallback)
|
|
if luasnip.locally_jumpable(-1) then
|
|
luasnip.jump(-1)
|
|
else
|
|
fallback()
|
|
end
|
|
end, { "i", "s" }),
|
|
},
|
|
sources = cmp.config.sources({
|
|
{ name = "luasnip" },
|
|
{ name = "nvim_lsp" },
|
|
{ name = "path" },
|
|
}, {
|
|
{ name = "buffer" },
|
|
{ name = "spell" },
|
|
}),
|
|
}
|