feat(fugitive): line position tracking for keymaps#70
Merged
barrettruth merged 1 commit intomainfrom Feb 5, 2026
Merged
Conversation
When pressing `du`/`dU` from a hunk line in the fugitive status buffer (after expanding with `=`), the unified diff now opens at the corresponding line instead of line 1. Implementation: - `fugitive.get_hunk_position()` returns @@ header and offset when on a hunk line - `commands.find_hunk_line()` finds matching @@ header in diff buffer - `commands.gdiff_file()` accepts optional `hunk_position` and jumps after opening Also updates @phanen's README credit for the previous two fixes. Closes #65
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When pressing
du/dUfrom a hunk line in the fugitive status buffer (after expanding with=), the unified diff now opens at the corresponding line instead of line 1.Before: Cursor always at line 1 of diff buffer
After: Cursor lands on the same line you were viewing in the fugitive status
Implementation:
fugitive.get_hunk_position(bufnr, lnum)- returns@@header and offset when cursor is on a hunk linecommands.find_hunk_line(diff_lines, hunk_position)- finds matching@@header in diff buffercommands.gdiff_file()accepts optionalhunk_positionand jumps after openingAlso updates @phanen's README credit for the previous two fixes (#68, #69).
Closes #65