home: vim: completion: use 'vim.snippet'
All checks were successful
ci/woodpecker/push/check Pipeline was successful

I don't use any of the advanced features from `LuaSnip` anyway, might as
well rely on the built-in one instead and shave some dependencies.
This commit is contained in:
Bruno BELANYI 2025-04-04 15:25:29 +00:00
parent d48d5c45e0
commit f7dd3bbd04
2 changed files with 5 additions and 9 deletions

View file

@ -65,14 +65,12 @@ in
plenary-nvim # 'null-ls', 'telescope' dependency plenary-nvim # 'null-ls', 'telescope' dependency
# Completion # Completion
luasnip # Snippet manager compatible with LSP
nvim-cmp # Completion engine nvim-cmp # Completion engine
cmp-async-path # More responsive path completion cmp-async-path # More responsive path completion
cmp-buffer # Words from open buffers cmp-buffer # Words from open buffers
cmp-nvim-lsp # LSP suggestions cmp-nvim-lsp # LSP suggestions
cmp-nvim-lua # NeoVim lua API cmp-nvim-lua # NeoVim lua API
cmp-under-comparator # Sort items that start with '_' lower cmp-under-comparator # Sort items that start with '_' lower
cmp_luasnip # Snippet suggestions from LuaSnip
# UX improvements # UX improvements
dressing-nvim # Integrate native UI hooks with Telescope etc... dressing-nvim # Integrate native UI hooks with Telescope etc...

View file

@ -3,25 +3,24 @@ vim.opt.completeopt = { "menu", "menuone", "noselect" }
local cmp = require("cmp") local cmp = require("cmp")
local cmp_under_comparator = require("cmp-under-comparator") local cmp_under_comparator = require("cmp-under-comparator")
local luasnip = require("luasnip")
cmp.setup({ cmp.setup({
snippet = { snippet = {
expand = function(args) expand = function(args)
luasnip.lsp_expand(args.body) vim.snippet.expand(args.body)
end, end,
}, },
mapping = { mapping = {
["<Tab>"] = function(fallback) ["<Tab>"] = function(fallback)
if luasnip.expand_or_jumpable() then if vim.snippet.active({ direction = 1 }) then
luasnip.expand_or_jump() vim.snippet.jump(1)
else else
fallback() fallback()
end end
end, end,
["<S-Tab>"] = function(fallback) ["<S-Tab>"] = function(fallback)
if luasnip.jumpable(-1) then if vim.snippet.active({ direction = -1 }) then
luasnip.jump(-1) vim.snippet.jump(-1)
else else
fallback() fallback()
end end
@ -40,7 +39,6 @@ cmp.setup({
{ name = "async_path", priority_weight = 110 }, { name = "async_path", priority_weight = 110 },
{ name = "nvim_lsp", priority_weight = 100 }, { name = "nvim_lsp", priority_weight = 100 },
{ name = "nvim_lua", priority_weight = 90 }, { name = "nvim_lua", priority_weight = 90 },
{ name = "luasnip", priority_weight = 80 },
{ name = "buffer", max_item_count = 5, priority_weight = 50 }, { name = "buffer", max_item_count = 5, priority_weight = 50 },
}, },
sorting = { sorting = {