Closed olimorris closed 2 months ago
Another question: is it outside the scope to disable the default prompts that are bundled with the plugin and just use your own? As it is now, you can either add your own and extend the default prompts (with use_default_prompts=true
) and get keymappings and /command; or only use the prompts through CodeCompanionActions
.
So you should be able to set use_default_prompts = false
and add your own default_prompts in your config.
This won't stop the slash cmds from being added (that's a bug I've just spotted), but it stops the default prompts from being added as we tag them with default_prompt = true
in the config and never add them when we setup the action palette.
To avoid keybindings to be added if use_default_prompts = false
, something like this should go into prompt.lua
:
---@return CodeCompanion.Prompts
function Prompts:setup()
--Loop through the prompts
local global_config = require("codecompanion").config
for _, config in pairs(self.prompts) do
if config.opts and config.opts.mapping then
if not global_config.opts.use_default_prompts and config.opts.default_prompt then
goto continue
end
if config.opts.modes and type(config.opts.modes) == "table" then
for _, mode in ipairs(config.opts.modes) do
map(config, mode)
end
else
map(config, "n")
end
end
::continue::
end
Good spot. This has highlighted what a mess this default prompts and actions is currently
@isaksamsten also fancy Pr'ing this?
Discussed in https://github.com/olimorris/codecompanion.nvim/discussions/104