The solution for current vscode (1.48.0):
- Install this extension:
geddski.macros
- Add this line to
settings.json
:
"macros": { "commentLine": ["editor.action.commentLine","cursorDown"] },
- Add these lines to
keybindings.json
:
{
"key": "ctrl+/",
"command": "macros.commentLine",
"when": "editorTextFocus && !editorReadonly"
},
How to quickly open these files:
- For
keybindings.json
press Ctrl+Shift+p and write Preferences: Open Keyboard Shortcuts (JSON)
- For
settings.json
press above shortcut and write Preferences: Open Settings (JSON)
Physical location of files:
Linux:
~/.config/Code/User/keybindings.json
~/.config/Code/User/settings.json
Windows:
%UserProfile%\AppData\Roaming\Code\User\keybindings.json
%UserProfile%\AppData\Roaming\Code\User\settings.json
MacOS:
~/Library/Application\ Support/Code/User/keybindings.json
~/Library/Application\ Support/Code/User/settings.json