Files
dotfiles/nvim/lua/plugins/nvim-cmp.lua
FaultyBranches 7b64bb09ac fix: Several small updates.
- Removing the load_lauunchjs call for dap as it's no longer needed.
- Cleanup of lspconfig of several lines that appear to not do anything
  in testing, and updating keymap order.
- Removing the luasnip setup section as it appears to not be required in
  testing.
- Update to nvim-cmp for luasnip relative loading and removing the
  buffer from command mode completion
- Twilight update to narrow the focus but also expand out if statements.
- ZSH re-enabling keychain despite it being slow as replacement with
  gpg-agent will take a focused session to do across environments
2026-04-02 06:29:20 -05:00

92 lines
2.6 KiB
Lua

return {
'hrsh7th/nvim-cmp',
config = function()
local cmp = require('cmp')
cmp.setup {
snippet = {
expand = function(args)
require('plugins.luasnip').lsp_expand(args.body)
end,
},
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 = 'buffer' },
}, {
{ 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,
}