tags:

views:

114

answers:

4

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

+8  A: 

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 '.
Al
+3  A: 

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

Jay
This uses the jumplist, so will only work if a 'jump' was used after editing. If you just scrolled with the mouse and clicked on a new location, it'll fail.
Al
...and `:ju[mps]` to show the jump history (which is fixed at 100, though there is a separate jump list per window).
Jay
With all due respect, if anyone is using the mouse in Vim, they're missing the point entirely.
Jay
...but for the record, Al, I upvoted your answer.
Jay
Can't argue with that (although I am _very_ occasionally guilty of reaching for the scroll-wheel...)
Al
+4  A: 

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

vorpyg
A: 

To jump to the last edit position type gi.

vbd