neovim: setup snippets & remove friendly snippets plugin

This commit is contained in:
2026-03-14 13:08:21 +03:00
parent 80d66d9b56
commit c7863f029a
5 changed files with 50 additions and 24 deletions

View File

@@ -13,20 +13,20 @@ cmp.setup({
["<CR>"] = cmp.mapping(function(fallback)
fallback()
end),
["<C-u>"] = cmp.mapping(function(fallback)
["<C-n>"] = cmp.mapping(function(fallback)
if ls.jumpable(1) then
ls.jump(1)
else
fallback()
end
end),
["<C-i>"] = cmp.mapping(function(fallback)
end, { "i", "s" }),
["<C-p>"] = cmp.mapping(function(fallback)
if ls.jumpable(-1) then
ls.jump(-1)
else
fallback()
end
end),
end, { "i", "s" }),
["<C-j>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item({ behavior = cmp.SelectBehavior.Select })
@@ -58,20 +58,20 @@ cmp.setup({
fallback()
end
end),
["<C-n>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.mapping.scroll_docs(4)
else
fallback()
end
end),
["<C-m>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.mapping.scroll_docs(-4)
else
fallback()
end
end),
-- ["<C-n>"] = cmp.mapping(function(fallback)
-- if cmp.visible() then
-- cmp.mapping.scroll_docs(4)
-- else
-- fallback()
-- end
-- end),
-- ["<C-m>"] = cmp.mapping(function(fallback)
-- if cmp.visible() then
-- cmp.mapping.scroll_docs(-4)
-- else
-- fallback()
-- end
-- end),
["<C-f>"] = cmp.mapping(function(fallback)
if ls.expand_or_jumpable() then
ls.expand_or_jump()
@@ -123,4 +123,5 @@ cmp.setup.filetype("gitcommit", {
}),
})
require("luasnip.loaders.from_vscode").lazy_load()
require("luasnip").setup({ enable_autosnippets = true })
require("luasnip.loaders.from_lua").load({ paths = vim.fn.stdpath("config") .. "/snippets" })

View File

@@ -33,7 +33,6 @@ pack.add({
src = "L3MON4D3/LuaSnip",
deps = {
"saadparwaiz1/cmp_luasnip",
"rafamadriz/friendly-snippets",
},
})

View File

@@ -36,10 +36,6 @@
"rev": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90",
"src": "https://github.com/saadparwaiz1/cmp_luasnip"
},
"friendly-snippets": {
"rev": "6cd7280adead7f586db6fccbd15d2cac7e2188b9",
"src": "https://github.com/rafamadriz/friendly-snippets"
},
"gitsigns.nvim": {
"rev": "7c4faa3540d0781a28588cafbd4dd187a28ac6e3",
"src": "https://github.com/lewis6991/gitsigns.nvim"

View File

@@ -0,0 +1,15 @@
---@diagnostic disable:undefined-global
return {
s(
{ trig = "iferr", snippetType = "autosnippet" },
fmta(
[[
if err != nil {
return <>
}
]],
{ i(0) }
)
),
}

View File

@@ -0,0 +1,15 @@
---@diagnostic disable:undefined-global
return {
s(
{ trig = "if" },
fmta(
[[
if <> then
<>
fi
]],
{ i(1), i(2) }
)
),
}