Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

copy.nvim

Copy Neovim selections as cheap LLM/agent references, and optionally expose live editor context through a local MCP bridge.

Overview

# Clipboard path (any agent UI)
Visual select -> :CopySendSelection / keymap -> @path#L8-10 on +

# Optional agent MCP path
MCP tool call -> stdio proxy -> local WebSocket JSON-RPC -> Neovim editor state

Neovim owns the local WebSocket server and binds it to 127.0.0.1. Agents launch scripts/copy-nvim-proxy.js, which reads the bridge state file written by Neovim and maps MCP tool calls to WebSocket JSON-RPC requests.

Installation

{
  "rafaeelricco/copy.nvim",
  config = true,
}

Configuration

require("copy").setup({
  port_range = { min = 10000, max = 65535 },
  auto_start = true,
  log_level = "info",
  send = {
    keymap = "<leader>as",
    register = "+",
  },
})

Commands

Command Description
:CopyBridgeStart Start the local WebSocket bridge
:CopyBridgeStop Stop the local WebSocket bridge
:CopyBridgeStatus Show bridge status
:'<,'>CopySendSelection Copy @relpath#L… for the selected saved file range

Visual <leader>as copies a reference like @docs/guides/onboarding-manager.md#L8-10. Paste it into any LLM or agent composer. v1 does not submit directly to an agent thread.

MCP Tools

  • get_current_selection
  • get_current_buffer
  • get_open_buffers
  • get_diagnostics
  • get_workspace_folders

Wire agents via .mcp.jsonnode ./scripts/copy-nvim-proxy.js. Bridge state lives at stdpath("state")/copy.nvim/bridge.json (override with COPY_NVIM_BRIDGE_STATE). Skill: skills/copy-nvim/SKILL.md.

Validation

nvim --headless -u tests/minimal_init.lua -c "PlenaryBustedDirectory tests/" -c "qa!"
node --test tests/proxy/*.test.mjs

About

Copy Neovim selections as @file#L refs; optional MCP editor bridge for agents.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages