
Vim Mcp
io.github.iggredible由 GitHub 帳號 iggredible 發布v0.1.2更新於 Oct 24, 2026
Connect Claude Code to Vim/Neovim - query state, execute commands, search help, record macros
概覽
將 Claude Code 連接到本機 Vim/Neovim 實例,讓助理查看編輯器狀態、執行 Ex 指令、搜尋說明並錄製巨集。
- 可以做什麼
- 列出並選擇正在執行的 Vim 實例,透過資源或狀態查詢讀取其狀態、緩衝區與分頁。在選取的實例中執行 Vim/Ex 指令,包括複雜的取代與巨集。搜尋 Vim 內建說明以解答用法問題。依自然語言描述錄製巨集。以安全、儲存後結束或強制結束三種模式結束 Vim。
- 適用情境
- 當你只能描述編輯目標而不知道確切 Vim 按鍵時適用,例如複雜正規表示式取代、巨集或說明查詢,希望 Claude 建構並執行指令。對於自己能更快打完的簡單操作則沒有必要。
- 執行需求
- 以 npm 套件(vim-mcp)透過 stdio 在本機執行。需要 Node.js 18+、具備 +channel 功能的 Vim 8+ 或 Neovim 0.5+、Unix 網域通訊端支援(Linux/macOS)、對 /tmp 的寫入權限、已安裝的 Vim 外掛,以及支援 MCP 的用戶端(如 Claude Code 或 Claude Desktop)。僅限桌面端。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Vim Mcp,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
vim-mcp
Simple MCP (Model Context Protocol) integration for Vim and Claude Code.
Features
- Connect Claude Code to one of your Vim instances
- Query Vim state (buffers, windows, cursor position, etc.)
- Execute Vim commands from Claude using natural language
How it works:
- The MCP server starts a Unix socket server at
/tmp/vim-mcp-server.sock - Each Vim instance connects to the server as a Unix socket client
- Vim sends registration and state updates to the server
- The server maintains active connections to all Vim instances
- Claude Code communicates with the MCP server via Model Context Protocol
Demo
List and select Vim instance:
[List and select Vim instances]
You can (finally) exit Vim!
[List and select Vim instances]
For more, check out the demo wiki page
Why would anyone need this?
Ok, I get what it does, but why do we need this?
If you're trying to do basic Vim operations like typing "split the window in half" (24 keystrokes) vs running :sp / :vs (3 keystrokes), then you're better off without it. Where vim-mcp shines is when the number of keystrokes is unknown; when you can only describe what you want to do but don't know exactly how to do it. Things like complex regex/macros/lookups, help semantic search, etc. - it's faster to tell AI what you're trying to accomplish than trial-and-error. I think the word I'm looking for is circumlocution?
Here's one scenario where it may be useful:
Suppose you want to perform a complex Vim command that would otherwise take a long time to construct. Claude can easily do it if you can describe what you want to do. Maybe you want to substitute "(test foobar)" with square brackets ONLY IF they come after a 3rd-level Markdown header. That's not something I can easily cook up in seconds... but Claude can!
With vim-mcp, I can prompt Claude:
And that's it! When I did it, Claude came up with the g command and executed it for me.
Bonus: the executed commands are stored in the command history so you can go back and re-execute them or modify them.
What if you later decide, "Hey, I actually don't want to substitute them with square brackets [], I want to substitute them with curly brackets {} instead!" You can just access the command history (q:, :history, or : then press up/down) and make the necessary modifications.
So I did :, then pressed the up arrow a few times until I saw the command that vim-mcp executed, and changed it to :g/^### /,/^#\{1,3\} \|^$/s/(test foobar)/{test foobar}/g. Done!
Overview
For a detailed overview, see vim-mcp overview.
Tools and Resources
Tools:
list_vim_instancesselect_vim_instanceget_vim_statevim_executeexit_vimvim_search_helpvim_record_macro
Resources:
vim://instances- List of all available Vim instancesvim://state- Current state of the selected Vim instancevim://buffers- List of all buffers in the selected Vim instancevim://tabs- List of all tabs in the selected Vim instance
Installation
Prerequisites
- Vim 8+ with
+channelfeature OR Neovim 0.5+ - Node.js 18+
- Unix domain socket support (Linux/macOS)
- File system write access to
/tmpdirectory - claude code / claude desktop or similar tools that support MCP
Install the Vim Plugin
Using vim-plug:
Install the MCP Server
The MCP server is a Node project. You need to install the dependencies.
Option 1: Using the Install Script
The install script will automatically:
- Check prerequisites (Node.js and Vim versions)
- Install Node.js dependencies
- Attempt global installation of the
vim-mcpcommand - Show you the correct Claude Code configuration
Option 2: Manual Installation
If you prefer to install manually or the install.sh script doesn't work:
- Install Node.js dependencies:
npm install will also run chmod +x bin/vim-mcp
- (Optional) Install globally for system-wide
vim-mcpcommand (inside the/serverdirectory):
If this fails due to permissions or other reasons, you can skip global installation and use the full path in your config.
Configure Claude Code
After installation, add one of these configurations to your Claude configuration file:
If global install succeeded (if vim-mcp command is available):
If npm link failed:
Uninstall
To remove vim-mcp:
- Remove the plugin from your
.vimrc:
- Clean up the plugin files:
- Remove the global
vim-mcpcommand (if installed):
- Remove from Claude Code configuration:
Edit the Claude config file and remove the vim-mcp section from mcpServers
- Clean up temporary files (optional):
- Restart Vim and Claude Code to ensure all connections are cleared.
Quick Start
Step-by-Step Connection Process
- Open Vim instances (the plugin connects automatically):
- In Claude Code, list available Vim instances:
- If multiple instances are found, select one:
Things you can prompt
From the client (claude code), you can:
-
Manage instances:
- "List vim instances"
- "Connect to the first one pls"
- "Select the one with README.md open"
-
Control Vim:
- "Split into two windows vertically"
- "execute vim command "
- "HELP ME EXIT VIM!!!"
-
Search Vim help:
- "Search vim help for working with channels"
- "How do I use vim's quickfix list?"
- "Show me help on vim registers"
-
Record macros:
- "Record a macro that uppercases the first word and moves down 2 lines"
- "Create a macro to duplicate the current line and comment it out"
- "Make a macro that finds the next TODO and marks it as DONE"
-
Query about Vim:
- "How many buffers do I have?"
- "What buffers are open?"
- "What is my cursor position?"
- "Show me the current buffer content"
- "How many lines are in the active buffer?"
- "What language is the file written in?"
- "What windows are open?"
- "What is the realistic 10-year target price for BTC?" (jk)
vim-mcp can help you exit Vim!!
You can FINALLY exit Vim! Rejoice! The exit_vim tool provides safe exit functionality with three modes:
- Default (check): Checks for unsaved changes and warns you before exiting
- Save and exit: Saves all modified buffers and exits (
exit vim save_and_exit) - Force exit: Exits without saving, discarding changes (
exit vim force_exit)
Examples:
Note: this is a joke tool because many people have a hard time exiting Vim.
Vim Commands
The plugin connects automatically when Vim opens. However, you can do these from inside Vim:
:VimMCPStatus- Check connection status:VimMCPConnect- Manually connect to server:VimMCPDisconnect- Disconnect from server:VimMCPReconnect- Reconnect to server
Contributing
I'm still figuring out how to make this to be more useful. If you have ideas, please feel free to submit a PR!
來源:README.md,提交 1fc01b4
工具
0版本歷史
1- v0.1.2最新Sep 16, 2026
評分
已滿足適用檢查項的 40%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分
請在儲存庫或註冊中心條目中宣告授權條款。