Closed anuvyklack closed 3 years ago
Are you aware that the current behaviour is the default behaviour in vanilla (neo)vim? If you want the screen to scroll until the cursor is at the first/last line of the window then you can simply set scrolloff=0
.
If I'm missinterpreting the title please explain further what you want.
According to :help zt
it should puts current line at top of window. But currently, for me, it puts cursor at the first quarter line at window.
Edited, because misunderstood your answer at first.
My scrolloff
option is 0.
According to :help zt it should puts current line at top of window
This is true as long as scrolloff=0
. Try opening a file with nvim -Nu NONE and then :set scrolloff=5
. You'll see that the cursor does not go to the top of the screen if you press zt
(unless you are at the top of the file).
Can you please run :set scrolloff=0
and check again if zt
/zb
brings the cursor to the top/bottom of the window? This issue could be related to #11 somehow.
Yes, it is related to #11 .
set scrolloff?
returns 0
;set scrolloff=0
doesn't help;setlocal scrolloff?
returns -1
;setlocal scrolloff=0
fix the problem;:lua print(vim.wo.scrolloff)
somewhy returns 9
, which is the root of the problem.Yes... So I tried to provide a workaround to neovim/neovim#13964 in #11 but it will break when the garbage value of local scrolloff is between 0 and half of the window size. I can't do any better than this until the neovim issue is fixed because I have no way of knowing if you set that local scrolloff=9
or is a garbage value. However, you can fix this by explicitly setting the local scrolloff in your vimrc (setlocal scrolloff=0
).
Thank you!
The title says it all.