How to go back to lines edited before the last one in Vim?

Vim

Vim Problem Overview


I'm aware of the `. command that goes to last edited line. Is there a way to go further in the editing history? I often accidentally insert something while browsing the file, undo, but then `. will not bring me where I want anymore.

Vim Solutions


Solution 1 - Vim

Try g ; and g ,. They jump backward and forward in the changelist.

See :help changelist for more details.

Solution 2 - Vim

I use CTRL-O and CTRL-I to jump back and forth between recent points in files. It also goes through certain motion commands, but I find it usually takes me back to where I was editing.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionBobView Question on Stackoverflow
Solution 1 - VimRandy MorrisView Answer on Stackoverflow
Solution 2 - VimJosh LeeView Answer on Stackoverflow