首页 > 解决方案 > 哪些键映射会一次将光标上下移动一条真线?

问题描述

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

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

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

标签: macosvisual-studio-code

解决方案


我认为这就是您所说的“真实路线”(但我可能错了)。例如,在您的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"
},

推荐阅读