Say I opened file X.
then I scrolled down to line number 50 then I made some modifications and closed the file.
when I re-open the file. I want Vim to save the last location in this file (line 50) and puts me in this line automatically.
This feature existed by default. I don't know the name of this feature, so I couldn't google for it.
I think I lost it because some plugins have installed later.
How I re-enable this feature again? Thanks.
This is done by $VIMRUNTIME/defaults.vim
, also explained under :h restore-cursor
.
But it's not hard to add this feature yourself:
augroup vimStartup | au!
autocmd BufRead * call setpos('.', getpos("'\""))
augroup end