Keep horizontal position
sobrinho opened this issue · 4 comments
Hi,
Would be nice to be able to keep the cursor position as well.
Example (_ is the cursor):
line
line _line
line
When we reopen the file, the cursor goes to the first position:
line
_line line
line
What you think?
One problem I see is that we would have to deal with lines where no longer large as the last position, in that case I think going to the last position would be okay.
Thanks for the suggestion! I'll take a look and see if/how this can be done.
I just took a look at this today, and the horizontal and vertical positions are indeed maintained correctly already. I tested this with Vim 7.4.1689 on a ubuntu-server virtual machine.
@sobrinho can you replicate your issue with a clean vim install? If so, please re-open this issue. Thanks!
I run into a similar issue and this is what I found. Tested on nvim 0.5 and vim 8.2 (2815)
- If the last position isn't near the end of the file, the plugin goes through this path and horizontal position will be kept
vim-lastplace/plugin/vim-lastplace.vim
Line 54 in d522829
- If the last position is near the end of the file, the plugin goes through this path and it always jump to the start of the line
vim-lastplace/plugin/vim-lastplace.vim
Line 68 in d522829
Even if I change line 68 the same way line 54 does, it still jump to the start of the line
execute "normal! g`\""
This bug should be fixed by #35