You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add ClaudeCodeDiffAccept and ClaudeCodeDiffDeny user commands
- Add ClaudeCodeDiffAccept and ClaudeCodeDiffDeny user commands to init.lua
- Implement accept_current_diff() and deny_current_diff() functions in diff.lua
- Refactor keymaps to use new commands instead of inline functions
- Store diff context in buffer variables for command access
- Update README.md with new commands and customization examples
- Maintain backward compatibility with existing <leader>da and <leader>dq keymaps
Resolves issue #44 by allowing users to customize diff keymaps without conflicts
Co-authored-by: ThomasK33 <[email protected]>
Signed-off-by: Thomas Kosiewski <[email protected]>
Copy file name to clipboardExpand all lines: README.md
+14Lines changed: 14 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -88,6 +88,8 @@ That's it! For more configuration options, see [Advanced Setup](#advanced-setup)
88
88
-`:ClaudeCodeSend` - Send current visual selection to Claude, or add files from tree explorer
89
89
-`:ClaudeCodeTreeAdd` - Add selected file(s) from tree explorer to Claude context (also available via ClaudeCodeSend)
90
90
-`:ClaudeCodeAdd <file-path> [start-line] [end-line]` - Add a specific file or directory to Claude context by path with optional line range
91
+
-`:ClaudeCodeDiffAccept` - Accept the current diff changes (equivalent to `<leader>da`)
92
+
-`:ClaudeCodeDiffDeny` - Deny/reject the current diff changes (equivalent to `<leader>dq`)
91
93
92
94
### Toggle Behavior
93
95
@@ -155,6 +157,18 @@ When you reject changes, the diff view closes and the original file remains unch
155
157
156
158
You can also navigate to the Claude Code terminal window and accept or reject diffs directly from within Claude's interface. This provides an alternative way to manage diffs without using the Neovim-specific keymaps.
157
159
160
+
### Customizing Diff Keymaps
161
+
162
+
The default keymaps (`<leader>da` and `<leader>dq`) can be customized by remapping them to the underlying commands:
163
+
164
+
```lua
165
+
-- Example: Use different keymaps for diff handling
The commands `ClaudeCodeDiffAccept` and `ClaudeCodeDiffDeny` work only in diff buffers created by the plugin and will show a warning if used elsewhere.
171
+
158
172
### How It Works
159
173
160
174
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.
0 commit comments