A Neovim plugin that connects to Claude Code CLI through the MCP Neovim server, enabling AI-powered code assistance directly in your editor.
- Neovim 0.8+
- Node.js and npm
- Claude Code CLI
- Git
Follow the official installation guide at https://claude.ai/code
Using lazy.nvim:
{
"jeremiahsmithdev/claude-cli.nvim",
config = function()
require("claude-cli").setup({
socket_path = "/tmp/nvim",
auto_start_server = false,
})
end,
}Using packer.nvim:
use {
"jeremiahsmithdev/claude-cli.nvim",
config = function()
require("claude-cli").setup()
end,
}-
Configure MCP server:
claude mcp add "MCP Neovim Server" -e NVIM_SOCKET_PATH=/tmp/nvim -- npx -y mcp-neovim-server -
Start Neovim with socket:
nvim --listen /tmp/nvim
-
Start Claude CLI in a tmux session:
tmux new-session -s claude-cli claude
Important: The plugin requires Claude CLI to be running in a tmux session for
:ClaudeSendto work properly.
:ClaudeConnect- Connect to the MCP server:ClaudeDisconnect- Disconnect from the MCP server:ClaudeStatus- Check connection status:ClaudeSend <message>- Send a message directly to Claude CLI and automatically submit it- Requires Claude CLI to be running in a tmux session
- Messages are automatically submitted after a 0.1s delay
- Example:
:ClaudeSend How do I implement a binary search?
Connect to Claude CLI:
:ClaudeConnect
:ClaudeStatusSend a message to Claude:
:ClaudeSend What is the time complexity of this algorithm?
:ClaudeSend Explain how this React hook works
:ClaudeSend Help me debug this error messageDisconnect when done:
:ClaudeDisconnectThe message will appear in your Claude CLI terminal and be automatically submitted.
require("claude-cli").setup({
-- Currently no configuration is needed for basic functionality
-- The plugin will automatically find your Claude CLI tmux session
})Step 1: Ensure Claude CLI is running in tmux
tmux list-sessions | grep claudeYou should see a session with "claude" in the name.
Step 2: Verify Claude CLI is the active process
tmux list-panes -a -F '#{session_name}:#{window_index}.#{pane_index} #{pane_current_command}' | grep claudeLook for a pane running node (the Claude CLI process).
Step 3: Test manual message sending
tmux send-keys -t <session>:<pane> "test message" EnterReplace <session>:<pane> with your Claude CLI session and pane.
"Claude CLI process not found" error:
- Make sure Claude CLI is running in a tmux session
- The session name should contain "claude" (e.g.,
claude-cli,claude-session)
Messages appear but don't submit:
- The plugin uses a 0.1s delay between typing and submission
- If messages still don't submit, try increasing the delay in the code
Nothing happens when using :ClaudeSend:
- Check that tmux is installed:
which tmux - Ensure you started Claude CLI inside tmux, not in a regular terminal
This repository includes .claude/settings.local.json with commonly used MCP permissions for developing this plugin with Claude Code. These permissions allow Claude to:
- Read and edit Neovim buffers
- Execute Vim commands
- Send tmux commands (essential for ClaudeSend functionality)
- Open, search, and save files in Neovim
To contribute or modify the plugin:
- Clone the repository
- Make your changes
- Test with a local Neovim setup
- Submit a pull request
- Edit Neovim buffers from Claude CLI
- Send and submit messages from Neovim to Claude CLI
- Automatic diff views
- Answer Claude prompts from Neovim
- Send entire buffers to Claude CLI
Curious about the journey of implementing the :ClaudeSend command? Read The Tale of the Delayed Enter Key - a whimsical story about our adventures in terminal automation and the discovery of the 0.1-second solution.
MIT License