A comprehensive Neovim plugin that brings Cursor IDE-like AI functionality to your terminal-based development workflow.
- π€ AI Chat Interface - Interactive AI chat like Cursor IDE's sidebar
- βοΈ Intelligent Code Editing - AI-powered code modifications with diff preview
- π Code Generation - Generate code from natural language descriptions
- π Code Explanation - Understand complex code blocks with AI explanations
- π Code Review - Automated code review suggestions
- β‘ Code Optimization - Performance and readability improvements
- π§ Error Fixing - Automated bug detection and fixes
- π Smart Refactoring - Context-aware refactoring with interactive menu
- β±οΈ Streaming Responses - Real-time AI responses with proper timeout handling
- π― Context Awareness - Automatically includes file type and project context
- Neovim 0.5.0+ (required for Lua support)
- Cursor CLI - Install with:
curl https://cursor.com/install -fsS | bash
- Cursor Account - Sign up at cursor.com and authenticate:
cursor-agent login
Using vim-plug
Plug 'your-username/cursor-nvim-plugin'
Using packer.nvim
use 'your-username/cursor-nvim-plugin'
Using lazy.nvim
{
'your-username/cursor-nvim-plugin',
config = function()
-- Optional configuration
end,
}
git clone https://github.com/your-username/cursor-nvim-plugin.git ~/.config/nvim/pack/plugins/start/cursor-nvim-plugin
Command | Description |
---|---|
:CursorChat |
Open AI chat interface |
:CursorEdit |
Edit selected code with AI |
:CursorGenerate |
Generate code from description |
:CursorExplain |
Explain selected code |
:CursorReview |
Review current file |
:CursorOptimize |
Optimize selected code |
:CursorFix |
Fix errors in code |
:CursorRefactor |
Smart refactor menu |
:CursorTest |
Test CLI connection |
:CursorStatus |
Check CLI status |
Add these to your init.vim
or init.lua
:
" Cursor CLI mappings
nmap <leader>cc :CursorChat<CR>
nmap <leader>ce :CursorEdit<CR>
vmap <leader>ce :CursorEdit<CR>
nmap <leader>cg :CursorGenerate<CR>
vmap <leader>cx :CursorExplain<CR>
nmap <leader>cr :CursorReview<CR>
vmap <leader>co :CursorOptimize<CR>
vmap <leader>cf :CursorFix<CR>
vmap <leader>crf :CursorRefactor<CR>
:CursorChat
" Ask: "How do I optimize this React component for performance?"
" Select code in visual mode, then:
:CursorEdit
" Instruction: "Add error handling and validation"
" Write a comment like: // function to validate email addresses
" Position cursor on the line, then:
:CursorGenerate
" Select complex code in visual mode:
:CursorExplain
" Select code to refactor:
:CursorRefactor
" Choose from: Extract function, Rename variables, Add comments, etc.
" Cursor CLI command (default: 'cursor-agent')
let g:cursor_cli_command = 'cursor-agent'
" Default AI model (default: 'sonnet-4')
let g:cursor_cli_model = 'sonnet-4'
sonnet-4
(default)sonnet-4-thinking
gpt-5
- And more (check
cursor-agent --help
for current models)
The plugin automatically provides context based on file type:
- Python:
.py
files - JavaScript:
.js
,.jsx
files - TypeScript:
.ts
,.tsx
files - And more...
:CursorStatus
:CursorTest
-
"Cursor CLI not found"
# Install Cursor CLI curl https://cursor.com/install -fsS | bash # Add to PATH (already handled by installer) echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc source ~/.zshrc
-
Authentication Issues
cursor-agent login cursor-agent status
-
Timeout Issues
- Try shorter prompts
- Check internet connection
- Verify Cursor account status
" Disable NERDCommenter default mappings to avoid conflicts
let g:NERDCreateDefaultMappings = 0
" Use custom mappings for comments
nmap ++ <plug>NERDCommenterToggle
vmap ++ <plug>NERDCommenterToggle
The plugin works alongside your existing LSP setup and provides complementary AI-powered functionality.
- GitHub Copilot: Works simultaneously
- ChatGPT.nvim: Use different key mappings
- Codeium: Compatible
CursorChat
- Interactive AI chatCursorEdit
- AI-powered code editingCursorGenerate
- Code generation from descriptionsCursorExplain
- Code explanation and documentationCursorReview
- Automated code reviewCursorOptimize
- Performance optimization suggestionsCursorFix
- Bug detection and fixingCursorRefactor
- Intelligent refactoring options
CursorStatus
- Check if Cursor CLI is availableCursorTest
- Test connection with simple prompt
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Cursor for the amazing AI-powered IDE and CLI
- Neovim community for the extensible editor
- All contributors and users of this plugin
- Cursor IDE - The AI-powered code editor
- ChatGPT.nvim - ChatGPT integration for Neovim
- copilot.vim - GitHub Copilot for Vim/Neovim
Bring the power of Cursor IDE to your Neovim workflow! π