Eric D. Schabell: Vim hints: last file location

Wednesday, August 27, 2008

Vim hints: last file location

Using vim and want to re-enter the file at the same location you left it? Add this to your .vimrc file:

" jump to last position before save.
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal g'\"" | endif

Vim version is 7.1.138.