update for adding codecompanion
This commit is contained in:
63
lua/shelbybark/plugins/codecompanion.lua
Normal file
63
lua/shelbybark/plugins/codecompanion.lua
Normal file
@@ -0,0 +1,63 @@
|
||||
return {
|
||||
"olimorris/codecompanion.nvim",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
-- Optional: for enhanced diagnostics/context
|
||||
"georgeharker/mcp-diagnostics.nvim",
|
||||
},
|
||||
event = "VeryLazy", -- Lazy load the plugin
|
||||
config = function()
|
||||
require("codecompanion").setup({
|
||||
ignore_warnings = true,
|
||||
strategies = {
|
||||
chat = {
|
||||
adapter = "anthropic",
|
||||
},
|
||||
inline = {
|
||||
adapter = "anthropic",
|
||||
},
|
||||
},
|
||||
adapters = {
|
||||
http = {
|
||||
anthropic = function()
|
||||
return require("codecompanion.adapters").extend("anthropic", {
|
||||
env = {
|
||||
api_key = "ANTHROPIC_API_KEY",
|
||||
},
|
||||
schema = {
|
||||
model = {
|
||||
default = "claude-sonnet-4-20250514",
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
},
|
||||
-- Display settings for the chat window
|
||||
display = {
|
||||
chat = {
|
||||
window = {
|
||||
layout = "vertical", -- or "horizontal", "float"
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
-- Optional: Set up keymaps
|
||||
vim.api.nvim_set_keymap(
|
||||
"n",
|
||||
"<leader>cc",
|
||||
"<cmd>CodeCompanionChat Toggle<cr>",
|
||||
{ noremap = true, silent = true }
|
||||
)
|
||||
vim.api.nvim_set_keymap(
|
||||
"v",
|
||||
"<leader>cc",
|
||||
"<cmd>CodeCompanionChat Toggle<cr>",
|
||||
{ noremap = true, silent = true }
|
||||
)
|
||||
vim.api.nvim_set_keymap("n", "<leader>ca", "<cmd>CodeCompanionActions<cr>", { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap("v", "<leader>ca", "<cmd>CodeCompanionActions<cr>", { noremap = true, silent = true })
|
||||
end,
|
||||
}
|
||||
Reference in New Issue
Block a user