Skip to content

fix: use signal-based diff acceptance instead of direct file writes #41

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 4 commits into from
Jun 14, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
docs: add diff acceptance/rejection options to README
- Document how to accept changes with :w and <leader>da
- Document how to reject changes with :q, <leader>dq, etc.
- Explain signal-based approach and buffer reloading
- Note that users can edit diff buffer before accepting
- Provide clear user guidance for diff workflows

Change-Id: Ic000567fafabecea06aa1ac95a5c5465a0290622
Signed-off-by: Thomas Kosiewski <tk@coder.com>
  • Loading branch information
ThomasK33 committed Jun 14, 2025
commit 0185e0c9428323ea3750de9cb999c75d60b6926c
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,31 @@ The `:ClaudeCodeAdd` command allows you to add files or directories directly by
- **Validation**: Checks that files and directories exist before adding, validates line numbers
- **Flexible**: Works with both individual files and entire directories

## Working with Diffs

When Claude proposes changes to your files, the plugin opens a native Neovim diff view showing the original file alongside the proposed changes. You have several options to accept or reject these changes:

### Accepting Changes

- **`:w` (save)** - Accept the changes and apply them to your file
- **`<leader>da`** - Accept the changes using the dedicated keymap

You can edit the proposed changes in the right-hand diff buffer before accepting them. This allows you to modify Claude's suggestions or make additional tweaks before applying the final version to your file.

Both methods signal Claude Code to apply the changes to your file, after which the plugin automatically reloads the affected buffers to show the updated content.

### Rejecting Changes

- **`:q` or `:close`** - Close the diff view to reject the changes
- **`<leader>dq`** - Reject changes using the dedicated keymap
- **`:bdelete` or `:bwipeout`** - Delete the diff buffer to reject changes

When you reject changes, the diff view closes and the original file remains unchanged.

### How It Works

The plugin uses a signal-based approach where accepting or rejecting a diff sends a message to Claude Code rather than directly modifying files. This ensures consistency and allows Claude Code to handle the actual file operations while the plugin manages the user interface and buffer reloading.

#### Examples

```vim
Expand Down