Is your feature request about something that is currently impossible or hard to do? Please describe the problem.
It is difficult to edit the end of a file with a high scrolloff value set because the view is not kept centered. scrolloff is really useful for keeping the cursor centered at most times, but entering insert mode at the end of the file with a high value set will reset the view (even if you've intentionally scrolled with <C-e>) so that the last line of the buffer is near or at the bottom of the window (depending on the specific scrolloff value used). This issue does not exist with no scrolloff set, i.e. you can center with zz and the view will stay there when entering insert. Users with a high scrolloff set probably want to keep the cursor centered at all times (I do), but this currently cannot be done.
Describe the solution you'd like
A clear and concise description of what you want to happen.
I would like to be able to keep the cursor centered at the end of the buffer, even with a high scrolloff set, when entering insert mode, jumping, or scrolling. See these GIFs for a visual example:
scrolloff = 60In the first GIF, I am in vim and with a scrolloff value of 60 set. I G to the end of the file and open insert mode. Afterwards, I scroll with <C-e> and enter insert mode again. In the second GIF, I am in GUI Emacs with Evil, but using native settings that adjust where the cursor is kept. This behavior is essentially what I'm after.
Describe alternatives you've considered
There are existing plugins which attempt to but do not solve this. You can rewrite keymaps to attempt to keep the cursor centered, but that is a kludge that requires modifying many keymaps and doesn't work well. There is no existing solution that allows for this behavior that I'm aware of.
Additional context
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@luukvbaal is this something that could be achieved using the 'splitkeep' option (and a bottomline value)? I may also be totally off, not sure if those two things are related 🤷
In any case this really sounds like a real nice use case here. Don't expect any work on that soon.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Hmm no, seems loosely related but I think both in concept and implementation, this strays too far from the 'splitkeep' option. The splitkeep mechanism only triggers when windows are resized. What's needed here is to adjust the 'scrolloff' logic in some move.c functions itself I think.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@luukvbaal I appreciate the direction. I've never contributed and don't know the codebase. With those instructions, I'd be willing to jump in and take a look
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
I believe there is a special case when reading from a channel and the callback is appending to the buffer, the cursor will automatically be set to the newline appended. It sounds like this is what you want for a more general case.
See this part of the documentation. (I don't know currently where this is handled in the code however).
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Any progress ? I need this for neovim but they are waiting for a patch from vim.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
It's considered indecorous to ask for updates on open issues. Feel free to open a PR instead.
Chris, the primary maintainer, said to not expect any work on this feature soon, which I interpreted to mean that it is up to either me or another user to build this. I only started trying to understand the code base so I could implement this feature in the past month, so I have no progress yet, but I am working on this.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Any progress ? I need this for neovim but they are waiting for a patch from vim.
It's open source. You get what you pay for
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@chrisbra Please don't mind me I just don't know C or vimscript as I only use lua that's why I don't think that I can contribute to this right now. But of course if I had the time I would help to solve this.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@chrisbra @luukvbaal I've created a draft PR for this (#19040). This PR still needs a lot of things, I think:
I've never created a feature for Vim before, so I don't really know the process. It would be cool for maintainers to look at it and give me a signal that I'm moving in the right direction. I would eventually like others to try this and give their feedback too.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()