Cursor-style AI agent in a Neovim right pane. Native Cursor ACP client, live diff overlays when the agent edits files, and a provider router (Cursor in v1; Claude/Codex stubbed).
Platforms: WSL2, macOS, Arch Linux (Unix shell). Run Neovim and agent inside Linux/WSL — not native Windows Neovim.
- Neovim >= 0.10
- Cursor CLI:
curl https://cursor.com/install -fsSL | bash - Auth:
agent login(recommended) orexport CURSOR_API_KEY=...in~/.bashrc/~/.zshrc— never commit keys to this repo
Verify:
which agent
agent login
# from a project: agent acp (Ctrl-C to exit){
"your-user/nvim-ai-companion",
dependencies = {
"nvim-lua/plenary.nvim",
"MeanderingProgrammer/render-markdown.nvim",
},
opts = {
agent_cmd = "agent",
default_provider = "cursor",
layout = { position = "right", width = 0.35 },
},
config = function(_, opts)
require("nvim-ai-companion").setup(opts)
end,
}Local development:
{
dir = "~/Projects/nvim-ai-companion",
name = "nvim-ai-companion",
-- ...
}Optional markdown rendering in the chat buffer:
{
"MeanderingProgrammer/render-markdown.nvim",
opts = { file_types = { "markdown", "NvimAiCompanion" } },
ft = { "markdown", "NvimAiCompanion" },
}| Command | Description |
|---|---|
:AICompanionToggle |
Open/close right pane |
:AICompanionSend |
Send prompt from input buffer |
:AICompanionNewSession |
Reset session |
:AICompanionCancel |
Cancel current turn |
:AICompanionProvider [name] |
cursor, claude, codex |
:AICompanionContext |
Insert @relative/path for current file |
| Key | Action |
|---|---|
<leader>ac |
Toggle pane |
<C-CR> (in input) |
Send |
]a / [a |
Next/prev hunk |
<leader>aa |
Accept hunk |
<leader>ar |
Reject hunk |
<leader>aA / <leader>aR |
Accept/reject all |
Configure in setup({ keymaps = { ... } }).
In the input buffer:
@src/foo.lua— include file reference@src/foo.lua:10-20— line range
:AICompanionContext inserts @path for the current file.
- No API keys in plugin source or committed config
- Sessions stored under
stdpath("data")/nvim-ai-companion/ - See
.env.examplefor optional env var names only
statusline = "%{%v:lua.require('nvim-ai-companion').status()%}"MIT