• 0 Posts
  • 4 Comments
Joined 2 years ago
cake
Cake day: March 25th, 2022

help-circle
  • Yesterday I was writing a git commit message. I have my terminal configured to use vim to do this. I wrote half of a lengthy explanation with a very long chain of thought and paused for a second to proofread. Then I turned around and accidentally mashed a button which pasted my clipboard all over my nice message. I was like fuck I’ll just undo, but I guess I hit more than one key because after hitting undo i was left with a blank message.

    I thought I had to start writing from scratch and then remembered that vim has time travel. I’m not joking. You just say :earlier 2m and it goes back to the state two minutes ago. But here’s the thing it actually has branched history, kind of like git. If you undo and then make some modifications you have made an alternate branch in the history. I hit g- (or g+ I forget) and got my message back.

    Having flipping time travel with every possible history is an absolutely batshit insane thing to implement into a “simple” editor, and I seldom use this feature, but it actually saved my ass and I’m glad people like Bram spent what was probably an eternity on implementing stuff like that.