neovim: setup snippets mappings and load vsc*de snippets
This commit is contained in:
@@ -38,9 +38,21 @@ cmp.setup({
|
|||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
mapping = {
|
mapping = {
|
||||||
["<C-j>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }),
|
["<C-j>"] = cmp.mapping(function()
|
||||||
["<C-k>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }),
|
if ls.in_snippet() then
|
||||||
["<C-space>"] = cmp.mapping(function(fallback)
|
ls.jump(1)
|
||||||
|
else
|
||||||
|
cmp.select_next_item({ behavior = cmp.SelectBehavior.Select })
|
||||||
|
end
|
||||||
|
end),
|
||||||
|
["<C-k>"] = cmp.mapping(function()
|
||||||
|
if ls.in_snippet() then
|
||||||
|
ls.jump(-1)
|
||||||
|
else
|
||||||
|
cmp.select_prev_item({ behavior = cmp.SelectBehavior.Select })
|
||||||
|
end
|
||||||
|
end),
|
||||||
|
["<C-space>"] = cmp.mapping(function()
|
||||||
if cmp.visible() then
|
if cmp.visible() then
|
||||||
cmp.close()
|
cmp.close()
|
||||||
else
|
else
|
||||||
@@ -124,3 +136,5 @@ cmp.setup.filetype("gitcommit", {
|
|||||||
{ name = "buffer" },
|
{ name = "buffer" },
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
require("luasnip.loaders.from_vscode").lazy_load()
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ require("packer").startup(function(use)
|
|||||||
})
|
})
|
||||||
use({ "L3MON4D3/LuaSnip", {
|
use({ "L3MON4D3/LuaSnip", {
|
||||||
"saadparwaiz1/cmp_luasnip",
|
"saadparwaiz1/cmp_luasnip",
|
||||||
|
"rafamadriz/friendly-snippets",
|
||||||
} })
|
} })
|
||||||
|
|
||||||
use({ "neovim/nvim-lspconfig" })
|
use({ "neovim/nvim-lspconfig" })
|
||||||
|
|||||||
Reference in New Issue
Block a user