A Neovim plugin for generating functions doc comments using OpenAI's GPT API.
To install doc-gen.nvim
using LazyVim, add the following to your LazyVim plugin configuration:
return {
{
"rmerli/doc-gen.nvim",
config = function()
require("doc-gen").setup({
get_key_cmd = "cmd_to_get_api_key", -- cmd needs to return only the api-key
})
end,
},
}
- nvim-treesitter
- An OpenAI API key
Run the command to generate a doc block:
:GenFunDoc
This will analyze the function under the cursor and insert the generated Doc block above it.
You can customize the plugin in your Neovim configuration:
require("doc-gen").setup({
get_key_cmd = "cmd_to_get_api_key", -- cmd needs to return only the api-key
model = "gpt-4o-mini", --default
})
You can add keymap like this:
vim.keymap.set('n', '<leader>gd', ':GenFunDoc<CR>', {})
MIT License