Repolode
nickjvandyke

nickjvandyke/opencode.nvim

Neovim plugin that connects your editor to OpenCode, sending code context and prompts without leaving your Vim workflow.

Stars
3,907
Forks
161
Open issues
11
Last commit
8 days ago

What is it?

opencode.nvim is a Neovim plugin for working with OpenCode, an AI coding agent. It connects to a running OpenCode server, or starts one in a terminal, and lets you send prompts that automatically include editor context such as the cursor position, a selection, the current buffer, diagnostics, quickfix entries, or visible text.

The plugin uses standard Neovim interfaces: an input prompt with completion and highlighting, a picker for built-in and custom prompts, operators for sending ranges with dot-repeat, and commands for running OpenCode commands. Edits made by OpenCode reload in open buffers, and permission requests show proposed changes in a side-by-side diff where you can accept or reject whole edits or individual hunks.

OpenCode server events are forwarded as Neovim autocmds, so you can react to session status changes or other events in your own configuration. Setup examples cover lazy.nvim, vim.pack, and nixvim, with optional integrations for snacks.nvim, blink.cmp, and lualine.

Key features

  • 01Connects to any running OpenCode server or starts an integrated instance
  • 02Injects cursor, selection, buffer, diagnostics, and quickfix context into prompts
  • 03Provides a prompt input with completions and highlights, plus a picker for built-in prompts
  • 04Reloads buffers when OpenCode edits files
  • 05Shows OpenCode edit requests as a diff with accept and reject per change
  • 06Forwards OpenCode server events as Neovim autocmds

Use cases

  • Asking OpenCode to explain, fix, or review the function under the cursor
  • Sending a visual selection or a motion range to OpenCode without leaving Neovim
  • Reviewing AI-proposed edits in a Neovim diff before applying them
  • Building custom workflows on top of OpenCode events in your Neovim config

Quick start

  1. 1

    Add the plugin with vim.pack (Neovim built-in plugin manager)

  2. 2

    Configure keymaps and options in your Neovim config, then restart Neovim

  3. 3

    Install OpenCode so the plugin can find or start its server

  4. 4

    Check the setup inside Neovim

    :checkhealth opencode

Things to know

  • Requires an installed OpenCode, since the plugin connects to its server.
  • Early-stage plugin with a default branch that targets OpenCode v2; use the version pin for OpenCode v1.

In collections

Topics

FAQ

What is opencode.nvim?
Neovim plugin that connects your editor to OpenCode, sending code context and prompts without leaving your Vim workflow. opencode.nvim is a Neovim plugin for working with OpenCode, an AI coding agent. It connects to a running OpenCode server, or starts one in a terminal, and lets you send prompts that automatically include editor context such as the cursor position, a selection, the current buffer, diagnostics, quickfix entries, or visible text.
Is opencode.nvim free to use? What license does it have?
opencode.nvim is open source under the MIT license. Check the license terms before using it in commercial products.
Is opencode.nvim still maintained?
Actively maintained. The last commit to opencode.nvim was on Oct 30, 2026.
What can I use opencode.nvim for?
Asking OpenCode to explain, fix, or review the function under the cursor Sending a visual selection or a motion range to OpenCode without leaving Neovim Reviewing AI-proposed edits in a Neovim diff before applying them Building custom workflows on top of OpenCode events in your Neovim config
How do I install opencode.nvim?
Add the plugin with vim.pack (Neovim built-in plugin manager) Configure keymaps and options in your Neovim config, then restart Neovim Install OpenCode so the plugin can find or start its server Check the setup inside Neovim: :checkhealth opencode
Where can I get opencode.nvim?
The source code and installation instructions are on GitHub: https://github.com/nickjvandyke/opencode.nvim

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects

Neovim is a Vim-based text editor refactored for extensibility, with a Lua and RPC API that lets plugins and external UIs drive the editor.

Developer Tools#text-editor#vim#lua
103.4K+162 this week7.4KVim ScriptOtherUpdated 21 hours ago