A Neovim plugin for effortless inline documentation using Multiple Language Model Providers
docscribe.nvim automatically generates professional documentation for your functions. Simply place your cursor inside any function and run :DocscribeGenerate to create language-appropriate docstrings that follow industry standards.
| Language | Support Level | Documentation Style |
|---|---|---|
| JavaScript | ✅ Full | JSDoc |
| TypeScript | ✅ Full | JSDoc with types |
| C | ✅ Full | Doxygen |
| Java | 🟡 Limited | Javadoc |
| C++ | 🟡 Limited | Doxygen |
| Python | 🟡 Limited | Google style |
| Lua | 🟡 Limited | LuaDoc |
Choose the provider that best fits your needs:
| Provider | Type | Best For |
|---|---|---|
| 🦙 Ollama | Local | Privacy & Offline Development |
| 🧠 Google Gemini | Cloud API | Powerful Language Models |
| ⚡ Groq | Cloud API | Ultra-Fast Response Times |
- Function Detection: Uses Tree-sitter to automatically find functions at cursor
- Docstring Replacement: Intelligently updates existing documentation
- Visual Feedback: Shows progress with spinner notifications and highlighting
- Error Handling: Clear error messages with actionable feedback
- nvim-treesitter - For function detection
- plenary.nvim - For async operations
Lazy.nvim:
{
'AdrianMosnegutu/docscribe.nvim',
dependencies = {
'nvim-treesitter/nvim-treesitter',
'nvim-lua/plenary.nvim',
},
config = function()
require('docscribe').setup()
end
}Packer.nvim:
use {
'AdrianMosnegutu/docscribe.nvim',
requires = {
'nvim-treesitter/nvim-treesitter',
'nvim-lua/plenary.nvim',
}
}require('docscribe').setup({
ui = {
highlight = {
style = "signature", -- "signature" | "full" | "none"
timeout = 2000, -- Highlight duration (ms)
bg = "#545454", -- Highlight color
},
},
llm = {
provider = "ollama", -- "ollama" | "google" | "groq"
provider_opts = {
ollama = {
model = "llama3.2",
},
google = {
model = "gemini-1.5-flash",
api_key = os.getenv("GOOGLE_API_KEY"),
},
groq = {
model = "llama-3.1-8b-instant",
api_key = os.getenv("GROQ_API_KEY"),
},
},
},
})llm = {
provider = "ollama",
provider_opts = {
ollama = {
model = "llama3.2", -- Any installed Ollama model
},
},
}Setup Steps:
- Install Ollama: ollama.ai
- Pull a model:
ollama pull llama3.2 - No API key required
llm = {
provider = "google",
provider_opts = {
google = {
model = "gemini-1.5-flash",
api_key = os.getenv("GOOGLE_API_KEY"),
},
},
}Setup Steps:
- Get API key from Google AI Studio
- Set environment variable
GOOGLE_API_KEYor replaceos.getenv("GOOGLE_API_KEY")with your key
llm = {
provider = "groq",
provider_opts = {
groq = {
model = "llama-3.1-8b-instant",
api_key = os.getenv("GROQ_API_KEY"),
},
},
}Setup Steps:
- Get API key from console.groq.com
- Set environment variable
GROQ_API_KEYor replaceos.getenv("GROQ_API_KEY")with your key
- Position your cursor inside any function
- Run the command:
:DocscribeGenerate - Watch documentation appear with proper formatting
JavaScript:
/**
* Calculates the total price including tax.
* @param {number} price - The base price of the item
* @param {number} taxRate - The tax rate as a decimal
* @returns {number} The total price including tax
*/
function calculateTotal(price, taxRate) {
return price * (1 + taxRate);
}C:
/**
* Finds the maximum value in an array.
* @param arr The array to search
* @param size The size of the array
* @return The maximum value found
*/
int find_max(int arr[], int size) {
// implementation
}Override default templates for specific languages:
require('docscribe').setup({
prompt_templates = {
python = [[
Generate a concise Python docstring in Google style.
Focus on Args and Returns sections.
{{code}}
]],
},
})Contributions are welcome! Please feel free to submit pull requests, report bugs, or suggest features.
git clone https://github.com/AdrianMosnegutu/docscribe.nvim.git
cd docscribe.nvim
# Run tests
nvim --headless -c "PlenaryBustedDirectory tests" -c "qa!"This project is licensed under the MIT License - see the LICENSE file for details.
Made with ❤️ for the Neovim community
