feat: add shortcuts to codecompanion

This commit is contained in:
Job
2026-03-21 16:12:26 +01:00
parent d3a7651606
commit b1b6351bd8
4 changed files with 38 additions and 15 deletions

View File

@@ -5,8 +5,28 @@ return {
"nvim-lua/plenary.nvim",
"nvim-treesitter/nvim-treesitter",
},
config = function()
require("codecompanion").setup({})
end,
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",
},
},
},
}

View File

@@ -21,6 +21,5 @@ return {
{ "folke/todo-comments.nvim", enabled = false },
{ "folke/ts-comments.nvim", enabled = false },
{ "folke/trouble.nvim", enabled = false },
{ "MagicDuck/grug-far.nvim", enabled = false },
}