Closed gerazov closed 7 months ago
Hi!
This is actually already possible in the current version. You can either pass the prompt's name (including underscores, as of now) to the :Ollama
user command, or directly to the M.prompt()
method, as the first argument in both cases. Both work the same and the user command is simply a wrapper for the Lua method.
Perhaps the README should be updated to better describe this capability.
In the meantime, here are a couple examples for a Lazy keys
spec, though you could translate it to nvim api calls:
{
"<leader>oM",
":Ollama Modify_Code<cr>",
desc = "Modify Code",
mode = { "n", "v" },
},
{
"<leader>oG",
":lua require('ollama').prompt('Generate_Code')<cr>",
desc = "Generate Code",
},
Note: You might need to add <c-u>
to your keybind's rhs if you have issues with selection ranges being detected improperly, as stated in the readme.
e.g :<c-u>Ollama Your_Prompt<cr>
Ok great - thanks :pray:
It would streamline the process if it's possible to map a specific prompt directly instead of having to go through the menu. It is a feature in
gen.nvim
Specifically, it could be used to do a chat within a
md
buffer via the following prompt: