Added initial nvim config
This commit is contained in:
parent
406d73f803
commit
d31faf2dbf
14 changed files with 577 additions and 0 deletions
33
.config/nvim/plugin/cmp.lua
Normal file
33
.config/nvim/plugin/cmp.lua
Normal 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' },
|
||||
})
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue