Please add support for the vim setting scrolloff
Thanks! :)
This seems like more of a VSCode thing than for us.
Relevant: Microsoft/vscode#12048
Could this be implemented in VSCodeVim while waiting for native support in VSCode?
@Tobbe Seems unlikely to me. VSCode exposes almost nothing about the view window to us. The only way we can even interact with the viewport (for commands like zt for example) is through the API's VSCode provides us.
There is a scrolloff extension, but at least locally it breaks some vim functionality (ctrl-d and ctrl-u commands only move one line, for example) and causes a flash before adjusting the scroll position.
The feature is supported in Visual Studio with VSVIM. Why does it not work on VSCode?
The feature is supported in Visual Studio with VSVIM
This argument comes up more often than it should. Visual Studio/VSCode are both editors maintained by Microsoft and VSVim/VSCodeVim are both VIM emulator plugins, but that is where the commonality ends. Visual Studio+VSVim and VSCode+VSCodeVim are different projects with different code bases supported by different teams/communities.
Contributions are more than welcome to add this support to vscodevim; however, as argued in Microsoft/vscode#12048, it'd be great to push these requirements down to vscode so that non-vim users would benefit, so please upvote that issue. Have you tried using https://github.com/TickleForce/vscode-scrolloff? Or maybe in vscodevim, we can integrate with the vscode-scrolloff extension.
There are always other extensions that can help get this functionality. I use VSCodeVim for a lot of things, but when I needed scrolloff, I found another extension.
https://marketplace.visualstudio.com/items?itemName=tickleforce.scrolloff
For the record, I've tried scrollof, but it did not have any effect on zt (only zb).
After taking another look, I noticed scrollof offsets after moving up or down. Here is how I hacked it to work as intended.
"vim.normalModeKeyBindingsNonRecursive": [
{
"before": ["z", "t"],
"after": ["z", "t", "j", "k"]
},
{
"before": ["z", "b"],
"after": ["z", "b", "j", "k"]
}
],
Obviously this is very messy and could cause all sorts of other issues. I don't know where to fix this?
This is addressed, as best as possible, in #3940. If you're waiting on this feature, it'd be very helpful if you checked out that branch and did some manual testing. Thanks!
It's already implemented in VS Code and the setting for this feature is editor.cursorSurroundingLines. Besides, it doesn't require any code change from the Vim extension. I'll suggest to close this issue.
@rebornix Thanks, I chose the wrong time to tackle this one 馃檪
Most helpful comment
It's already implemented in VS Code and the setting for this feature is
editor.cursorSurroundingLines. Besides, it doesn't require any code change from the Vim extension. I'll suggest to close this issue.