Run Cursor's cursor-agent inside a Neovim terminal buffer (it starts in interactive mode by default). Inspired by and functionally similar to claude-code.nvim.
- Open
cursor-agentinside a floating, horizontal, vertical, or current-window terminal - Toggle/focus commands:
:CursorAgentOpen,:CursorAgentToggle,:CursorAgentFocus - Send current buffer or visual selection to the agent:
:CursorAgentSend(supports:<range>CursorAgentSend) - Prompt-and-send utility:
:CursorAgentSendPrompt - Configurable CLI arguments (parameters and extra args)
- Optional default keymaps for quick access
- Cursor CLI installed and available in
$PATH(cursor-agent). See Cursor docs for installation. - Neovim 0.8+
{
"bka9/cursor.nvim",
event = "VeryLazy",
opts = {
-- base command
cmd = "cursor-agent",
-- cursor-agent runs in interactive mode by default
-- map of parameter -> value, will be converted to flags using --kebab-case
-- refer to https://docs.cursor.com/en/cli/reference/parameters
parameters = {
-- project_dir = vim.loop.cwd(),
-- model = "sonnet",
-- api_key = os.getenv("CURSOR_API_KEY"),
},
-- extra raw args appended after parameters
extra_args = { },
-- window options
window = {
type = "float", -- "float" | "horizontal" | "vertical" | "current"
width = 0.6,
height = 0.6,
border = "rounded",
position = "bottom",
focus = true,
},
-- start terminal in insert mode
start_in_insert = true,
-- close terminal automatically when process exits
auto_close_on_exit = false,
-- disable default keymaps (set to false to enable)
disable_default_keymaps = true,
},
config = function(_, opts)
require("cursor_agent").setup(opts)
end,
}:CursorAgentOpenopen or focus the terminal withcursor-agent.:CursorAgentToggletoggle the terminal window.:CursorAgentFocusjump to the terminal window.:CursorAgentSendsend the current buffer (with<range>, send visual selection or custom range).- Example: select in visual mode and run
:CursorAgentSend, or:'<,'>CursorAgentSend.
- Example: select in visual mode and run
:CursorAgentSendPromptprompt for a one-line message and send.:CursorAgentInstallAgentscopy.mdcrule files from the plugin'sagentsfolder into the project's.cursor/rulesdirectory.
If default keymaps are enabled (disable_default_keymaps = false):
<leader>coToggle<leader>cfFocus<leader>cpPrompt-and-send<leader>csSend buffer (normal), send selection (visual)
The plugin converts the keys in parameters from snake_case/camelCase to kebab-case and turns them into flags. Booleans are included only when true. Strings/nums are added as --flag value pairs.
Refer to Cursor CLI docs for supported flags and interactive mode details:
— Interactive mode: https://docs.cursor.com/en/cli/overview#interactive-mode
- Parameters:
https://docs.cursor.com/en/cli/reference/parameters
local agent = require("cursor_agent")
agent.open()
agent.toggle()
agent.focus()
agent.send_text("Your message here")
agent.send_range(1, 10)
agent.prompt_and_send()