In vim you can go back to the last edited line with '. , but is there a way to go back to the second-last edited line? Suppose I did some edits at line 100, then some edits at line 1, is there a quick way to return to line 100? I know a mark can be used but that requires forethought...
You can use the jumplist (:help jumplist
). Simply use Ctrl-O
to go back (and Ctrl-I
to go forward) in the list of the last places you either edited or jumped to (via %
, /
, [[
etc: see :help jumplist
for the full list).
To go back to the place you edited before last then assuming you've done no other jumps in the meantime, this would be Ctrl-O
Ctrl-O
or (I think) 2 Ctrl-O
.
In addition to jumplist, vim has also a changelist, which can be iterated over using g;
(to older item) and g,
(to newer item) motions.
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