From 84ba77a8fc4cb7f6a9d41a784ae19f70b5de6d8a Mon Sep 17 00:00:00 2001 From: NicolasGB Date: Tue, 18 Nov 2025 14:31:35 +0100 Subject: [PATCH] fix(log): Add u/r keymaps for undoing and redoing operations on log buffer. --- README.md | 9 ++++++++- lua/jj/cmd.lua | 8 +++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9fa8410..3d4e563 100644 --- a/README.md +++ b/README.md @@ -50,9 +50,16 @@ In your log ouptut press `CR` in a line to directly edit a `mutable` change. You can create new changes directly from the log buffer with multiple options: - `n` - Create a new change branching off the revision under the cursor -- `` - Create a new change after the revision under the cursor +- `` - Create a new change after the revision under the cursor - `` - Create a new change after while ignoring immutability constraints +### Undo/Redo from the log buffer + +You can undo/redo changes directly from the log buffer: + +- `u` - Undo the last operation +- `r` - Redo the last undone operation + ### Open a changed file Just press enter to open the a file from the `status` output in your current window. diff --git a/lua/jj/cmd.lua b/lua/jj/cmd.lua index 4e4c4f5..9d03e7b 100644 --- a/lua/jj/cmd.lua +++ b/lua/jj/cmd.lua @@ -590,6 +590,13 @@ local function run(cmd) register_command_keymap({ "n" }, "", function() handle_log_new("after", true) end, { desc = "New change after the change under cursor ignoring immutability" }) + -- Undo/Redo + register_command_keymap({ "n" }, "u", function() + M.undo() + end, { desc = "Undo last operation" }) + register_command_keymap({ "n" }, "r", function() + M.redo() + end, { desc = "Redo last operation" }) end if #new_command_keymaps > 0 then @@ -1132,4 +1139,3 @@ function M.register_command() end return M -