In order to setup custom keybindings shortcuts in vscode you need to edit keybindings.json:
Open vscode and press:
ctrl + shift + p
Then search for the following strings, anmd open it:
Open Keyboard Keyboard Shortcuts (JSON)
Inside this file you can put your custom shortcuts, below you can see an example:
keybindings.json
// Place your key bindings in this file to override the defaults
[
/*Print Kernel Debug*/
{
"key": "F5",
"command": "type",
"args": {
"text": "printk(\"KERN_ERR, DEBUG FUNC = %s, LINE = %d, \\n\", __func__, __LINE__);"
},
"when": "editorTextFocus"
},
/*Print Debug*/
{
"key": "F6",
"command": "type",
"args": {
"text": "printf(\"DEBUG FUNC = %s, LINE = %d, \\n\", __func__, __LINE__);"
},
"when": "editorTextFocus"
},
/*Print Debug*/
{
"key": "F7",
"command": "type",
"args": {
"text": "puts(\"DEBUG\");"
},
"when": "editorTextFocus"
},
/* Dump stack */
{
"key": "F8",
"command": "type",
"args": {
"text": "dump_stack();"
},
"when": "editorTextFocus"
},
]