farmergreg/vim-lastplace

vim-lastplace scrolls the file by one line from top

oblitum opened this issue · 7 comments

Hi, thanks for this nice plugin.

There's one small issue with it which is a bit annoying, it does preserve cursor location when I open a file, but it scrolls the file one line, hiding the top line, when used, even if I closed the file without scrolling it at all.

To reproduce, I open any file, put the cursor at a line which is not the top one without scrolling the buffer, close it, and open it again. When opening, the cursor is at the correct position, but the buffer is scrolled by one line, hiding the top one.

thanks @oblitum I've noticed the same bug and have been meaning to fix it. I'll try to get to this soon.

@oblitum please test and let me know if this fixes the problem. Thanks!

@dietsche great, it fixed. As I understand it, it still scrolls large files even if I close them without scrolling, because of the cursor centering feature. I think the way it's now seems fine, since it's not scrollling all files I open anymore, still, it may be undesired for some to reopen a file in a state that differs from the one it was when it was open previously, which happens if I move the cursor past half the screen, without scrolling it.

@dietsche I think that would mean vim-lastline-plus-lastscroll :-)

but, anyways, probably this is problematic to have since window size may be different later, so, I guess the current fix is possibly the best that can be done.

it's a good idea. I think it could be done using global variables and set viminfo+=! maybe someday I'll take time to try to figure this out :)