【问题标题】:Which key mappings will move cursor up and down one true line at a time?哪些键映射会一次将光标上下移动一条真线?
【发布时间】:2021-05-11 17:20:30
【问题描述】:

我使用 VS Code 来编写 markdown(除其他外),并且希望能够使用我在其他文本编辑器中导航文本时习惯的键盘映射,例如 MacOS 上的 TextEdit,或者我正在输入这个问题。这些关键地图包括:

  • "alt+up" 将光标向上移动一行
  • "alt+down" 将光标下移一行
  • "shift+alt+up" 向上移动光标并选择
  • "shift+alt+down" 向下移动光标并选择

当我写“向上一行”时,我的意思是向上穿过“真实”行,而不是换行。目前,向上和向下箭头本身会将光标移动穿过换行线。这很好,但我也希望能够在真实线条中上下移动。

我知道我可以在 VS Code 中手动重新映射这些组合,但我不确定如何将它们重新映射。换句话说,VS Code 有哪些函数可以将光标上下移动一条真线,并在选择文本时移动它?

【问题讨论】:

    标签: macos visual-studio-code


    【解决方案1】:

    我认为这就是您所说的“真线”(但我可能错了)。例如,在您的keybindings.json 中试试这个:

    {
      "key": "alt+up",            // whatever keybinding you want
      "command": "cursorMove",
      "args": {
        "to": "up",
        "by": "line",            // you can get intellisense for the options (Ctrl+Space)
        // "select": true        // false is the default
      },
      "when": "editorTextFocus"
    },
    {
      "key": "alt+down",
      "command": "cursorMove",
      "args": {
        "to": "down",
        "by": "line",
        // "select": true
      },
      "when": "editorTextFocus"
    },
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-09-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-07-20
      相关资源
      最近更新 更多