An open API service indexing awesome lists of open source software.

https://github.com/edo1z/claude-cli.nvim

Neovim plugin for seamless Claude Code CLI integration - AI-powered coding assistant in your editor
https://github.com/edo1z/claude-cli.nvim

claude-code nvim nvim-plugin

Last synced: 2 months ago
JSON representation

Neovim plugin for seamless Claude Code CLI integration - AI-powered coding assistant in your editor

Awesome Lists containing this project

README

          

# claude-cli.nvim

Seamlessly integrate Claude Code CLI into your Neovim workflow with multi-instance management.

*Read this in other languages: [ๆ—ฅๆœฌ่ชž](README.ja.md)*

https://github.com/user-attachments/assets/7a96fad4-ade7-4a7a-88b4-d7cb8a96f84a

## Features

- ๐Ÿค– **Embedded Claude Code Terminal** - Run Claude Code directly in Neovim
- ๐Ÿ“ **Smart Prompt Builder** - Compose prompts with snippets and history
- ๐Ÿ” **Context Awareness** - Send file paths, errors, and code selections
- โšก **Quick Actions** - Fast keybindings for common tasks
- ๐Ÿ’พ **Persistent Storage** - Save snippets and command history
- ๐Ÿ”„ **Auto-reload Files** - Automatically updates files modified by Claude Code
- ๐Ÿ”— **Session Continuation** - Continue from the last Claude Code session
- ๐ŸŽฏ **Multi-Instance Manager** - Manage up to 30 Claude Code instances simultaneously

## Requirements

- Neovim >= 0.8.0
- [Claude Code CLI](https://claude.ai/code) installed and configured
- tmux (for multi-instance manager)

## Installation

### Using [lazy.nvim](https://github.com/folke/lazy.nvim) (Recommended)

```lua
{
'edo1z/claude-cli.nvim',
config = function()
require('claude-cli').setup()
end,
}
```

### Using [vim-plug](https://github.com/junegunn/vim-plug)

```vim
Plug 'edo1z/claude-cli.nvim'
```

### Using [packer.nvim](https://github.com/wbthomason/packer.nvim)

```lua
use 'edo1z/claude-cli.nvim'
```

## Quick Start

### Basic Usage
1. Start new Claude Code session: `cc` (or `cd` for dangerous mode)
2. Continue from last session: `cC` (or `cD` for dangerous mode)
3. Open instance manager: `cm`

### Multi-Instance Manager
1. Open instance manager: `cm`
2. Add new instance: press `a` in the list view
3. Open specific instance: press `o` on any instance
4. Delete instance: press `d` on selected instance

### Send Context to Claude
- Open prompt builder: `ca`
- Send current error: `ce`
- Send file path: `cp`
- Send selection: `cs` (visual mode)

## Multi-Instance Manager

The multi-instance manager allows you to run multiple Claude Code sessions simultaneously:

### Key Features
- **Dynamic Management**: Start with 0 instances, add up to 30 as needed
- **tmux Integration**: Each instance runs in a separate tmux session
- **Process Isolation**: Instances are namespaced by Neovim process ID
- **Launch Options**: Choose from normal, continue (-c), and dangerous modes

### List View Keybindings
| Key | Action |
|-----|--------|
| `a` | Add new instance with options |
| `d` | Delete current instance (with confirmation) |
| `o` | Open instance in individual window |
| `r` | Restart instance |
| `q` | Close list view |
| `?` | Show help |
| `` | Exit terminal mode |

### Commands
- `:ClaudeManagerToggle` - Toggle instance list view
- `:ClaudeManagerShow` - Show instance list
- `:ClaudeManagerHide` - Hide instance list
- `:ClaudeManagerOpen [name]` - Open specific instance

## Prompt Builder

The prompt builder (`ca`) provides powerful prompt composition:

| Key | Action |
|-----|--------|
| `Ctrl+s` | Send to active Claude instance |
| `Ctrl+l` | Show snippets |
| `Ctrl+h` | Show history |
| `Ctrl+c` | Create snippet |
| `Esc` | Close prompt |

## Configuration

```lua
require('claude-cli').setup({
keymaps = {
-- Basic keymaps
toggle = "cc",
toggle_dangerous = "cd",
continue_session = "cC",
continue_session_dangerous = "cD",

-- Context actions
send_path = "cp",
send_error = "ce",
send_selection = "cs",
open_prompt = "ca",

-- Multi-instance manager
manager_toggle = "cm",
},
window = {
position = "right", -- right, left, bottom, top
size = 0.4, -- 40% of screen
},
snippets = {
-- Default snippets
Refactor = "ใ“ใฎใ‚ณใƒผใƒ‰ใ‚’ใƒชใƒ•ใ‚กใ‚ฏใ‚ฟใƒชใƒณใ‚ฐใ—ใฆใ€ใ‚ˆใ‚Š่ชญใฟใ‚„ใ™ใใ—ใฆใใ ใ•ใ„:\n",
Explain = "ใ“ใฎใ‚ณใƒผใƒ‰ใฎๅ‹•ไฝœใ‚’ๆ—ฅๆœฌ่ชžใง่ชฌๆ˜Žใ—ใฆใใ ใ•ใ„:\n",
FixError = "ไปฅไธ‹ใฎใ‚จใƒฉใƒผใ‚’ไฟฎๆญฃใ—ใฆใใ ใ•ใ„:\n",
AddTests = "ใ“ใฎใ‚ณใƒผใƒ‰ใซๅฏพใ™ใ‚‹ใƒ†ใ‚นใƒˆใ‚’ไฝœๆˆใ—ใฆใใ ใ•ใ„:\n",
Optimize = "ใ“ใฎใ‚ณใƒผใƒ‰ใฎใƒ‘ใƒ•ใ‚ฉใƒผใƒžใƒณใ‚นใ‚’ๆœ€้ฉๅŒ–ใ—ใฆใใ ใ•ใ„:\n",
}
})
```

## Commands

### Basic Commands
- `:ClaudeCode` - Start new Claude Code session
- `:ClaudeCodeDangerous` - Start with dangerous mode
- `:ClaudeCodeContinue` - Continue last session
- `:ClaudePrompt` - Open prompt builder

### Multi-Instance Manager
- `:ClaudeManagerToggle` - Toggle instance list
- `:ClaudeManagerShow` - Show instance list
- `:ClaudeManagerHide` - Hide instance list
- `:ClaudeManagerOpen` - Open specific instance

## Tips

1. **Active Instance**: When using multi-instance manager, `ca` sends to the active instance
2. **Quick Switch**: Use `cm` to quickly switch between instances
3. **Terminal Navigation**: Use `Ctrl+q` to exit terminal mode in instance list
4. **Auto-reload**: Files modified by Claude are automatically reloaded
5. **Process Isolation**: Each Neovim process has its own set of Claude instances

## License

MIT License - see [LICENSE](LICENSE) file for details.

## Contributing

Issues and PRs are welcome!

## Acknowledgments

Built for use with [Claude Code](https://claude.ai/code) by Anthropic.