Skip to content

bka9/cursor.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

cursor.nvim

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.

Features

  • Open cursor-agent inside 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

Requirements

  • Cursor CLI installed and available in $PATH (cursor-agent). See Cursor docs for installation.
  • Neovim 0.8+

Installation (LazyVim/Lazy.nvim)

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

Usage

  • :CursorAgentOpen open or focus the terminal with cursor-agent.
  • :CursorAgentToggle toggle the terminal window.
  • :CursorAgentFocus jump to the terminal window.
  • :CursorAgentSend send the current buffer (with <range>, send visual selection or custom range).
    • Example: select in visual mode and run :CursorAgentSend, or :'<,'>CursorAgentSend.
  • :CursorAgentSendPrompt prompt for a one-line message and send.
  • :CursorAgentInstallAgents copy .mdc rule files from the plugin's agents folder into the project's .cursor/rules directory.

If default keymaps are enabled (disable_default_keymaps = false):

  • <leader>co Toggle
  • <leader>cf Focus
  • <leader>cp Prompt-and-send
  • <leader>cs Send buffer (normal), send selection (visual)

Notes on parameters

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

API

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()

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages