@@ -7,10 +7,14 @@ Connect Claude Desktop (or any Model Context Protocol client) to Neovim using MC
77## Features
88
99- Connects to your nvim instance if you expose a socket file, for example ` --listen /tmp/nvim ` , when starting nvim
10- - Views your current buffers
11- - Gets cursor location, mode, file name
10+ - Views your current buffers and manages buffer switching
11+ - Gets cursor location, mode, file name, marks, registers, and visual selections
1212- Runs vim commands and optionally shell commands through vim
13- - Can make edits using insert or replacement
13+ - Can make edits using insert, replace, or replaceAll modes
14+ - Search and replace functionality with regex support
15+ - Project-wide grep search with quickfix integration
16+ - Comprehensive window management
17+ - Health monitoring and connection diagnostics
1418
1519## API
1620
@@ -20,49 +24,97 @@ Connect Claude Desktop (or any Model Context Protocol client) to Neovim using MC
2024- ` nvim://buffers ` : List of all open buffers in the current Neovim session with metadata including modified status, syntax, and window IDs
2125
2226### Tools
27+
28+ #### Core Tools
2329- ** vim_buffer**
24- - Current VIM text editor buffer with line numbers shown
25- - Input ` filename ` (string)
26- - Filename is ignored, returns a string of numbered lines with the current active buffer content
30+ - Get buffer contents with line numbers (supports filename parameter)
31+ - Input ` filename ` (string, optional) - Get specific buffer by filename
32+ - Returns numbered lines with buffer content
2733- ** vim_command**
2834 - Send a command to VIM for navigation, spot editing, and line deletion
2935 - Input ` command ` (string)
30- - Runs a vim command first passed through ` nvim.replaceTermcodes ` . Multiple commands will work if separated by newlines
36+ - Runs vim commands with ` nvim.replaceTermcodes ` . Multiple commands work with newlines
37+ - Shell commands supported with ` ! ` prefix when ` ALLOW_SHELL_COMMANDS=true `
3138 - On error, ` 'nvim:errmsg' ` contents are returned
3239- ** vim_status**
33- - Get the status of the VIM editor
34- - Status contains cursor position, mode, filename, visual selection, window layout, current tab, marks, registers, and working directory
40+ - Get comprehensive Neovim status
41+ - Returns cursor position, mode, filename, visual selection, window layout, current tab, marks, registers, working directory, LSP client info, and plugin detection
3542- ** vim_edit**
36- - Edit lines using insert, replace, or replaceAll in the VIM editor
43+ - Edit lines using insert, replace, or replaceAll modes
3744 - Input ` startLine ` (number), ` mode ` (` "insert" ` | ` "replace" ` | ` "replaceAll" ` ), ` lines ` (string)
38- - insert will insert lines at startLine
39- - replace will replace lines starting at startLine
40- - replaceAll will replace the entire buffer contents
45+ - insert: insert lines at startLine
46+ - replace: replace lines starting at startLine
47+ - replaceAll: replace entire buffer contents
4148- ** vim_window**
4249 - Manipulate Neovim windows (split, vsplit, close, navigate)
4350 - Input ` command ` (string: "split", "vsplit", "only", "close", "wincmd h/j/k/l")
44- - Allows window management operations
4551- ** vim_mark**
46- - Set a mark at a specific position
52+ - Set named marks at specific positions
4753 - Input ` mark ` (string: a-z), ` line ` (number), ` column ` (number)
48- - Sets named marks at specified positions
4954- ** vim_register**
50- - Set content of a register
55+ - Set content of registers
5156 - Input ` register ` (string: a-z or "), ` content ` (string)
52- - Manages register contents
5357- ** vim_visual**
54- - Make a visual selection
58+ - Create visual mode selections
5559 - Input ` startLine ` (number), ` startColumn ` (number), ` endLine ` (number), ` endColumn ` (number)
56- - Creates visual mode selections
5760
58- Using this simple set of tools, Claude can peer into your neovim session to answer questions as well as make edits to the buffer.
61+ #### Enhanced Buffer Management
62+ - ** vim_buffer_switch**
63+ - Switch between buffers by name or number
64+ - Input ` buffer ` (string | number) - Buffer name or number
65+ - ** vim_buffer_save**
66+ - Save current buffer or save to specific filename
67+ - Input ` filename ` (string, optional) - Save to specific file
68+ - ** vim_file_open**
69+ - Open files into new buffers
70+ - Input ` filename ` (string) - File to open
71+
72+ #### Search and Replace
73+ - ** vim_search**
74+ - Search within current buffer with regex support
75+ - Input ` pattern ` (string), ` options ` (object, optional) with ` backwards ` , ` wrap ` , ` ignorecase `
76+ - ** vim_search_replace**
77+ - Find and replace with advanced options
78+ - Input ` pattern ` (string), ` replacement ` (string), ` options ` (object, optional) with ` global ` , ` ignorecase ` , ` confirm `
79+ - ** vim_grep**
80+ - Project-wide search using vimgrep with quickfix list
81+ - Input ` pattern ` (string), ` files ` (string, optional) - File pattern to search
82+
83+ #### Advanced Workflow Tools
84+ - ** vim_macro**
85+ - Record, stop, and play Vim macros
86+ - Input ` action ` ("record" | "stop" | "play"), ` register ` (string, a-z), ` count ` (number, optional)
87+ - ** vim_tab**
88+ - Complete tab management
89+ - Input ` action ` ("new" | "close" | "next" | "prev" | "first" | "last" | "list"), ` filename ` (string, optional)
90+ - ** vim_fold**
91+ - Code folding operations
92+ - Input ` action ` ("create" | "open" | "close" | "toggle" | "openall" | "closeall" | "delete"), ` startLine ` /` endLine ` (numbers, for create)
93+ - ** vim_jump**
94+ - Jump list navigation
95+ - Input ` direction ` ("back" | "forward" | "list")
96+
97+ #### System Tools
98+ - ** vim_health**
99+ - Check Neovim connection health and socket status
100+
101+ Using this comprehensive set of ** 19 tools** , Claude can peer into your neovim session, navigate buffers, perform searches, make edits, record macros, manage tabs and folds, and handle your complete development workflow with standard Neovim features.
102+
103+ ## Error Handling
104+
105+ The server implements robust error handling with custom error classes:
106+
107+ - ** NeovimConnectionError** : Socket connection failures with detailed messages
108+ - ** NeovimCommandError** : Command execution failures with command context
109+ - ** NeovimValidationError** : Input validation failures
110+
111+ Features include connection health monitoring, graceful error propagation, and actionable error messages to help diagnose issues.
59112
60113## Limitations
61114
62- - This is a quick proof of concept to experiment with Model Context Protocol. Use at your own risk.
63- - May not interact well with a custom neovim config!
64- - Error handling could be better.
65- - Sometimes Claude doesn't get the vim command input just right.
115+ - May not interact well with complex neovim configurations or plugins
116+ - Shell command execution is disabled by default for security
117+ - Socket connection required - won't work with standard vim
66118
67119## Configuration
68120
0 commit comments