A comprehensive Neovim plugin that transforms your coding experience with Claude AI's advanced capabilities. Get intelligent code suggestions, automated debugging, security analysis, test generation, and sophisticated refactoringβall seamlessly integrated into your Neovim workflow.
π― Competitive with Cursor AI - Featuring agentic workflows, multi-file editing, background processing, and advanced context understanding.
- π― Smart Code Completion - Context-aware completions with deep codebase understanding
- β‘ Function Generation - Create complete functions from natural language descriptions
- π TODO Implementation - Automatically implement TODO comments with proper code
- π‘ Code Explanation - Get detailed explanations of complex code structures
- 𧬠Multi-file Context - Generate code that understands your entire project structure
- π Error Analysis - Deep error message analysis with intelligent explanations
- π― Fix Suggestions - Get specific, actionable solutions for code issues
- π Stack Trace Analysis - Comprehensive stack trace interpretation with root cause detection
- π§ Performance Debugging - Identify bottlenecks and optimization opportunities
β οΈ Security Vulnerability Scanning - OWASP Top 10 and security best practice checks
- π‘οΈ Security Analysis - Identify vulnerabilities with severity levels and fixes
- β‘ Performance Review - Algorithm complexity and optimization suggestions
- ποΈ Architecture Analysis - Design patterns and structural improvements
- π Code Quality - Maintainability, readability, and best practice compliance
- π Dependency Analysis - Import/export relationship understanding
- π― Test Generation - Comprehensive unit tests with edge cases and assertions
- π Mock Objects - Generate appropriate mocks with configurable behaviors
- π Coverage Analysis - Identify untested code paths and suggest test cases
- π Integration Tests - Support for end-to-end test scaffolding
- π Performance Tests - Generate benchmarking and load test scenarios
- π Extract Methods/Classes - Smart extraction with meaningful naming
- β‘ Algorithm Optimization - Performance improvements and complexity reduction
- π Intelligent Renaming - Context-aware variable and function renaming
- ποΈ Architecture Refactoring - Dependency injection and design pattern application
- π¨ Code Style Improvements - Language-specific conventions and formatting
- π₯ Multi-Agent Support - Run multiple AI tasks concurrently
- π Plan Mode - Generate and execute structured development plans
- β° Background Agents - Long-running tasks with progress tracking
- π Task Queue Management - Prioritize and manage AI operations
- π§ Agent Communication - Context sharing between different AI agents
- π― Persistent Sidebar - Cursor-style chat panel that stays open
- π File Context Awareness - Automatically includes current file context
- πΎ Chat History - Persistent conversation history with threading
- β¨οΈ Quick Toggle - Simple keymap to show/hide panel
- π Live Context Updates - Context updates automatically when switching files
- Install the plugin using your favorite package manager
- Set your API key:
export ANTHROPIC_API_KEY="your-key" - Configure the plugin:
require('claude-code').setup({}) - Start coding with AI assistance!
-- Minimal setup
require('claude-code').setup({
api = { key = vim.env.ANTHROPIC_API_KEY }
})- Neovim 0.8.0+ (0.9.0+ recommended)
- Anthropic API key or Claude CLI installed
- curl for API requests
- Git for installation
Using lazy.nvim β Recommended
{
'username/claude-code.nvim',
event = "VeryLazy", -- Load on demand for better startup time
dependencies = {
"nvim-lua/plenary.nvim", -- Required for async operations
},
config = function()
require('claude-code').setup({
api = {
key = vim.env.ANTHROPIC_API_KEY, -- Secure: use environment variable
model = "claude-3-5-sonnet-20241022", -- Latest model
},
features = {
completion = { enabled = true },
code_review = { enabled = true },
debugging = { enabled = true },
}
})
end,
}Using packer.nvim
use {
'claude-code.nvim',
config = function()
require('claude-code').setup({
api = {
key = vim.env.ANTHROPIC_API_KEY,
}
})
end
}Using vim-plug
Plug 'claude-code.nvim'Then in your init.lua:
require('claude-code').setup({
api = {
key = vim.env.ANTHROPIC_API_KEY,
}
})- Sign up at Anthropic Console
- Navigate to API Keys section
- Create a new API key
- Copy your key (starts with
sk-ant-api03-...)
# Add to your ~/.zshrc or ~/.bashrc
export ANTHROPIC_API_KEY="sk-ant-api03-your-key-here"
# Reload your shell
source ~/.zshrcrequire('claude-code').setup({
api = {
key = "sk-ant-api03-your-key-here", -- Your actual API key
model = "claude-3-5-sonnet-20241022", -- Latest Claude 3.5 Sonnet
max_tokens = 8192, -- Maximum tokens (Claude 3.5 limit)
temperature = 0.1, -- Lower for more deterministic code generation
base_url = "https://api.anthropic.com/v1", -- Anthropic API endpoint
}
})| Model | ID | Context Window | Best For |
|---|---|---|---|
| Claude 3.5 Sonnet | claude-3-5-sonnet-20241022 |
200K tokens | Recommended - Best balance of intelligence and speed |
| Claude 3.5 Haiku | claude-3-5-haiku-20241022 |
200K tokens | Fastest responses, good for simple tasks |
| Claude 3 Opus | claude-3-opus-20240229 |
200K tokens | Most capable, best for complex reasoning |
π‘ Tip: Claude 3.5 Sonnet is recommended for most coding tasks as it provides excellent code quality with fast response times.
require('claude-code').setup({
features = {
completion = {
enabled = true,
trigger_length = 2,
max_context_lines = 100,
debounce_ms = 500,
},
code_writing = {
enabled = true,
include_type_hints = true,
include_docstrings = true,
include_error_handling = true,
},
debugging = {
enabled = true,
explain_errors = true,
suggest_fixes = true,
analyze_stack_trace = true,
},
code_review = {
enabled = true,
check_security = true,
check_performance = true,
check_maintainability = true,
max_file_size = 10000, -- lines
},
testing = {
enabled = true,
generate_edge_cases = true,
include_mocks = true,
},
refactoring = {
enabled = true,
extract_methods = true,
optimize_algorithms = true,
improve_naming = true,
},
},
-- Chat panel configuration
chat_panel = {
enabled = true,
width = 50, -- Panel width in columns
position = "right", -- "left" or "right"
auto_close = false, -- Auto-close after sending
show_context_info = true, -- Show file context
max_history = 50, -- Max chat history entries
keymaps = {
toggle = "<leader>cp", -- Toggle panel
send = "<CR>", -- Send message
cancel = "<Esc>", -- Cancel input
clear_history = "<leader>cc", -- Clear history
},
}
})require('claude-code').setup({
ui = {
float_border = "rounded", -- "none", "single", "double", "rounded", "solid", "shadow"
float_width = 0.8,
float_height = 0.6,
progress_indicator = true,
syntax_highlighting = true,
}
})require('claude-code').setup({
keymaps = {
commands = {
-- Code writing
write_function = "<leader>cf",
implement_todo = "<leader>ci",
explain_code = "<leader>ce",
-- Debugging
debug_error = "<leader>cd",
analyze_stack = "<leader>cs",
suggest_fix = "<leader>cx",
-- Code review
review_code = "<leader>cr",
review_file = "<leader>cR",
security_check = "<leader>cS",
-- Testing
generate_tests = "<leader>ct",
generate_mocks = "<leader>cm",
-- Refactoring
refactor_extract = "<leader>re",
refactor_optimize = "<leader>ro",
-- General
claude_chat = "<leader>cc",
claude_help = "<leader>ch",
},
}
})| Command | Description | Keybinding |
|---|---|---|
:ClaudeWriteFunction |
Generate function from description | <leader>cw |
:ClaudeImplementTodo |
Implement TODO comment | <leader>ci |
:ClaudeExplainCode |
Explain selected code | <leader>ce |
| Command | Description | Keybinding |
|---|---|---|
:ClaudeDebugError |
Debug error message | <leader>cd |
:ClaudeAnalyzeStack |
Analyze stack trace | <leader>cs |
:ClaudeSuggestFix |
Suggest fix for code issue | <leader>cf |
| Command | Description | Keybinding |
|---|---|---|
:ClaudeReviewCode |
Review selected code | <leader>cr |
:ClaudeReviewFile |
Review entire file | <leader>cR |
:ClaudeSecurityCheck |
Security vulnerability check | <leader>cS |
| Command | Description | Keybinding |
|---|---|---|
:ClaudeGenerateTests |
Generate tests for selected code | <leader>ct |
:ClaudeGenerateMocks |
Generate mock objects | <leader>cm |
:ClaudeTestCoverage |
Test coverage analysis | <leader>cC |
| Command | Description | Keybinding |
|---|---|---|
:ClaudeRefactorExtract |
Extract method/class | <leader>re |
:ClaudeRefactorOptimize |
Optimize code | <leader>ro |
:ClaudeRefactorRename |
Intelligent rename suggestions | <leader>rn |
| Command | Description | Keybinding |
|---|---|---|
:ClaudeChatPanel |
Toggle persistent chat panel | <leader>cp |
:ClaudeClearHistory |
Clear chat panel history | - |
| Command | Description | Keybinding |
|---|---|---|
:ClaudeChat |
Open Claude Code chat | <leader>cc |
:ClaudeHelp |
Show help | <leader>ch |
:ClaudeStatus |
Show plugin status | - |
:ClaudeToggleCompletion |
Toggle code completion | - |
- Use
:ClaudeWriteFunctionor<leader>cw - Describe what you want: "Create a binary search function that takes a sorted array and target value"
- Claude Code will generate a complete, well-documented function with error handling
- Place cursor on or near a TODO comment:
# TODO: Add input validation for email addresses - Use
:ClaudeImplementTodoor<leader>ci - Claude Code will implement the validation logic
- Select code or use entire file
- Use
:ClaudeReviewCodeor<leader>cr - Get comprehensive feedback on security, performance, and maintainability
- Use
:ClaudeDebugErroror<leader>cd - Paste your error message
- Get detailed analysis and specific solutions
- Select a function or method
- Use
:ClaudeGenerateTestsor<leader>ct - Get comprehensive tests including edge cases
- Press
<leader>cpto toggle the chat panel - Press
i,a, oroin the panel to start typing a message - Press
<CR>to send your message to Claude - Chat history persists across sessions
- File context is automatically included with each message
- Press
qto close the panel
- Beautiful floating windows with rounded borders
- Syntax highlighting for code responses
- Easy navigation with
qto close,yto copy content
- Animated loading spinners during AI processing
- Progress indicators for long-running operations
- Cancellable requests with
<Esc>
- Direct code application with
<CR>orakey - Smart code insertion at cursor position
- Undo-friendly operations
# Check if API key is set and valid format
echo $ANTHROPIC_API_KEY
# Should start with: sk-ant-api03-
# Set API key temporarily
export ANTHROPIC_API_KEY="sk-ant-api03-your-key-here"
# Check plugin status
:ClaudeStatus
# Test API connection
:checkhealth claude_codeCommon API Key Problems:
- β Wrong format: Ensure key starts with
sk-ant-api03- - β Expired key: Check Anthropic Console for key status
- β Insufficient credits: Verify your account has available credits
- β Rate limits: Wait a moment if you're hitting rate limits
- Reduce
max_context_linesin completion settings - Increase
debounce_msfor completion - Disable features you don't use
- Check
:ClaudeStatusfor configuration issues - Ensure you have
curlinstalled - Verify internet connectivity
- Context Management: Use smaller
max_context_linesfor faster responses - Feature Toggling: Disable unused features to reduce memory usage
- Request Batching: Group related operations together
- Caching: Responses are cached automatically for repeated queries
# Store API key securely in your shell profile
echo 'export ANTHROPIC_API_KEY="sk-ant-api03-your-key-here"' >> ~/.zshrc
# Or use a secrets manager (recommended for teams)
echo 'export ANTHROPIC_API_KEY=$(pass anthropic/api-key)' >> ~/.zshrc
# Or use macOS Keychain
echo 'export ANTHROPIC_API_KEY=$(security find-generic-password -s "anthropic-api" -w)' >> ~/.zshrc
# For development, use .env files (add to .gitignore!)
echo 'ANTHROPIC_API_KEY=sk-ant-api03-your-key-here' > .env
echo '.env' >> .gitignore- π« Never commit API keys to version control
- π Use environment variables instead of hardcoding
- π Rotate keys regularly for better security
- π Monitor usage in Anthropic Console
| Feature | Claude Code Neovim | Cursor AI |
|---|---|---|
| Multi-Agent Workflows | β Concurrent agents | β Up to 8 agents |
| Plan Mode | β Structured dev plans | β Editable plans |
| Background Processing | β Long-running tasks | β Isolated environments |
| Context Understanding | β Deep codebase analysis | β Project-wide context |
| Security Analysis | β OWASP Top 10 + custom | β General security |
| Test Generation | β Edge cases + mocks | β Basic test generation |
| Refactoring | β Advanced patterns | β Basic refactoring |
| Cost | π Open Source | π° Paid tiers |
| Customization | β Highly configurable | |
| Vim Integration | β Native Neovim | β VS Code fork only |
# Install dependencies
make install
# Run tests
make test
# Run with coverage
make test-coverage
# Lint code
make lint
# Format code
make format# Clone the repository
git clone https://github.com/username/claude-code.nvim.git
cd claude-code.nvim
# Install development dependencies
make install
# Run tests in watch mode
make test-watchWe welcome contributions! Please see our Contributing Guide for details.
- Fork the repository
- Create a feature branch:
git checkout -b amazing-feature - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin amazing-feature - Open a Pull Request
- π Bug fixes and stability improvements
- π Documentation and tutorials
- π§ͺ Test coverage expansion
- π Internationalization support
- β‘ Performance optimizations
- π¨ UI/UX improvements
- Q1 2026: Multi-modal support (images, voice)
- Q2 2026: Local model support (Ollama integration)
- Q3 2026: Team collaboration features
- Q4 2026: Plugin ecosystem and extensions
- π Documentation: Full docs
- π Issues: GitHub Issues
- π¬ Discussions: GitHub Discussions
- π Email: maintainers@example.com
MIT License - see LICENSE file for details.
- Anthropic for the amazing Claude AI
- Neovim community for the excellent plugin ecosystem
- Cursor AI for inspiration on agentic workflows
- All contributors who make this project better
β Star us on GitHub if this plugin helps you code better! β
Made with β€οΈ by the Claude Code Neovim community
