add cmp-ai

This commit is contained in:
Charlotte 🦝 Delenk 2024-07-16 07:26:57 +02:00
parent 3745d69205
commit 59d23bdca8
3 changed files with 40 additions and 0 deletions

View file

@ -0,0 +1,19 @@
local cmp_ai = require('cmp_ai.config')
cmp_ai:setup({
max_lines = 100,
provider = 'Ollama',
provider_options = {
model = 'codellama:13b-code-q6_K',
},
notify = true,
notify_callback = function(msg)
vim.notify(msg)
end,
run_on_every_keystroke = true,
ignored_file_types = {
-- default is not to ignore
-- uncomment to ignore in lua:
-- lua = true
},
})

View file

@ -23,6 +23,16 @@ cmp.setup {
["<Esc>"] = cmp.mapping.close(), ["<Esc>"] = cmp.mapping.close(),
["<C-d>"] = cmp.mapping.scroll_docs(-4), ["<C-d>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4), ["<C-f>"] = cmp.mapping.scroll_docs(4),
['<C-x>'] = cmp.mapping(
cmp.mapping.complete({
config = {
sources = cmp.config.sources({
{ name = 'cmp_ai' },
}),
},
}),
{ 'i' }
),
}, },
sources = { sources = {
{ name = "nvim_lsp" }, -- For nvim-lsp { name = "nvim_lsp" }, -- For nvim-lsp

View file

@ -18,6 +18,7 @@
asyncrun-vim asyncrun-vim
bufferline-nvim bufferline-nvim
catppuccin-nvim catppuccin-nvim
cmp-ai
cmp-buffer cmp-buffer
cmp-emoji cmp-emoji
cmp-nvim-lsp cmp-nvim-lsp
@ -103,11 +104,20 @@
"hrsh7th/cmp-buffer", "hrsh7th/cmp-buffer",
"hrsh7th/cmp-omni", "hrsh7th/cmp-omni",
"hrsh7th/cmp-emoji", "hrsh7th/cmp-emoji",
"tzachar/cmp-ai"
}, },
config = function() config = function()
require("config.nvim-cmp") require("config.nvim-cmp")
end, end,
}, },
{
"tzachar/cmp-ai",
event = "VeryLazy",
dependencies = {'nvim-lua/plenary.nvim'},
config = function()
require("config.cmp-ai")
end,
},
{ {
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
event = { "BufRead", "BufNewFile" }, event = { "BufRead", "BufNewFile" },
@ -435,6 +445,7 @@
"stevearc", "stevearc",
"tpope", "tpope",
"tyru", "tyru",
"tzachar",
"wellle", "wellle",
"Yggdroot", "Yggdroot",
}, },