mirror of
https://github.com/zoriya/jj.nvim.git
synced 2026-08-05 02:36:07 +00:00
feat(log): Add change_revset keybind to change the current log revset
being displayed in the log command
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
- [View change summary from the log buffer](#view-change-summary-from-the-log-buffer)
|
||||
- [Diff any change](#diff-any-change)
|
||||
- [Diff revision history](#diff-revision-history)
|
||||
- [Change the log revset from the log buffer](#change-the-log-revset-from-the-log-buffer)
|
||||
- [Describe a change](#describe-a-change)
|
||||
- [Edit changes](#edit-changes)
|
||||
- [Create new changes from the log buffer](#create-new-changes-from-the-log-buffer)
|
||||
@@ -59,7 +60,7 @@
|
||||
- First class citizens with ui integration
|
||||
- `describe` / `desc` - Set change descriptions with a Git-style commit message editor
|
||||
- `status` / `st` - Show repository status
|
||||
- `log` - Display log history with configurable options
|
||||
- `log` - Display log history with configurable options and change the displayed revset from the log buffer
|
||||
- `diff` - Show changes with optional filtering by current file
|
||||
- `new` - Create a new change with optional parent selection
|
||||
- `edit` - Edit a change
|
||||
@@ -122,6 +123,14 @@ You can now open a history-aware diff between two revisions:
|
||||
|
||||
This is useful when you want to inspect the evolution of a stack or compare a revision range with commit history preserved instead of showing a single plain diff.
|
||||
|
||||
### Change the log revset from the log buffer
|
||||
|
||||
You can change which revset the log buffer is displaying without closing and reopening it:
|
||||
|
||||
- `<C-r>` - Prompt for a new revset and reload the log buffer with it
|
||||
|
||||
This is useful for quickly narrowing the log to something like `main::@`, `mutable()`, or any other revset while staying in the same log view.
|
||||
|
||||
### Describe a change
|
||||
|
||||
You can describe any change directly from the log buffer:
|
||||
@@ -492,6 +501,7 @@ The plugin also provides `:Jdiff`, `:Jvdiff`, and `:Jhdiff` commands for diffing
|
||||
quick_squash = "<S-s>", -- Quick squash revision under cursor into its parent (ignore immutability)
|
||||
split = "<C-s>", -- Split the revision under cursor
|
||||
history = "<S-h>", -- Show a history-aware diff for the selected revision range
|
||||
change_revset = "<C-r>", -- Change the revset(s) being viewed in the log buffer
|
||||
tag_create = "<S-t>", -- Create a tag on the revision under cursor
|
||||
summary = "<S-k>", -- Show summary tooltip for revision under cursor
|
||||
summary_tooltip = {
|
||||
|
||||
@@ -56,6 +56,7 @@ local split_module = require("jj.cmd.split")
|
||||
--- @field summary_tooltip? jj.cmd.summary_tooltip.keymaps
|
||||
--- @field tag_set? string|string[]
|
||||
--- @field history? string|string[]
|
||||
--- @field change_revset? string|string[]
|
||||
|
||||
--- @class jj.cmd.rebase.keymaps
|
||||
--- @field onto? string|string[]
|
||||
@@ -199,6 +200,7 @@ M.config = {
|
||||
split = "<C-s>",
|
||||
tag_set = "<S-t>",
|
||||
history = "<S-h>",
|
||||
change_revset = "<C-r>",
|
||||
},
|
||||
status = {
|
||||
open_file = "<CR>",
|
||||
|
||||
@@ -692,6 +692,15 @@ function M.handle_log_tag_set(revset)
|
||||
require("jj.cmd").tag_set(revset)
|
||||
end
|
||||
|
||||
--- Handle log change revset
|
||||
function M.handle_log_change_revset()
|
||||
vim.ui.input({ prompt = "Enter new revset: " }, function(input)
|
||||
if input and input ~= "" then
|
||||
M.log({ revisions = input })
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
--- Handle opening a PR/MR from `jj log` buffer for the revision under cursor
|
||||
--- @param list_bookmarks? boolean If true, prompt to select from all bookmarks instead of using current revision
|
||||
function M.handle_log_open_pr(list_bookmarks)
|
||||
@@ -1153,6 +1162,11 @@ function M.log_keymaps()
|
||||
handler = M.handle_log_history,
|
||||
modes = { "v" },
|
||||
},
|
||||
change_revset = {
|
||||
desc = "Change the revset(s) being viewed",
|
||||
handler = M.handle_log_change_revset,
|
||||
modes = { "n", "v" },
|
||||
},
|
||||
}
|
||||
|
||||
local merged_keymaps = cmd.merge_keymaps(cmd.resolve_keymaps_from_specs(keymaps, specs), cmd.terminal_keymaps())
|
||||
|
||||
Reference in New Issue
Block a user