How Do I Map Ctrl-f To Move Forward A Character In VS Code?

时间:2018-03-25 20:01:45

标签: visual-studio-code

I have gotten into the habit of using ctrl+f to move forward a character when staying in insert mode while using the vim mode in various editors. I don't like using the arrow keys or hopping out of insert mode/moving a character with a motion command/getting back into insert mode. How do I make that shortcut work in VS Code? I also often will use ctrl+b to move backwards a character, but this is less important. I'm open to other suggestions, btw, for moving around while in insert mode without the arrow keys.

1 个答案:

答案 0 :(得分:2)

在keybindings.json中:

{
    "key": "ctrl+f",
    "command": "cursorRight",
    "when": "editorTextFocus"
  },
  {
    "key": "right",
    "command": "-cursorRight",
    "when": "editorTextFocus"
  }

重现的步骤:

  1. Ctrl - K Ctrl - S 打开键盘快捷键(或单击齿轮图标)左下)。

  2. 向右搜索光标。

  3. 鼠标悬停"右移光标",点击" +"或"笔"编辑图标。

  4. 在弹出对话框中输入所需的键绑定,然后按enter键。

  5. Vscode会自动在keybindings.json文件中生成上面的键绑定。