Skip to content

feat: add nvim-tree and neotree integration #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jun 9, 2025
Prev Previous commit
Next Next commit
refactor: extract broadcast functions and add ClaudeCodeAdd command
- Extract broadcast_at_mention() for single file broadcasts
- Extract add_paths_to_claude() for batch operations with optional delays
- Refactor all existing handlers to use centralized functions
- Add ClaudeCodeAdd <file-path> command for direct file addition
- Remove verbose comments that describe "what" instead of "why"
- Add comprehensive documentation to README with examples
- Add 13 test cases covering command registration, validation, and functionality
- Maintain all existing functionality and test compatibility (164 tests passing)

Change-Id: I171dbc0bcc82d72c5c9a4f3d891a71fc3c814dbc
Signed-off-by: Thomas Kosiewski <[email protected]>
  • Loading branch information
ThomasK33 committed Jun 8, 2025
commit f5a87a974ec1aa89add8ab600364a76108da2e8c
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.PHONY: check format test clean

# Default target
all: check format
all: format check test

# Check for syntax errors
check:
Expand Down
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ That's it! For more configuration options, see [Advanced Setup](#advanced-setup)
- `:ClaudeCode` - Toggle the Claude Code terminal window
- `:ClaudeCodeSend` - Send current visual selection to Claude, or add files from tree explorer
- `:ClaudeCodeTreeAdd` - Add selected file(s) from tree explorer to Claude context (also available via ClaudeCodeSend)
- `:ClaudeCodeAdd <file-path>` - Add a specific file or directory to Claude context by path

### Tree Integration

Expand All @@ -98,6 +99,39 @@ This allows you to quickly add entire files to Claude's context for review, refa
- **Smart detection**: Automatically detects whether you're in nvim-tree or neo-tree
- **Error handling**: Clear feedback if no files are selected or if tree plugins aren't available

### Direct File Addition

The `:ClaudeCodeAdd` command allows you to add files or directories directly by path:

```vim
:ClaudeCodeAdd src/main.lua
:ClaudeCodeAdd ~/projects/myproject/
:ClaudeCodeAdd ./README.md
```

#### Features

- **Path completion**: Tab completion for file and directory paths
- **Path expansion**: Supports `~` for home directory and relative paths
- **Validation**: Checks that files and directories exist before adding
- **Flexible**: Works with both individual files and entire directories

#### Examples

```vim
" Add a specific file
:ClaudeCodeAdd src/components/Header.tsx

" Add an entire directory
:ClaudeCodeAdd tests/

" Add file in home directory
:ClaudeCodeAdd ~/.config/nvim/init.lua

" Add relative path
:ClaudeCodeAdd ../other-project/package.json
```

## How It Works

This plugin creates a WebSocket server that Claude Code CLI connects to, implementing the same protocol as the official VS Code extension. When you launch Claude, it automatically detects Neovim and gains full access to your editor.
Expand Down
Loading