feat: add shortcuts to codecompanion
This commit is contained in:
@@ -1,12 +1,30 @@
|
||||
return {
|
||||
{
|
||||
"olimorris/codecompanion.nvim",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
"olimorris/codecompanion.nvim",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
},
|
||||
opts = {},
|
||||
keys = {
|
||||
{ "<leader>aa", "<cmd>CodeCompanionChat<cr>", mode = { "n", "v" }, desc = "Toggle Chat" },
|
||||
{
|
||||
"<leader>ap",
|
||||
function()
|
||||
local mode = vim.api.nvim_get_mode().mode
|
||||
vim.ui.input({ prompt = "AI Prompt: " }, function(input)
|
||||
if not input or input == "" then
|
||||
return
|
||||
end
|
||||
|
||||
if mode:match("[vV]") then
|
||||
vim.cmd("'<,'>CodeCompanion " .. input)
|
||||
else
|
||||
vim.cmd("CodeCompanion #{buffer} " .. input)
|
||||
end
|
||||
end)
|
||||
end,
|
||||
mode = { "n", "v" },
|
||||
desc = "AI Prompt",
|
||||
},
|
||||
config = function()
|
||||
require("codecompanion").setup({})
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user