:help last-position-jump
*last-position-jump*
This autocommand jumps to the last known position in a file
just after opening it, if the '" mark is set: >
:au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal g'\"" | endif
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal g'\"" | endif