diff --git a/lua/chadrc.lua b/lua/chadrc.lua index 3289326..8959fa8 100644 --- a/lua/chadrc.lua +++ b/lua/chadrc.lua @@ -6,7 +6,7 @@ local M = {} M.base46 = { - theme = "github_dark", + theme = "monekai", -- hl_override = { -- Comment = { italic = true }, diff --git a/lua/configs/codecompanion.lua b/lua/configs/codecompanion.lua new file mode 100644 index 0000000..1ff85c2 --- /dev/null +++ b/lua/configs/codecompanion.lua @@ -0,0 +1,54 @@ +local cc = require "codecompanion" +cc.setup { + adapters = { + llama3 = function() + return require("codecompanion.adapters").extend("ollama", { + name = "llama3", + schema = { + model = { + default = "llama3.1:latest", + }, + }, + }) + end, + mistral = function() + return require("codecompanion.adapters").extend("ollama", { + name = "mistral", + schema = { + model = { + default = "mistral:latest", + }, + }, + }) + end, + qwen = function() + return require("codecompanion.adapters").extend("ollama", { + name = "qwen", + schema = { + model = { + default = "qwen2.5-coder", + }, + }, + }) + end, + }, + strategies = { + chat = { + adapter = "copilot", + }, + inline = { + adapter = "copilot", + }, + }, + display = { + -- diff = { + -- provider = "mini_diff", + -- }, + action_palette = { + provider = "mini_pick", + }, + }, + opts = { + log_level = "DEBUG", + }, +} diff --git a/lua/mappings.lua b/lua/mappings.lua index 9f5abe1..7509390 100644 --- a/lua/mappings.lua +++ b/lua/mappings.lua @@ -10,10 +10,6 @@ local diag = vim.diagnostic map("n", ";", ":", { desc = "CMD enter command mode" }) map("i", "jk", "") --- map({ "n", "i", "v" }, "", " w ") - -map("n", "cp", " Copilot panel", { desc = "Copilot panel" }) - map("n", "ca", function() vim.lsp.buf.code_action() end, { desc = "LSP code action" }) @@ -129,3 +125,17 @@ end, { desc = "Frames" }) map("n", "ds", function() widgets.centered_float(widgets.scopes) end, { desc = "Scopes" }) + +-- CodeCompletion mappings + +map({ "n", "v" }, "", "CodeCompanionActions", { noremap = true, silent = true, desc = "Code Actions" }) +map({ "n", "v" }, "a", "CodeCompanionChat Toggle", { noremap = true, silent = true, desc = "Code Chat" }) +map("v", "ga", "CodeCompanionChat Add", { noremap = true, silent = true, desc = "Code Chat Add Visual" }) +map("v", "ce", function() + require("codecompanion").prompt("explain") +end, { noremap = true, silent = true, desc = "Explain Selection" } +) + +-- Expand 'cc' into 'CodeCompanion' in the command line +vim.cmd([[cab cc CodeCompanion]]) + diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 1d26315..524679e 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -113,19 +113,14 @@ return { }, { - { - "folke/persistence.nvim", - event = "BufReadPre", -- this will only start session saving when an actual file was opened - opts = { - -- add any custom options here - }, - }, + "folke/persistence.nvim", + event = "BufReadPre", -- this will only start session saving when an actual file was opened }, { "NvChad/nvcommunity", { import = "nvcommunity.git.diffview" }, - { import = "nvcommunity.git.lazygit" }, + -- { import = "nvcommunity.git.lazygit" }, { import = "nvcommunity.completion.copilot" }, { "copilot.lua", @@ -195,6 +190,27 @@ return { lazy = false, }, + { + "echasnovski/mini.nvim", + version = "*", + config = function() + require("mini.diff").setup() + require("mini.pick").setup() + end, + }, + + { + "olimorris/codecompanion.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-treesitter/nvim-treesitter", + }, + config = function() + require "configs.codecompanion" + end, + lazy = false, + }, + -- Install a plugin { "max397574/better-escape.nvim",