Files
dotfiles/nvim/lua/plugins/nvim-cmp.lua
FaultyBranches dd63dfd57e fix: Removing several bits that were superfluous or were causing issues.
Disabling nvim-lint and calls to cfn-lint for now. Found and removed the issue with
completion causing odd failures on expansion.
2026-04-07 08:03:21 -05:00

71 lines
2.2 KiB
Lua

return {
'hrsh7th/nvim-cmp',
config = function()
local cmp = require('cmp')
cmp.setup {
completion = {
completeopt = 'menu,menuone,noinsert',
},
experimental = {
ghost_text = true,
},
mapping = {
['<C-n>'] = cmp.mapping.select_next_item(),
['<C-p>'] = cmp.mapping.select_prev_item(),
['<C-j>'] = cmp.mapping.scroll_docs(-4),
['<C-k>'] = cmp.mapping.scroll_docs(4),
['<C-space>'] = cmp.mapping.complete(),
['<C-y>'] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Insert,
select = true,
}),
},
formatting = {
format = function(entry, vim_item)
vim_item.menu = ({
buffer = '[Buf]',
luasnip = '[Snips]',
nvim_lsp = '[LSP]',
nvim_lua = '[Lua]',
})[entry.source.name]
return vim_item
end,
field = { 'abbr', 'kind', 'menu' }
},
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
{ name = 'path' },
{ name = 'render-markdown' },
}, {
{ name = 'buffer' },
})
}
cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = 'path' },
}, {
{ name = 'cmdline' },
})
})
cmp.setup.cmdline({ '/', '?' }, {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = 'buffer' }
}
})
end,
dependencies = {
{ 'hrsh7th/cmp-nvim-lsp', lazy = false },
{ 'hrsh7th/cmp-buffer', lazy = false },
{ 'hrsh7th/cmp-path', lazy = false },
{ 'hrsh7th/cmp-cmdline', lazy = false },
{ 'L3MON4D3/LuaSnip', lazy = false },
},
event = 'InsertEnter',
lazy = false,
}