A Python library that generates function implementations with an LLM at runtime, based on function names, arguments, and context, powered by OpenAI.
madox2/vim-ai
AI code assistant plugin for Vim and Neovim that generates, edits and chats with OpenAI-compatible models from inside the editor.
Open-source alternative to:GitHub Copilot Chat
- Stars
- 1,189
- Forks
- 112
- Open issues
- 3
- Last commit
- 24 days ago
What is it?
vim-ai adds AI commands to Vim and Neovim. You can generate text or code from a prompt, edit a selection or the current line in place, or hold an interactive conversation in a chat buffer. The default backend is OpenAI's API, and the plugin can point at any OpenAI-compatible endpoint, such as OpenRouter or a local LiteLLM proxy, to use other models.
The plugin only sends the text you select or type in a prompt, and not the rest of your code. Users need their own API key, which can be stored in a file or an environment variable. Behavior is configured through Vim variables and an INI file of named roles, which bundle a prompt with model options such as model name, temperature or endpoint. Chat sessions can be saved as .aichat files that include other files or the output of shell commands.
Additional providers, such as Google Gemini and the OpenAI Responses API, are available as separate plugins. Image generation via :AIImage and vision input from image files are also supported.
Key features
- 01Generate text or code from a prompt with :AI
- 02Edit selected text or the current line in place with :AIEdit
- 03Multi-turn chat in a buffer with :AIChat, saveable as .aichat files
- 04Named roles in an INI file bundle prompts and model options
- 05Works with any OpenAI-compatible endpoint and separate provider plugins
- 06Image generation and image-based input are supported
Use cases
- Drafting boilerplate or helper functions without leaving Vim
- Fixing grammar or rewriting a selected paragraph in place
- Asking questions about code in a chat buffer with relevant files attached
- Generating a git commit message from the staged diff
Quick start
- 1
Make sure Vim or Neovim is built with python3 support and get an OpenAI API key
- 2
Install the plugin with vim-plug by adding this line to your .vimrc
- 3
Save your API key to the default token file
echo "YOUR_OPENAI_API_KEY" > ~/.config/openai.token
Things to know
- Requires an OpenAI API key, and API usage is paid.
- Requires Vim or Neovim compiled with python3 support.
Topics
FAQ
- What is vim-ai?
- AI code assistant plugin for Vim and Neovim that generates, edits and chats with OpenAI-compatible models from inside the editor. vim-ai adds AI commands to Vim and Neovim. You can generate text or code from a prompt, edit a selection or the current line in place, or hold an interactive conversation in a chat buffer. The default backend is OpenAI's API, and the plugin can point at any OpenAI-compatible endpoint, such as OpenRouter or a local LiteLLM proxy, to use other models.
- Is vim-ai free to use? What license does it have?
- vim-ai is open source under the MIT license. Check the license terms before using it in commercial products.
- Is vim-ai still maintained?
- Actively maintained. The last commit to vim-ai was on Oct 14, 2026.
- What can I use vim-ai for?
- Drafting boilerplate or helper functions without leaving Vim Fixing grammar or rewriting a selected paragraph in place Asking questions about code in a chat buffer with relevant files attached Generating a git commit message from the staged diff
- How do I install vim-ai?
- Make sure Vim or Neovim is built with python3 support and get an OpenAI API key Install the plugin with vim-plug by adding this line to your .vimrc Save your API key to the default token file: echo "YOUR_OPENAI_API_KEY" > ~/.config/openai.token
- Where can I get vim-ai?
- The source code and installation instructions are on GitHub: https://github.com/madox2/vim-ai
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A snippet engine for Vim and Neovim that expands triggers into templates with tabstops, placeholders and Python-scripted logic.
Generative Manim turns text prompts into Manim animation code using LLMs such as GPT-4o or Claude, then renders it as video.
A terminal CLI for chatting with OpenAI's GPT-3.5 and GPT-4 models, with interactive chat mode and pipeline support.
A collection of Jupyter notebook examples and guides showing how to accomplish common tasks with the OpenAI API.
Self-hosted admin system for integrating many LLM providers (OpenAI, Claude, Gemini, DeepSeek, Qwen and others) behind one unified API.