如何在VS Code中用键盘垂直滚动10行而不移动光标?

Ras*_*ani 6 visual-studio-code

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

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

知道如何做到这一点吗?

Mar*_*ark 12

您可以使用该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"
},
Run Code Online (Sandbox Code Playgroud)

复杂的命令,包括 editorScroll