mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 14:49:14 +00:00
nvim/cmp: add simple luasnip binding to nvim-cmp
This commit is contained in:
parent
a589a5bd6a
commit
c8fd1b4163
1 changed files with 24 additions and 9 deletions
|
|
@ -7,14 +7,29 @@ cmp.setup {
|
||||||
snippet = {
|
snippet = {
|
||||||
expand = function(args) luasnip.lsp_expand(args.body) end,
|
expand = function(args) luasnip.lsp_expand(args.body) end,
|
||||||
},
|
},
|
||||||
mapping = cmp.mapping.preset.insert(),
|
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({
|
sources = cmp.config.sources({
|
||||||
{ name = "luasnip" },
|
{ name = "luasnip" },
|
||||||
{ name = "nvim_lsp" },
|
{ name = "nvim_lsp" },
|
||||||
{ name = "path" },
|
{ name = "path" },
|
||||||
},
|
}, {
|
||||||
{
|
|
||||||
{ name = "buffer" },
|
{ name = "buffer" },
|
||||||
{ name = "spell", },
|
{ name = "spell" },
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue