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