Merge branch 'codecompanion'
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
local M = {}
|
||||
|
||||
M.base46 = {
|
||||
theme = "github_dark",
|
||||
theme = "monekai",
|
||||
|
||||
-- hl_override = {
|
||||
-- Comment = { italic = true },
|
||||
|
||||
54
lua/configs/codecompanion.lua
Normal file
54
lua/configs/codecompanion.lua
Normal file
@@ -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",
|
||||
},
|
||||
}
|
||||
@@ -10,10 +10,6 @@ local diag = vim.diagnostic
|
||||
map("n", ";", ":", { desc = "CMD enter command mode" })
|
||||
map("i", "jk", "<ESC>")
|
||||
|
||||
-- map({ "n", "i", "v" }, "<C-s>", "<cmd> w <cr>")
|
||||
|
||||
map("n", "<leader>cp", "<cmd> Copilot panel<cr>", { desc = "Copilot panel" })
|
||||
|
||||
map("n", "<leader>ca", function()
|
||||
vim.lsp.buf.code_action()
|
||||
end, { desc = "LSP code action" })
|
||||
@@ -129,3 +125,17 @@ end, { desc = "Frames" })
|
||||
map("n", "<Leader>ds", function()
|
||||
widgets.centered_float(widgets.scopes)
|
||||
end, { desc = "Scopes" })
|
||||
|
||||
-- CodeCompletion mappings
|
||||
|
||||
map({ "n", "v" }, "<C-a>", "<cmd>CodeCompanionActions<cr>", { noremap = true, silent = true, desc = "Code Actions" })
|
||||
map({ "n", "v" }, "<Leader>a", "<cmd>CodeCompanionChat Toggle<cr>", { noremap = true, silent = true, desc = "Code Chat" })
|
||||
map("v", "ga", "<cmd>CodeCompanionChat Add<cr>", { noremap = true, silent = true, desc = "Code Chat Add Visual" })
|
||||
map("v", "<Leader>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]])
|
||||
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user