opencode.nvim is a Neovim plugin that integrates with OpenCode, injecting editor context and enabling prompts, selections, and edits via OpenCode. It supports connecting to any OpenCode server, or starting an integrated instance, with in-editor interactions and event handling.
Collecting history — the radar snapshots this repo daily. The trend line appears after 3 days of data (1 so far).
What it is
opencode.nvim is a Neovim plugin that connects to OpenCode to keep you in your normal editing flow. It injects editor context, supports prompts, selections, and applying OpenCode edits, and handles OpenCode events within Neovim.
How it works
The plugin connects to an OpenCode server (local or remote). If a server isn’t found, it starts one by default via the configured options. It exposes APIs like ask, select, prompt, operator, and command to interact with OpenCode, and forwards OpenCode events as Neovim autocommands. It also integrates with terminal/prompt tooling (e.g., snacks.nvim) for in-editor workflows and can render diffs for edits via Neovim buffers.
Getting started
Setup
The README provides a setup approach using vim.pack and shows example keymaps that call into require("opencode").<method>(). It also includes an example of configuring opencode with vim.g.opencode_opts and recommended keymaps. The README contains the following code blocks:
vim.pack.add({
{
src = "https://github.com/nickjvandyke/opencode.nvim",
version = vim.version.range("*"), -- Latest stable release
},
})
---@type opencode.Opts
vim.g.opencode_opts = {
-- Your configuration, if any; goto definition on the type for details
}
-- Recommended/example keymaps
vim.keymap.set({ "n", "x" }, "<C-a>", function() require("opencode").ask("@this: ") end, { desc = "Ask OpenCode…" })
vim.keymap.set({ "n", "x" }, "<C-x>", function() require("opencode").select() end, { desc = "Select OpenCode…" })
vim.keymap.set({ "n", "x" }, "go", function() return require("opencode").operator("@this ") end, { desc = "Append range to OpenCode", expr = true })
Usage
Functions available:
- Ask — require("opencode").ask()
- Select — require("opencode").select()
- Prompt — require("opencode").prompt()
- Operator — require("opencode").operator()
- Command — require("opencode").command()
The README documents various commands and a server setup, including a Start via snacks.terminal example under the Server section, showing how to start opencode with a port and a toggle for a terminal UI.
Recent releases
Latest: v0.14.0 (2026-07-27) with breaking changes around config structure (opts.events.reload.enabled) and server-related naming changes. Prior notable versions include v0.13.4, v0.13.3, v0.13.2, etc.
Traction
GitHub stars: 3740. Forks: 147. Open issues: 4.
Caveats
License: MIT. Created 2025-07-12. Last push 2026-07-30. Language: Lua. Open issues: 4.






