Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Working cmp-ai configuration for NVChad? #20

Open
awonglk opened this issue Jun 6, 2024 · 1 comment
Open

Working cmp-ai configuration for NVChad? #20

awonglk opened this issue Jun 6, 2024 · 1 comment

Comments

@awonglk
Copy link

awonglk commented Jun 6, 2024

Not an issue as such. Does anyone have a working configuration sample for cmp-ai plugin working with NVChad? I haven't been able to get this working, and would appreciate any "best practices".

I believe I need to:

  1. Install and setup plugins in /lua/plugins/init.lua:
    {'tzachar/cmp-ai', dependencies = 'nvim-lua/plenary.nvim'},

    This one-liner seems to work fine

  2. A step to configure cmp-ai to use a specific external AI source (e.g. Codestral) in /lua/configs/cmp-ai.lua?

  3. A step that involves nvm-cmp sources override? I assume also a file in /lua/configs/nvim-cmp.lua

Much appreciated!

@milanglacier
Copy link

milanglacier commented Jun 30, 2024

I don't use nvchad, but I believe nvchad uses lazy.nvim and you need to utilize lazy's feature to merge options to set up cmp.

Not tested, but should be something like this:

That is, you fetch the option tables configured by nvchad previously, and then add cmp_ai to it.

{"hrsh7th/nvim-cmp", opts = function(_, opts)
        table.insert(opts.sources, 1, "cmp_ai")
       -- you need to take a look at the nvchad's original configuration of nvim-cmp to
       -- ensure you are using the correct location to insert "cmp_ai"
    end,
    dependencies = { 
        { 'tzachar/cmp-ai', config = "your configuration here"}
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants