0

When exploring a commit using :Gedit HEAD, when I click o or Enter into the change, it shows me a vimdiff of the two file versions of the change.

From there I often need to jump to the current version of the file in the filesystem

I wonder if there is any idiomatic way to move from a diff of two versions of the file to its current version.

2
  • What precisely should happen? Close both splits of the diff, or leave them open and open a new split with the current state, or something else...? Please edit. (You may be interested in :Gedit and it's splitting relatives :Gsplit/:Gvsplit) – D. Ben Knoble Jun 17 '20 at 21:20
  • I should have made it more clear the question is when exploring a commit not the current staged or not changes such as with Git status. – Vicente Bolea Jun 18 '20 at 16:01
1

I think you are looking for :h :diffoff which removes diff options of the two buffers of a two-way diff.

This is mapped to dq in Fugitive.

You can go back to diff mode with Fugitive's Gdiffsplit.


Besides, the default for Enter and o in Fugitive's status window is to open the current version of the file, while dd is supposed to show the two-way diff.

I think you tweaked this, but the default might better suit your needs.

5
  • OP is exploring a commit, not just the regular status, so I could see o/enter opening a diff. Subtle and easy to miss though! Partly why I asked for clarification – D. Ben Knoble Jun 18 '20 at 11:18
  • Oh. I get it now. My answer is totally beside the point. – Biggybi Jun 18 '20 at 11:43
  • 2
    Nah, it could be useful to someone else; my vote would ve leave it up! – D. Ben Knoble Jun 18 '20 at 11:45
  • I just tried to downvote it (so people would see it's not very useful) but couldn't ;( GG for 10k! @D.BenKnoble – Biggybi Jun 18 '20 at 11:46
  • 1
    this answer helped, the fastest way I found so far is: dq to quit the diff and then Gedit to open the current version. – Vicente Bolea Jun 19 '20 at 17:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.