I have cmp setup as per the docs. All my completions works as specified in the sources. I have additional sources setup for '/' and '?' and so on as seen below. These additional sources are somehow overridden once I enable the default config for cmp-ai. As soon as I stop exporting cmp-ai config as shown below, they resume working.
Note: If I just have cmp-ai as a deps for nvim-cmp all things work, it fails once I set it up.
nvim-cmp config:
return {
{
"L3MON4D3/LuaSnip",
dependencies = {
"saadparwaiz1/cmp_luasnip",
"rafamadriz/friendly-snippets",
},
event = "VeryLazy",
},
{
"hrsh7th/nvim-cmp",
event = "VeryLazy",
dependencies = {
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline",
},
config = function()
-- Set up nvim-cmp.
local cmp = require("cmp")
local luasnip = require("luasnip")
-- Load user defined snippets
require("luasnip.loaders.from_vscode").load({ paths = { "~/.config/nvim/lua/config/snippets" } })
-- Load friendly snippets
-- require("luasnip.loaders.from_vscode").lazy_load()
cmp.setup({
snippet = {
-- REQUIRED - you must specify a snippet engine
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
mapping = cmp.mapping.preset.insert({
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-l>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Replace,
select = true,
}),
["<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" }),
}),
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "luasnip" },
}, {
{ name = "buffer" },
}),
})
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline({ "/", "?" }, {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = "buffer" },
},
})
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = "path" },
}, {
{ name = "cmdline" },
}),
matching = { disallow_symbol_nonprefix_matching = false },
})
end,
I have cmp setup as per the docs. All my completions works as specified in the sources. I have additional sources setup for '/' and '?' and so on as seen below. These additional sources are somehow overridden once I enable the default config for cmp-ai. As soon as I stop exporting cmp-ai config as shown below, they resume working.
Note: If I just have cmp-ai as a deps for nvim-cmp all things work, it fails once I set it up.
nvim-cmp config:
cmp_ai config:
nvim: v10.x os: mac os 14+