如何在不移动 vs 代码中的光标的情况下使用键盘垂直滚动 10 行?

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

我是vim用户,我不喜欢鼠标滚动。

pagedown 和 pageup 对我来说并不完美,我想用 10 行滚动或类似的东西为 pageup 和 pagedown 绑定键

知道怎么做吗?

您可以使用 editorScroll 命令将编辑器滚动到您设置的任意数量,而无需将光标从其原始位置移开。例如,在 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