nvim: luasnip
This commit is contained in:
@ -5,10 +5,10 @@ return {
|
||||
end,
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-vsnip",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"hrsh7th/cmp-nvim-lsp-signature-help",
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"onsails/lspkind.nvim",
|
||||
},
|
||||
opts = function()
|
||||
@ -16,12 +16,13 @@ return {
|
||||
|
||||
local cmp = require("cmp")
|
||||
local neogen = require("neogen")
|
||||
local luasnip = require("luasnip")
|
||||
local lspkind = require("lspkind")
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
vim.fn["vsnip#anonymous"](args.body)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
@ -35,34 +36,36 @@ return {
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = false,
|
||||
}),
|
||||
["<tab>"] = cmp.mapping(function(fallback)
|
||||
if neogen.jumpable() then
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.locally_jumpable(1) then
|
||||
luasnip.jump(1)
|
||||
elseif neogen.jumpable() then
|
||||
neogen.jump_next()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, {
|
||||
"i",
|
||||
"s",
|
||||
}),
|
||||
["<S-tab>"] = cmp.mapping(function(fallback)
|
||||
if neogen.jumpable(true) then
|
||||
end, { "i", "s" }),
|
||||
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.locally_jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
elseif neogen.jumpable() then
|
||||
neogen.jump_prev()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, {
|
||||
"i",
|
||||
"s",
|
||||
}),
|
||||
end, { "i", "s" }),
|
||||
},
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "nvim_lsp_signature_help" },
|
||||
{ name = "path" },
|
||||
{ name = "buffer", keyword_length = 5 },
|
||||
{ name = "vsnip" },
|
||||
{ name = "orgmode" },
|
||||
{ name = "luasnip" },
|
||||
},
|
||||
formatting = {
|
||||
format = lspkind.cmp_format({
|
||||
|
||||
Reference in New Issue
Block a user