From 51c9c6983a3525fb53a29289e159752c72ebe9d5 Mon Sep 17 00:00:00 2001 From: Pierre-Marie Charavel Date: Sun, 10 Aug 2025 13:44:57 -0400 Subject: [PATCH] [nvim] Add git and cmp_ai --- .config/nvim/lua/plugins/git.lua | 8 +++ .config/nvim/lua/plugins/nvim-cmp.lua | 86 +++++++++++++++++---------- 2 files changed, 63 insertions(+), 31 deletions(-) create mode 100644 .config/nvim/lua/plugins/git.lua diff --git a/.config/nvim/lua/plugins/git.lua b/.config/nvim/lua/plugins/git.lua new file mode 100644 index 0000000..04ca4cb --- /dev/null +++ b/.config/nvim/lua/plugins/git.lua @@ -0,0 +1,8 @@ +return { + { + "tpope/vim-fugitive" + }, + { + "lewis6991/gitsigns.nvim" + }, +} diff --git a/.config/nvim/lua/plugins/nvim-cmp.lua b/.config/nvim/lua/plugins/nvim-cmp.lua index 0a2354f..952f3b3 100644 --- a/.config/nvim/lua/plugins/nvim-cmp.lua +++ b/.config/nvim/lua/plugins/nvim-cmp.lua @@ -1,34 +1,58 @@ return { - "hrsh7th/nvim-cmp", - dependencies = { - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-buffer", - "hrsh7th/cmp-path", - "hrsh7th/cmp-cmdline", + { + "tzachar/cmp-ai", + dependencies = { "nvim-lua/plenary.nvim" }, + config = function() + local cmp_ai = require("cmp_ai.config") + cmp_ai:setup({ + max_lines = 100, + provider = "Ollama", + provider_options = { + model = "codestral:latest", + auto_unload = false, + }, + notify = true, + notify_callback = function(msg) + vim.notify(msg) + end, + run_on_every_keystroke = true, + }) + end + }, + { + "hrsh7th/nvim-cmp", + dependencies = { + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "hrsh7th/cmp-cmdline", + "tzachar/cmp-ai", + }, + config = function() + local cmp = require("cmp") + cmp.setup({ + snippet = { + expand = function(args) + vim.snippet.expand(args.body) + end + }, + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered() + }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.abort(), + [""] = cmp.mapping.confirm({ select = true }), + }), + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "cmp_ai" }, + }, + {{ name = "buffer"}}) + }) + end }, - config = function() - local cmp = require("cmp") - cmp.setup({ - snippet = { - expand = function(args) - vim.snippet.expand(args.body) - end - }, - window = { - completion = cmp.config.window.bordered(), - documentation = cmp.config.window.bordered() - }, - mapping = cmp.mapping.preset.insert({ - [""] = cmp.mapping.scroll_docs(-4), - [""] = cmp.mapping.scroll_docs(4), - [""] = cmp.mapping.complete(), - [""] = cmp.mapping.abort(), - [""] = cmp.mapping.confirm({ select = true }), - }), - sources = cmp.config.sources({ - { name = "nvim_lsp" }, - }, - {{ name = "buffer"}}) - }) - end }