Skip to content

fullbeaker/surimi.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

surimi.nvim

Run Claude Code in a Neovim terminal split with full vim navigation and an MCP server that gives Claude awareness of your editor state.

Features

  • Toggle a persistent Claude Code terminal in a vertical split
  • Send file references (path + line range) from visual selections
  • Claude can see what files you have open
  • Claude can open a file for you, e.g. "Take me to the code that handles user registration"
  • LSP diagnostics (errors, warnings) are visible to Claude
  • Many convenience features to smooth over Nvim's terminal mode

Requirements

  • Neovim >= 0.9
  • Claude Code CLI installed and authenticated
  • Python 3 with msgpack (pip install msgpack)

Installation

{
  "fullbeaker/surimi.nvim",
  cmd = { "Surimi", "SurimiOpen", "SurimiSend", "SurimiResume", "SurimiFocus" },
  keys = {
    { "<Leader>cc", "<cmd>Surimi<cr>", desc = "Toggle Claude" },
    { "<Leader>cf", "<cmd>SurimiFocus<cr>", desc = "Focus Claude" },
    { "<Leader>cr", "<cmd>SurimiResume<cr>", desc = "Resume Claude" },
    { "<Leader>cs", "<cmd>SurimiSend<cr>", mode = "v", desc = "Send selection" },
  },
  config = function()
    require("surimi").setup()
  end,
}

Configuration

All options and their defaults:

require("surimi").setup({
  cmd = "claude",                -- command to start Claude Code
  split_side = "right",          -- "left" or "right"
  split_width_percentage = 0.50, -- fraction of screen width
  auto_close = true,             -- close the split when Claude exits
})

Commands

Command Description
:Surimi Toggle the Claude Code terminal
:SurimiOpen Open (or focus) the Claude Code terminal
:SurimiResume Resume the previous Claude Code session
:SurimiSend Send visual selection (as file + line range) or text to Claude
:SurimiReload Hot-reload plugin code without killing the Claude session
:SurimiMcpRegister Manually register the MCP server

MCP Server

The MCP server auto-registers the first time you open a Claude Code terminal. It connects to Neovim via the $NVIM socket and provides these tools to Claude:

Tool Description
neovim_get_open_files List all open buffers
neovim_get_current_file Get current file path and cursor position
neovim_open_file Open a file at an optional line number
neovim_get_diagnostics Get LSP diagnostics for open buffers

If auto-registration fails, run :SurimiMcpRegister manually.

Terminal Keymaps

These keymaps are active inside the Claude Code terminal buffer:

Key Action
Ctrl-] Exit TERMINAL mode (like Esc from NORMAL mode)
i Re-enter TERMINAL mode (standard key map)
Ctrl-w + w/h/j/k/l Navigate to other windows

Tips

  • Nvim terminal buffers have modes, namely TERMINAL and NTERMINAL.
  • TERMINAL is like INSERT mode, but you are sending keystrokes directly to the terminal application, in this case, Claude Code.
  • NTERMINAL is like NORMAL mode which can be useful for searching/copying Claude's output.
  • In Surimi the "default" mode is TERMINAL as much as possible.
  • Surimi will try to detect : to enter COMMAND mode. For example, typing it as the first character in Claude's prompt.
  • Surimi tries to put you in the best mode if you click on the Claude window. I.e. if you click near the input box, then TERMINAL mode. Otherwise, NTERMINAL mode. This may not always work because it depends on some heuristics around how Claude's output typically looks.

License

MIT

About

Claude Code plugin for Neovim

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published