Skip to content

jhanna2/nvim-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nvim-ai-companion

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.

Prerequisites

  1. Neovim >= 0.10
  2. Cursor CLI: curl https://cursor.com/install -fsSL | bash
  3. Auth: agent login (recommended) or export 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)

Install (lazy.nvim)

{
  "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" },
}

Commands

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

Default keymaps

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 = { ... } }).

Context references

In the input buffer:

  • @src/foo.lua — include file reference
  • @src/foo.lua:10-20 — line range

:AICompanionContext inserts @path for the current file.

Secrets / public repo

  • No API keys in plugin source or committed config
  • Sessions stored under stdpath("data")/nvim-ai-companion/
  • See .env.example for optional env var names only

Statusline

statusline = "%{%v:lua.require('nvim-ai-companion').status()%}"

License

MIT

About

A setup to bring the best of both worlds together; the vim we all love with the power of a coding companion!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages