Open teto opened 10 months ago
Do you have any examples of plugins that do it "the right way"?
Also, is this linked to #61?
Historically, plugins expose their mappings via <Plug>Name
.
In lua that would give:
vim.keymap.set("n", "<Plug>HelloWorld", function() print("Hello World!") end)
vim.keymap.set("n", "gs", "<Plug>HelloWorld")
in the readme, you could remove the mappings from the setup() but still document them in the snippet:
require("lazy").setup({
{
'huggingface/llm.nvim',
config = function() require'llm'.setup {
-- cf Setup
opts
}
vim.keymap.set("n", "gs", "<Plug>LlmAcceptSuggestion")
end
},
})
but with lua I am not sure you need to go through the Plug route anyway, you could straightaway document:
vim.keymap.set("n", "gs", function () require'llm'.accept_suggestion() end)
+1
My specific use case is to provide more context to the prompt in order to get more accurate results.
as I started my neovim, I got surprised that my
<tab>
key was doing non-sense. As I had just installed llm.nvim the culprit was evident (plus:verb map <tab>
). Tab is an important key so I dont think the plugin should hijack it like this. I would prefer for the plugins to expose its callbacks and let me map them. The mapping could be kept in the README out of thesetup
function. The setup function meme can be quite annoying when you compose your setup https://mrcjkb.dev/posts/2023-08-22-setup.html