【问题标题】:VS Code scroll up/down moving the cursorVS Code 向上/向下滚动移动光标
【发布时间】:2020-09-11 19:19:22
【问题描述】:

在 VSCode 中向下滚动时。使用箭头键可使光标位于底部。我可以使用 Ctrl + Arrow Down 这滚动屏幕并且光标保持其位置。在这种情况下,我需要单击新行才能开始编辑。但是我正在寻找一种滚动和移动光标的方法。例如,如果我在屏幕中间,我想滚动并让光标保持其在中间的相对位置。

有人做过吗?

【问题讨论】:

    标签: visual-studio-code scroll


    【解决方案1】:

    借助扩展Multi Command

    添加此设置

      "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"
          ]
        }
      ]
    

    还有这些键绑定

      {
        "key": "shift+ctrl+alt+up",
        "command": "multiCommand.up1LineKeepCursor",
        "when": "editorTextFocus"
      },
      {
        "key": "shift+ctrl+alt+down",
        "command": "multiCommand.down1LineKeepCursor",
        "when": "editorTextFocus"
      }
    

    您可以使用任何您喜欢的键绑定。

    Word Wrap 关闭时效果很好。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-11-17
      • 1970-01-01
      • 1970-01-01
      • 2020-04-06
      相关资源
      最近更新 更多