
Codecompanion.nvim
AI coding assistant for Neovim with LLMs and agents
Replaces Github Copilot

Who it's for
Open a chat buffer against any supported provider, ask questions about your code, and get responses without leaving Neovim. Multiple chats can be open simultaneously and each can use a different model.
User does not use Neovim as their primary editor.
Use ACP integration to run Claude Code, Codex, Gemini CLI, or other supported agents directly from Neovim, then use the code review feature to comment on, accept, or revert their changes.
User does not use or want CLI-based coding agents.
Attach MCP servers to provide the LLM with database schemas, documentation, or external data sources, improving response accuracy for domain-specific tasks without copy-pasting context manually.
Define custom prompts, slash commands, editor context providers, and multi-step workflows in Lua. Load skills and rules files like CLAUDE.md or .cursor/rules so the LLM follows project-specific conventions automatically.
User wants a simple, no-configuration AI completion tool.
The problem
Neovim users who want AI-assisted coding have historically had to leave their editor or rely on a single provider's tooling. CodeCompanion brings multi-provider LLM chat, inline editing, CLI agent integration, and MCP support together inside Neovim, so developers can stay in their editor and switch between models and agents without disrupting their workflow.
How it works
Connects to Anthropic, DeepSeek, Google Gemini, GitHub Copilot, Hugging Face, Kimi, Mistral, Novita, Ollama, OpenAI, Azure OpenAI, OpenRouter, and xAI out of the box. Each interaction and each prompt library item can use a different adapter.
Runs CLI agents including Claude Code, Codex, Gemini CLI, Goose, Cursor CLI, Kimi CLI, Kiro, Mistral Vibe, Augment Code, Cagent, Copilot CLI, OpenCode, and more alongside your code inside Neovim using the Agent Client Protocol.
Native support for MCP servers, letting you attach external context sources and tools to your chat and agent interactions without leaving the editor.
The inline interaction mode writes the LLM's response directly into the buffer you are editing, enabling on-the-spot code generation, transformations, and refactoring without switching to a separate chat pane.
Dedicated code review tooling lets you comment on, accept, or revert changes made by an agent, giving you fine-grained control over AI-generated edits before they land in your codebase.
Supports skills and rules files including CLAUDE.md and .cursor/rules. A built-in prompt library covers common tasks like explaining code and diagnosing LSP errors, and you can define your own custom prompts, editor context, and slash commands.
Features
- Multi-provider LLM support
- CLI agent integration via Agent Client Protocol
- Model Context Protocol (MCP) servers
- Inline code creation and refactoring
- Code reviews for agent changes
- Skills, rules, and prompt library
How to install
-- lazy.nvim { "olimorris/codecompanion.nvim", dependencies = { "nvim-lua/plenary.nvim", "nvim-treesitter/nvim-treesitter", }, opts = {}, }
Recommended for this setup
Strengths
- Broad provider and agent coverage: With support for more than a dozen LLM providers and over a dozen CLI agents via ACP, CodeCompanion offers more choices in a single Neovim plugin than most editor-native AI tools provide.
- Async execution keeps Neovim responsive: All LLM and agent calls run asynchronously, so long-running requests do not block the editor. You can continue editing, open other buffers, or start additional chats while a response is in flight.
- Extensible adapter and slash command system: The adapter API lets you connect any LLM provider beyond the built-in set. Community-contributed adapters are already available, and you can create custom slash commands, editor context providers, and prompt library entries using the documented extension points.
- First-class agentic workflow support: Beyond simple chat, CodeCompanion supports workflows, tools, and agent orchestration. The code review feature lets you inspect and selectively accept or reject agent-generated changes, which is absent from simpler completion plugins.
Trade-offs
- Neovim only: CodeCompanion is built exclusively for Neovim and relies on Lua, plenary.nvim, and nvim-treesitter. Users on VS Code, JetBrains, Emacs, or other editors will need a different tool.
- Configuration can be extensive: Getting the most out of adapters, MCP servers, custom prompts, skills, and workflows requires reading the documentation and writing Lua config. Users who want a zero-configuration AI assistant may find the setup overhead high.
- CLI agent requirements vary: Running agents like Claude Code or Codex requires those CLI tools to be installed and authenticated separately. CodeCompanion integrates with them via ACP but does not bundle or manage the agents themselves.
Tech stack
FAQ
Anthropic, DeepSeek, Google Gemini, GitHub Copilot, Hugging Face, Kimi, Mistral, Novita, Ollama, OpenAI, Azure OpenAI, OpenRouter, and xAI are all supported without any additional plugins. You can also write your own adapter using the extension API.
Yes. CodeCompanion supports the Agent Client Protocol (ACP), which lets you run agents including Claude Code, Codex, Gemini CLI, Goose, Cursor CLI, Kimi CLI, Kiro, Mistral Vibe, and others from inside Neovim. The agents must be installed separately.
Yes, MCP server support is built in. You can connect MCP servers to your chat and agent interactions to provide additional context or tools.
Run :checkhealth codecompanion to verify dependencies and find the log file path. Enable debug logging by setting log_level to "DEBUG" or "TRACE" in your config's opts.opts table, then inspect the log file. For config-related issues, the repository includes a minimal.lua file you can use with nvim --clean -u minimal.lua to rule out your own config as the cause.
Yes. CodeCompanion lets you define custom prompts, editor context providers, and slash commands in Lua. These are additive, so you keep the built-in prompt library while extending it with your own project- or workflow-specific entries.