A community-driven Neovim bridge plugin for Claude Code CLI, providing seamless integration between your editor and Claude's AI capabilities.
๐ Love this plugin? Give it a star! It really helps others discover it and motivates development.
This is a lightweight bridge that connects Neovim with Claude Code CLI. It's a personal project I built to scratch my own itch, and I'm sharing it in case others find it useful too!
- ๐ Send prompts to Claude directly from Neovim
- ๐ Automatic file change detection and buffer reloading
- ๐ Visual selection support for targeted assistance
- ๐ File context inclusion with prompts
- ๐ Real-time file watching for Claude's modifications
- ๐ฅ๏ธ Terminal integration - Run Claude in a split terminal
- ๐ฌ Beautiful popup windows for Claude responses
Make sure you have:
- Neovim 0.5+ (because who doesn't love modern Neovim?)
- Claude Code CLI installed (
npm install -g @anthropic-ai/claude-code
) - Your
ANTHROPIC_API_KEY
environment variable set
Pick your favorite plugin manager:
lazy.nvim (recommended)
{
"avifenesh/claucode.nvim",
config = function()
require("claucode").setup({
-- your configuration (or just use defaults, they're pretty good!)
})
end,
}
packer.nvim
use {
"avifenesh/claucode.nvim",
config = function()
require("claucode").setup({
-- your configuration
})
end
}
That's it! No complex setup, no heavy dependencies. Just a simple bridge that gets out of your way.
require("claucode").setup({
-- Claude Code CLI command (default: "claude")
-- Use full path if claude is not in your PATH
command = "claude", -- or "/home/username/.claude/local/claude"
-- Auto-start file watcher on setup
auto_start_watcher = true,
-- Enable default keymaps
keymaps = {
enable = true,
prefix = "<leader>ai", -- AI prefix to avoid conflicts
},
-- File watcher settings
watcher = {
debounce = 100, -- milliseconds
ignore_patterns = { "%.git/", "node_modules/", "%.swp$", "%.swo$" },
},
-- Bridge settings
bridge = {
timeout = 30000, -- milliseconds
max_output = 1048576, -- 1MB
},
-- UI settings
ui = {
diff = {
width = 0.8,
height = 0.8,
border = "rounded",
},
},
})
:Claude <prompt>
- Send a prompt to Claude (shows response in popup):Claude --file <prompt>
- Include current file context with prompt:ClaudeStop
- Stop Claude Code bridge and file watcher:ClaudeStart
- Start file watcher:ClaudeReview
- Review pending changes from Claude:ClaudeTerminal [cli_args]
- Open Claude in a terminal split with optional CLI parameters:ClaudeTerminalToggle
- Toggle Claude terminal visibility:ClaudeTerminalSend <text>
- Send text to Claude terminal
With default prefix <leader>ai
:
Normal mode:
<leader>aic
- Send prompt to Claude<leader>aif
- Send current file to Claude for review<leader>aie
- Explain code (selection or file)<leader>aix
- Fix issues in code<leader>ait
- Generate tests<leader>air
- Review pending changes<leader>aio
- Open Claude terminal<leader>aiT
- Toggle Claude terminal
Visual mode:
- Select text then
<leader>aic
- Send selection with prompt - Select text then
<leader>aiT
- Send selection to terminal
" Ask Claude a question
:Claude How do I implement a binary search in Lua?
" Review current file
:Claude --file Please review this code and suggest improvements
" Visual mode: select code and ask for explanation
" Select code in visual mode, then:
:Claude Explain this code
" Fix issues in current file
:Claude --file Fix any bugs or issues in this file
" Open Claude terminal with CLI parameters
:ClaudeTerminal --continue
:ClaudeTerminal --mcp-config ../.mcp.json
:ClaudeTerminal --continue --mcp-config ../.mcp.json
Let's be super clear about what you're getting:
This plugin IS:
- ๐ A simple bridge between Neovim and Claude Code CLI
- ๐จ A way to send prompts without leaving your editor
- ๐ A file watcher that keeps your buffers in sync
- ๐ฏ Focused on doing one thing well
This plugin is NOT:
- ๐ค An AI implementation (that's Claude's job)
- ๐ฎ A Copilot replacement
- ๐จ A feature-packed AI suite
- ๐จโ๐ผ A professionally maintained product with SLAs
It's literally just a bridge. Claude does the AI stuff, this plugin just helps you talk to it from Neovim. Simple as that!
- Ensure Claude Code CLI is installed:
npm install -g @anthropic-ai/claude-code
- Verify API key is set:
echo $ANTHROPIC_API_KEY
- Test Claude directly:
claude -p "test"
- If "Claude Code CLI not found" error:
- Find where claude is installed:
which claude
in your terminal - Update your config with the full path:
require("claucode").setup({ command = "/full/path/to/claude", -- e.g., "/home/user/.claude/local/claude" })
- Or ensure Neovim inherits your PATH by starting it from your shell
- Find where claude is installed:
- Check if files match ignore patterns
- Ensure proper file permissions
- Try manual reload with
:ClaudeStop
then:ClaudeStart
- Adjust
watcher.debounce
for faster/slower file detection - Increase
bridge.timeout
for longer operations - Check
bridge.max_output
if responses are truncated
Feel free to open an issue! Even better, if you've got a fix, I'd love to see a PR.
Got a cool idea? Here's the thing - this is a side project I maintain in my spare time, so I can't promise I'll implement every request. But here's what you can do:
- Open an issue describing your idea
- If I think it's cool and fits the project, I'll probably add it when I get time
- Even better: Fork the repo and implement it yourself! I'm happy to review PRs for features that align with the plugin's goals
Remember: The best features often come from contributors who needed them and built them. That's the beauty of open source! ๐
If this plugin saves you time or makes your workflow better:
- โญ Star the repo - It helps others find it and honestly makes my day
- ๐ฌ Share your experience - Drop a note in Issues about how you use it
- ๐ Report bugs - Help make it better for everyone
- ๐ง Contribute code - PRs for bug fixes are always welcome
This plugin follows the Unix philosophy: do one thing well. It's a bridge, not a replacement for Claude Code. It aims to be:
- Lightweight - Minimal dependencies, fast startup
- Focused - Just the bridge functionality, nothing more
- Reliable - If it works for my daily workflow, it should work for yours
This is provided as-is, with no guarantees. It works great for me, and I hope it works for you too! If something's broken, let's fix it together.
MIT - Do whatever you want with it, just don't blame me if something goes wrong ๐