Closed milkias17 closed 2 years ago
That is a great question. The function you provided, is what is used in both vim-lastplace and nvim-lastplace. The biggest difference is that we have the ability to ignore on certain filetypes (gitcommit, gitrebase, svn, and gitcommit by default) and certain buftypes (quickix, nofile, and help by default). This plugin allows for control over what you want ignored when going to the last place you edited.
Additionally, this plugin provides support for handling folds and automatically centers the buffer around your cursor. I adapted a lot of the code from the original VimL used in vim-lastpace to the Neovim Lua API so that I could try my hand at learning the new API and Lua in a testable way.
TL; DR: Easier customizability and was a great learning opportunity for the author.
Cool. Thanks for the response.
I was just wondering what exactly does this plugin provide that a simple autocommand wouldn't do. I've had this in my config for the functionality and was wondering what this plugin provides better/different than this autocommand:
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif