how to jump back to the previous edit place

Vim

Vim Problem Overview


Is it possible to go back to the previous edit place in vim? I know using marks, one can move back and forth between different places within a file, but I don't know whether or not vim could automatically remember the previous edit place for you.

Vim Solutions


Solution 1 - Vim

I use the following (from the documentation):

g;			Go to [count] older position in change list.

g,			Go to [count] newer cursor position in change list.

Do :help g, to read more about this

Solution 2 - Vim

The last change is held in the mark named . so you can jump to the mark with `. (backtick, dot) or '. (apostrophe, dot). See:

:help mark-motions
:help '.

Solution 3 - Vim

ctrl+o
ctrl+i to go forward (once you've gone backward, of course)

Solution 4 - Vim

To jump to the last edit position type gi.

Solution 5 - Vim

I used to use u then Ctrl-r before I learned about '.

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
QuestionHaiyuan ZhangView Question on Stackoverflow
Solution 1 - VimvorpygView Answer on Stackoverflow
Solution 2 - VimDrAlView Answer on Stackoverflow
Solution 3 - VimJayView Answer on Stackoverflow
Solution 4 - VimvbdView Answer on Stackoverflow
Solution 5 - Vimuser2297550View Answer on Stackoverflow