Skip to content

Commit 1eee02b

Browse files
committed
improve: Add config option to change <cr> over hunks on commit_view
- New `commit_view.cr_on_hunk_jumps_to_current` option to interchange the behaviour of `<cr>` with the mapping for the `OpenFileInWorktree` command. - This allows to set `<cr>` as the mapping to jump to the current version of the file. - Defaulted to false, i.e., preserve default magit behaviour.
1 parent 40347fb commit 1eee02b

File tree

3 files changed

+247
-192
lines changed

3 files changed

+247
-192
lines changed

doc/neogit.txt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@ The following mappings can all be customized via the setup function.
392392
}
393393

394394
commit_view = {
395+
["<cr>"] = "OpenFileInCommit",
395396
["a"] = "OpenFileInWorktree",
396397
}
397398

@@ -2187,10 +2188,13 @@ Mappings (normal mode):
21872188
you to a wrong location in the file if the lines have been
21882189
moved around.
21892190

2190-
`<cr>` On a diff hunk, open the file contents from the commit in a
2191-
temporary read-only tab, or the parent revision for deleted
2192-
lines; on a filepath line, jump to that file's diff section
2193-
within the buffer.
2191+
`<cr>` (|neogit_setup_mappings|: "OpenFileInCommit" in commit_view)
2192+
When the cursor is on a diff hunk, opens the version of the
2193+
file as it exists in the commit in a temporary read-only
2194+
buffer (or the parent revision if the lines were deleted).
2195+
2196+
`<cr>` On a filepath line, jump to that file's diff section within
2197+
the buffer.
21942198

21952199
`o` Open the commit in the configured git service (requires
21962200
Neovim >= 0.10 for |vim.ui.open|).

0 commit comments

Comments
 (0)