vscode + vim:注释行不会向下移动光标

Kos*_*sak 2 visual-studio-code vscodevim

在使用快捷方式注释当前行后,如何使 Visual Studio Code 将光标向下移动一行ctrl + /?我尝试过(在用户设置中):

"vim.normalModeKeyBindings": [
    {
        "before": ["<C+/>"],
        "after": ["<C+/>", "j"]
    }
]
Run Code Online (Sandbox Code Playgroud)

但它不起作用。

使用Linux Manjaro + vscode 1.27.2

Kos*_*sak 5

当前vscode(1.48.0)的解决方案:

  1. 安装此扩展:geddski.macros
  2. 将此行添加到settings.json
"macros": { "commentLine": ["editor.action.commentLine","cursorDown"] },
Run Code Online (Sandbox Code Playgroud)
  1. 将这些行添加到keybindings.json
{
    "key": "ctrl+/",
    "command": "macros.commentLine",
    "when": "editorTextFocus && !editorReadonly"
},
Run Code Online (Sandbox Code Playgroud)

如何快速打开这些文件:

  • 用于keybindings.json印刷Ctrl+Shift+p和书写Preferences: Open Keyboard Shortcuts (JSON)
  • settings.json上面的快捷键并写入Preferences: Open Settings (JSON)

文件的物理位置:
Linux:

  • ~/.config/Code/User/keybindings.json
  • ~/.config/Code/User/settings.json

视窗:

  • %UserProfile%\AppData\Roaming\Code\User\keybindings.json
  • %UserProfile%\AppData\Roaming\Code\User\settings.json

苹果系统:

  • ~/Library/Application\ Support/Code/User/keybindings.json
  • ~/Library/Application\ Support/Code/User/settings.json