feat: Add plugin olimorris/codecompanion.nvim
This commit is contained in:
62
lua/plugins/codecompanion.lua
Normal file
62
lua/plugins/codecompanion.lua
Normal file
@ -0,0 +1,62 @@
|
||||
local prefix = "<Leader>A"
|
||||
|
||||
---@type LazySpec
|
||||
return {
|
||||
{
|
||||
"olimorris/codecompanion.nvim",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
{
|
||||
"AstroNvim/astrocore",
|
||||
---@param opts AstroCoreOpts
|
||||
opts = function(_, opts)
|
||||
if not opts.mappings then opts.mappings = {} end
|
||||
|
||||
opts.mappings.n[prefix] = { desc = require("astroui").get_icon("CodeCompanion", 1, true) .. "CodeCompanion" }
|
||||
opts.mappings.v[prefix] = { desc = require("astroui").get_icon("CodeCompanion", 1, true) .. "CodeCompanion" }
|
||||
|
||||
opts.mappings.n[prefix .. "c"] = { "<cmd>CodeCompanionChat Toggle<cr>", desc = "Toggle chat" }
|
||||
opts.mappings.v[prefix .. "c"] = { "<cmd>CodeCompanionChat Toggle<cr>", desc = "Toggle chat" }
|
||||
|
||||
opts.mappings.n[prefix .. "p"] = { "<cmd>CodeCompanionActions<cr>", desc = "Open action palette" }
|
||||
opts.mappings.v[prefix .. "p"] = { "<cmd>CodeCompanionActions<cr>", desc = "Open action palette" }
|
||||
|
||||
opts.mappings.n[prefix .. "q"] = { "<cmd>CodeCompanion<cr>", desc = "Open inline assistant" }
|
||||
opts.mappings.v[prefix .. "q"] = { "<cmd>CodeCompanion<cr>", desc = "Open inline assistant" }
|
||||
|
||||
opts.mappings.v[prefix .. "a"] = { "<cmd>CodeCompanionChat Add<cr>", desc = "Add selection to chat" }
|
||||
|
||||
-- Expand cc to CodeCompanion in cmdline mode
|
||||
vim.cmd [[cab cc CodeCompanion]]
|
||||
end,
|
||||
},
|
||||
{ "AstroNvim/astroui", opts = { icons = { CodeCompanion = "" } } },
|
||||
},
|
||||
event = "User AstroFile",
|
||||
cmd = {
|
||||
"CodeCompanion",
|
||||
"CodeCompanionActions",
|
||||
"CodeCompanionChat",
|
||||
"CodeCompanionCmd",
|
||||
},
|
||||
opts = {
|
||||
strategies = {
|
||||
chat = {
|
||||
adapter = "mistral",
|
||||
},
|
||||
inline = {
|
||||
adapter = "mistral",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"MeanderingProgrammer/render-markdown.nvim",
|
||||
optional = true,
|
||||
opts = function(_, opts)
|
||||
if not opts.file_types then opts.file_types = { "markdown" } end
|
||||
opts.file_types = require("astrocore").list_insert_unique(opts.file_types, { "codecompanion" })
|
||||
end,
|
||||
},
|
||||
}
|
Reference in New Issue
Block a user