[vim] Automatically jump to the last visited line when a file is reopened
Put the following in your .vimrc file to automatically jump to the last visited line when a file is reopened using vim:
" This allows Vim to jump to the last position when
" reopening a file
if has("autocmd")
au BufReadPost * if line("'\"") > 0 && line("'\"")
Alternatively, you could just reopen the file normally and then hit " '0 " (that is, single quote followed by the number zero) to get the same result.
Source: Stack Overflow
Advertisement

leave a comment