'How to scroll 10 line vertically with keyboard without moving cursor in vs code?

I am vim user, I don't like mouse to scroll.

pagedown and pageup is not perfect for me, I want to bindkey for pageup and pagedown with 10 lines scroll or something like that

Any idea how to do this?



Solution 1:[1]

You can use the editorScroll command to scroll the editor any amount you set without moving the cursor from its original position. For example, in keybindings.json:

{
  "key": "alt+m",                // whatever keybinding you like
  "command": "editorScroll",
  "args": {
    "by": "line",
    "to": "down",

    // "revealCursor": false,   // set to true if you did want to move the cursor
                                // false is the default
     "value": 10
  },
  "when": "editorFocus"
},
{
  "key": "shift+alt+m",         // whatever keybinding you like
  "command": "editorScroll",
  "args": {
    "by": "line",
    "to": "up",
    // "revealCursor": false,
    "value": 10
  },
  "when": "editorFocus"
},

complex commands including editorScroll

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1