Add note about `:h last-position-jump`, available out-of-the-box in recent versions of Vim
Closed this issue · 1 comments
Consider adding a note that this plugin isn't needed in Vim 8+ onwards.
:h last-position-jump
One can have this behavior out-of-the-box with the following in ~/.vimrc
(see :h skip_defaults_vim
):
unlet! skip_defaults_vim
source $VIMRUNTIME/defaults.vim
The magic setting is this part:
" Put these in an autocmd group, so that you can revert them with:
" ":augroup vimStartup | au! | augroup END"
augroup vimStartup
au!
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid, when inside an event handler
" (happens when dropping a file on gvim) and for a commit message (it's
" likely a different one than last time).
autocmd BufReadPost *
\ if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit'
\ | exe "normal! g`\""
\ | endif
augroup END
endif
I mean, I am sure your plugin does more than that, and I am not advocating for you to delete it. However, it would be nice to warn users that the basic functionality for it ships out-of-the-box with recent versions of vim. It would be even better if the diff parts of this plug-in compared to the status quo were merged upstream - but hey, one step at a time.
Nonetheless, great job in your repository management - This is one of the fewest I found with all issues and pull requests closed.
Thanks for the feedback & compliments!
It would be fantastic if it were up streamed, but currently, vim-lastplace does quite a bit more than the vim-8 behavior.
A few examples where vim-lastplace shines: it handles commit messages correctly (for example, svn), opens folds, and has special handling if you're starting at the end of a file so that you have as much context as possible.
For more information, please check out vim-lastplace the code here - it's quite well commented:
https://github.com/farmergreg/vim-lastplace/blob/master/plugin/vim-lastplace.vim
Thanks,
Greg