Added initial nvim config

This commit is contained in:
pfych 2024-08-16 21:55:29 +10:00
parent 406d73f803
commit d31faf2dbf
14 changed files with 577 additions and 0 deletions

View file

@ -0,0 +1,33 @@
local cmp = require'cmp'
local cmpStatus, cmp = pcall(require, "cmp")
if (not cmpStatus) then
print("cmp is not installed")
return
end
cmp.setup({
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
local entry = cmp.get_selected_entry()
if not entry then
cmp.select_next_item({ behavior = cmp.SelectBehavior.Select })
else
cmp.confirm()
end
else
fallback()
end
end, {"i","s","c",}),
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'buffer' },
})
})