Skip to content

Quick Gdiff from a commit view #1661

Answered by tpope
raags asked this question in Q&A
Jan 24, 2021 · 1 comments · 3 replies
Discussion options

You must be logged in to vote

After you press enter to open the relevant commit, the cursor should be on the relevant + line in the diff for the file. If you move to a nearby - line and press enter again, it will take you to that line just before it was removed, which is in the previous commit as you desire. Call :Gdiffsplit from there to achieve your desired result.

Edit: If you don't want to seek out a nearby - line (because you're trying to script the whole process, for example), press enter on the + line, and then use :Gedit >!^ to jump back one commit. The ! means "the currently edited file's commit", ^ means "back one" as in Git, and > is a special notation to use the current filename and try to find the same line.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@raags
Comment options

@tpope
Comment options

@dannobytes
Comment options

Answer selected by tpope
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants