I'd like to add in custom keyboard shortcuts - rather than just remapping existing key bindings. Is this possible?
The idea is to map a shortcut that will allow me to include an easily identifiable comment header to help index my projects - in this format:
/*--------------------------------------------------------------
# Header
--------------------------------------------------------------*/
Here is a snippet (which is triggered by typing cHeader):
"Custom Header": {
"prefix": ["cHeader"],
"body": [
"/*---------------------------------------------------------------",
"# $1",
"---------------------------------------------------------------*/"
]
}
You can make that to whatever length you want. For more complicated situations, see https://stackoverflow.com/a/56874352/836330 or https://stackoverflow.com/a/58722958/836330.
If you want to set a keybinding to that, use this:
{
"key": "ctrl+alt+r", // whatever you want as a keybinding
"command": "editor.action.insertSnippet",
"args": {
"name": "Custom Header" // name from your snippet above
},
"when": "editorTextFocus"
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With