lastpos.vim : Last position jump improved for Easy Vim
| script karma
Downloaded by 432
Comments, bugs, improvements
script versions (upload new version)
|With Easy Vim , the code to perform a last position jump  can't restore a cursor position beyond EOL, because the jump will be executed in Normal mode . The result in this case is a by-one error , so most people  won't find that annoying ...
The good news is that Vim seems to store a correct value in the viminfo file -- one solution is to restore the last position while in Insert mode, which is what the plugin does.
Easy Vim actually is not required, the plugin will also work with a normal setup, or when you use :startinsert in the vimrc to merely start up in Insert mode.
The code is slightly more cautious than the original: the cursor won't be moved if something else already moved it, or if the buffer is special (help buffer, etc.). Furthermore, to fix  a related case , the BufWinEnter autocommand is used instead of BufReadPost.
This lengthy description applies for a rather short piece of code.
 :help 'insertmode' or :help -y
 :h last-position-jump
 explanation http://groups.google.com/group/vim_use/msg/c571f994f211f8fe
 the position is almost right, no issue for Bram: http://groups.google.com/group/vim_dev/msg/fbcffe406ff01b7f
 especially of the few Easy vimmers
 not sure if "modify" is the better word as what follows is probably not a bug
 Cursor column not remembered ... http://groups.google.com/group/vim_dev/msg/b3512cecaab3e0b1
|Drop the file into your plugin folder, restart Vim.
For newbies: this folder could be ~\vimfiles\plugin -- replace '~\vimfiles' with the first entry of your 'runtimepath'.
If you are using the example vimrc :help vimrc_example.vim, you may have
autocmd BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
in your vimrc – make sure to remove this old code.
Click on the package to download.
ip used for rating: 184.108.40.206