-
Notifications
You must be signed in to change notification settings - Fork 21
feat: make diff keymaps adjustable via LazyVim spec #47
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
Conversation
- 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 <2198487+ThomasK33@users.noreply.github.com> Signed-off-by: Thomas Kosiewski <tk@coder.com>
- Remove hardcoded keymaps from diff.lua - Add diff keymaps to LazyVim specs in README.md and dev-config.lua - Update documentation to reflect LazyVim spec configuration approach - Provide clear examples for customizing diff keymaps - Maintain backward compatibility with default <leader>da and <leader>dq This allows users to easily customize or disable diff keymaps by modifying their LazyVim plugin configuration instead of needing to override hardcoded keymaps. Co-authored-by: ThomasK33 <2198487+ThomasK33@users.noreply.github.com> Signed-off-by: Thomas Kosiewski <tk@coder.com>
Fixes #44 - test failures were caused by missing vim.b mock in test environment. Changes: - Add vim.b metatable mock to handle buffer-local variables in tests - Update dev config diff keymaps to avoid conflicts (<leader>aa/<leader>ad) - Remove outdated keymap comments from diff.lua - Fix minor formatting issues in README.md Tests now pass: 278 successes / 0 failures / 0 errors Change-Id: I3af59441d9940869e3ed0f7566a09892908bd16b Signed-off-by: Thomas Kosiewski <tk@coder.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors diff keymaps to be user-configurable via the LazyVim spec instead of hardcoded mappings, adds dedicated user commands for accepting or rejecting diffs, updates test mocks, and refreshes documentation.
- Introduce
ClaudeCodeDiffAccept
andClaudeCodeDiffDeny
user commands - Remove buffer-local hardcoded
<leader>da
/<leader>dq
mappings and move them into the LazyVim spec - Update test mocks (
vim.b
) and documentation with examples and default keymaps
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
tests/mocks/vim.lua | Add vim.b buffer-local variable support for diff context tests |
lua/claudecode/init.lua | Register new diff management user commands |
lua/claudecode/diff.lua | Remove hardcoded keymaps, store diff context in buffer variables; implement command handlers |
dev-config.lua | Example dev config with non-conflicting <leader>aa /<leader>ad mappings |
README.md | Update default keymap examples and add customization instructions |
Comments suppressed due to low confidence (3)
README.md:144
- Remove the stray commented-out line (
-- **
da**
) to avoid confusion and keep the markdown clean.
- **`:w` (save)** - Accept the changes and apply them to your file
README.md:175
- [nitpick] Align this example with the
dev-config.lua
example or vice versa—use consistent key names (eitheraa/ad
orya/yn
) across documentation and configuration samples.
{ "<leader>ya", "<cmd>ClaudeCodeDiffAccept<cr>", desc = "Accept diff" },
lua/claudecode/diff.lua:891
- Add unit tests for
accept_current_diff()
anddeny_current_diff()
to verify buffer-local context storage and warning behavior when no diff is active.
function M.accept_current_diff()
This release includes significant feature additions and bug fixes: **Version Updates:** - Updated main version table in lua/claudecode/init.lua (0.1.0-alpha → 0.2.0) - Updated client versions in scripts/claude_interactive.sh (3 locations) - Updated ClaudeCodeNvim version in scripts/lib_claude.sh - Removed prerelease flag for stable release **Documentation:** - Added comprehensive CHANGELOG.md with v0.2.0 release notes - Documented all merged PRs since v0.1.0 with proper references - Updated CLAUDE.md with detailed release process documentation - Fixed diff keymap references in README.md (<leader>da → <leader>aa) **Features Added (since v0.1.0):** - Diagnostics integration (#34) - File explorer support for oil.nvim, nvim-tree, neotree (#27, #22) - Enhanced terminal management with ClaudeCodeFocus command (#40) - Auto terminal provider detection (#36) - Customizable diff keymaps via LazyVim spec (#47) **Bug Fixes:** - Terminal focus errors when buffer hidden (#43) - Improved diff acceptance behavior (#41) - Fixed syntax highlighting in proposed diff view (#32) - Visual selection range handling improvements (#26) - Native terminal bufhidden behavior (#39) All code quality checks pass and documentation is updated for maintainability. Change-Id: I0e4e7c9bae98df922356dc8b8aa0acd7e8293a48 Signed-off-by: Thomas Kosiewski <tk@coder.com>
This release includes significant feature additions and bug fixes: **Version Updates:** - Updated main version table in lua/claudecode/init.lua (0.1.0-alpha → 0.2.0) - Updated client versions in scripts/claude_interactive.sh (3 locations) - Updated ClaudeCodeNvim version in scripts/lib_claude.sh - Removed prerelease flag for stable release **Documentation:** - Added comprehensive CHANGELOG.md with v0.2.0 release notes - Documented all merged PRs since v0.1.0 with proper references - Updated CLAUDE.md with detailed release process documentation - Fixed diff keymap references in README.md (<leader>da → <leader>aa) **Features Added (since v0.1.0):** - Diagnostics integration (#34) - File explorer support for oil.nvim, nvim-tree, neotree (#27, #22) - Enhanced terminal management with ClaudeCodeFocus command (#40) - Auto terminal provider detection (#36) - Customizable diff keymaps via LazyVim spec (#47) **Bug Fixes:** - Terminal focus errors when buffer hidden (#43) - Improved diff acceptance behavior (#41) - Fixed syntax highlighting in proposed diff view (#32) - Visual selection range handling improvements (#26) - Native terminal bufhidden behavior (#39) All code quality checks pass and documentation is updated for maintainability. Change-Id: I0e4e7c9bae98df922356dc8b8aa0acd7e8293a48 Signed-off-by: Thomas Kosiewski <tk@coder.com>
Summary
This implements adjustable diff keymaps by moving them from hardcoded buffer-local keymaps to the LazyVim spec configuration, allowing users to customize or disable diff handling keymaps that may conflict with debugger mappings.
Key Changes
ClaudeCodeDiffAccept
andClaudeCodeDiffDeny
to provide the underlying diff functionality<leader>da
/<leader>dq
vim.b
mock to resolve test failures when diff operations store buffer-local variables<leader>aa
/<leader>ad
) as an exampleUsage
Users can now customize like this:
Or disable entirely by omitting the keymaps from their configuration.
Closes #44