Skip to content

Instantly share code, notes, and snippets.

@larsen
Created June 28, 2011 15:56
Show Gist options
  • Save larsen/1051463 to your computer and use it in GitHub Desktop.
Save larsen/1051463 to your computer and use it in GitHub Desktop.
" 5.5. How do I configure Vim to open a file at the last edited location?
" Vim stores the cursor position of the last edited location for each buffer
" in the '"' register. You can use the following autocmd in your .vimrc or
" .gvimrc file to open a file at the last edited location:
au BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment