Updated Neovim config to lua, cleaned up unneccecary plugins

This commit is contained in:
2025-10-04 23:47:12 +02:00
parent d453460c01
commit 9308fa14a5
12 changed files with 328 additions and 191 deletions
+74
View File
@@ -0,0 +1,74 @@
-- Completion setup for Neovim using nvim-cmp and LuaSnip
-- Safely import modules
local cmp_status, cmp = pcall(require, "cmp")
if not cmp_status then
return
end
local snip_status, luasnip = pcall(require, "luasnip")
if not snip_status then
return
end
-- Load friendly-snippets (optional, prebuilt snippets)
require("luasnip.loaders.from_vscode").lazy_load()
-- Setup nvim-cmp
cmp.setup({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
["<C-Space>"] = cmp.mapping.complete(), -- Trigger completion menu
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Confirm selection
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
}),
sources = cmp.config.sources({
{ name = "nvim_lsp" }, -- LSP completion
{ name = "luasnip" }, -- Snippets
}, {
{ name = "buffer" }, -- Words in current buffer
{ name = "path" }, -- File system paths
}),
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
formatting = {
format = function(entry, vim_item)
vim_item.menu = ({
nvim_lsp = "[LSP]",
luasnip = "[Snip]",
buffer = "[Buf]",
path = "[Path]",
})[entry.source.name]
return vim_item
end,
},
})