VS Code - 键盘滚动后将光标移动到当前屏幕中心的键盘快捷键

Kir*_*sov 6 keyboard-shortcuts visual-studio-code

使用键盘 ( Ctrl+ UpArrow/ DownArrow)在编辑器中滚动后,光标会停留在原来的位置,可能会向后移动 5-10 个屏幕。

是否有命令将光标移动到我正在查看的当前屏幕的中心,以便我可以编辑我正在查看的任何内容?

我可以做“转到行”(Ctrl+ G,然后输入行号),但我正在寻找一个单键键盘快捷键。

Mar*_*ark 10

在你的 keybindings.json 中试试这个:

{
  "key": "alt+m",           // or whatever binding you choose
  "command": "cursorMove",
  "args": {
      "to": "viewPortCenter"
  }
}
Run Code Online (Sandbox Code Playgroud)

另请参阅:如果需要,在滚动自动移动光标