For example, let's say I am happily editing a document in Vim when I accidentally hit gg. I then end up on the first row of the document, and of course I have no idea which was the exact row that I last edited. Is there any way of magically get back to the last edited row before the gg jump?
The shortcut is Ctrl+O
(that's the letter 'O') to move back to previous position.
And Ctrl+I
to undo that (move back to the position before you pressed Ctrl+O
).
These can be used multiple times like the back and forward buttons on your browser to travel to previously "jumped to" positions.
To bounce back and forth between your current position and the last place you jumped from, you can use ``
(two backticks). See :h ``
for a list of this and other shortcuts for jumping around.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With