When scrolling down in VSCode. Using arrow keys makes you have the cursor on the bottom. I can use Ctrl + Arrow Down This scrolls the screen and the cursor keeps its position. In this case I need to click on the new line in order to start editing. However I'm looking for a way to scroll and move the cursor. For example if I'm in the middle of the screen I want to scroll and get the cursor to maintain its relative position in the middle.
Has anyone done this?
With the help of the extension Multi Command
Add this setting
"multiCommand.commands": [
{
"command": "multiCommand.up1LineKeepCursor",
"sequence": [
{"command": "editorScroll", "args": {"to": "up", "by": "line" }},
"cursorUp"
]
},
{
"command": "multiCommand.down1LineKeepCursor",
"sequence": [
{"command": "editorScroll", "args": {"to": "down", "by": "line" }},
"cursorDown"
]
}
]
And these keybindings
{
"key": "shift+ctrl+alt+up",
"command": "multiCommand.up1LineKeepCursor",
"when": "editorTextFocus"
},
{
"key": "shift+ctrl+alt+down",
"command": "multiCommand.down1LineKeepCursor",
"when": "editorTextFocus"
}
You can use any key binding you like.
It works good when Word Wrap
is OFF.