dotfiles
dotfiles copied to clipboard
save and restore last cursor position in vim
This sets vim to save the cursor position on close/write and restores it on re-opening.
-
The
set viminfo
part is to unify and explicitly declare the .viminfo file (~/.viminfo is the default though) -
The
augroup cursor
part restores the cursorThe additional check is to ensure, that the restoring works properly on files with only one line
Thanks!
If I pull this in, I’ll probably use ~/.vim/info
instead of ~/.viminfo
(cfr. ~/.vim/swaps
etc.). Not sure if I really need this feature though… Let me think about it.