David-Kunz/gen.nvim
David-Kunz/gen.nvim has 1,527 GitHub stars and 121 forks. GitHot measured 0 stars in 24 hours and +2 in 7 days. Last checked 2026-11-09 03:37 UTC. Last push 2025-05-03.
Neovim plugin to generate text using LLMs with customizable prompts
Measured star growth
- in 24h
- 0
- in 7 days
- +2
- in 15 days
- Collecting history
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.md
Originalgen.nvim
Generate text using LLMs with customizable prompts
Video
Requires
Install
Install with your favorite plugin manager, e.g. lazy.nvim
Example with Lazy
-- Minimal configuration
{ "David-Kunz/gen.nvim" },
-- Custom Parameters (with defaults)
{
"David-Kunz/gen.nvim",
opts = {
model = "mistral", -- The default model to use.
quit_map = "q", -- set keymap to close the response window
retry_map = "<c-r>", -- set keymap to re-send the current prompt
accept_map = "<c-cr>", -- set keymap to replace the previous selection with the last result
host = "localhost", -- The host running the Ollama service.
port = "11434", -- The port on which the Ollama service is listening.
display_mode = "float", -- The display mode. Can be "float" or "split" or "horizontal-split" or "vertical-split".
show_prompt = false, -- Shows the prompt submitted to Ollama. Can be true (3 lines) or "full".
show_model = false, -- Displays which model you are using at the beginning of your chat session.
no_auto_close = false, -- Never closes the window automatically.
file = false, -- Write the payload to a temporary file to keep the command short.
hidden = false, -- Hide the generation window (if true, will implicitly set `prompt.replace = true`), requires Neovim >= 0.10
init = function(options) pcall(io.popen, "ollama serve > /dev/null 2>&1 &") end,
-- Function to initialize Ollama
command = function(options)
local body = {model = options.model, stream = true}
return "curl --silent --no-buffer -X POST http://" .. options.host .. ":" .. options.port .. "/api/chat -d $body"
end,
-- The command for the Ollama service. You can use placeholders $prompt, $model and $body (shellescaped).
-- This can also be a command string.
-- The executed command must return a JSON object with { response, context }
-- (context property is optional).
-- list_models = '<omitted lua function>', -- Retrieves a list of model names
result_filetype = "markdown", -- Configure filetype of the result buffer
debug = false -- Prints errors and the command which is run.
}
},
Here are all available models.
Alternatively, you can call the setup function:
require('gen').setup({
-- same as above
})
Usage
Use command Gen to generate text based on predefined and customizable prompts.
Example key maps:
vim.keymap.set({ 'n', 'v' }, '<leader>]', ':Gen<CR>')
You can also directly invoke it with one of the predefined prompts or your custom prompts:
vim.keymap.set('v', '<leader>]', ':Gen Enhance_Grammar_Spelling<CR>')
After a conversation begins, the entire context is sent to the LLM. That allows you to ask follow-up questions with
:Gen Chat
and once the window is closed, you start with a fresh conversation.
For prompts which don't automatically replace the previously selected text (replace = false), you can replace the selected text with the generated output with <c-cr>.
You can select a model from a list of all installed models with
require('gen').select_model()
Custom Prompts
All prompts are defined in require('gen').prompts, you can enhance or modify them.
Example:
require('gen').prompts['Elaborate_Text'] = {
prompt = "Elaborate the following text:\n$text",
replace = true
}
require('gen').prompts['Fix_Code'] = {
prompt = "Fix the following code. Only output the result in format ```$filetype\n...\n```:\n```$filetype\n$text\n```",
replace = true,
extract = "```$filetype\n(.-)```"
}
You can use the following properties per prompt:
prompt: (string | function) Prompt either as a string or a function which should return a string. The result can use the following placeholders:$text: Visually selected text or the content of the current buffer$filetype: File type of the buffer (e.g.javascript)$input: Additional user input$register: Value of the unnamed register (yanked text)
replace:trueif the selected text shall be replaced with the generated outputextract: Regular expression used to extract the generated resultmodel: The model to use, default:mistral
Tip
User selections can be delegated to Telescope with telescope-ui-select.
Explore related projects
affaan-m/ECC
The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
299,771 starsNousResearch/hermes-agent
The agent that grows with you
261,814 starsmultica-ai/andrej-karpathy-skills
A single CLAUDE.md file to improve Claude Code behavior, derived from Andrej Karpathy's observations on LLM coding pitfalls.
231,003 starsfirecrawl/firecrawl
Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥
199,847 stars