I stumbled across vscode that can create snippets of user code

The method is File->Preferences->User Snippets

Then it’s time to create code snippets for each language.

{    // Place your snippets for c here. Each snippet is defined under a snippet name and has a prefix, body and     // description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:    // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the     // same ids are connected.    // Example:    // "Print to console": {    //  "prefix": "log",    //  "body": [    //      "console.log('$1');",    //      "$2"    //  ],    //  "description": "Log output to console"    // }    "main_template": {            "prefix": "main",            "body": [                 "#include<stdio.h>",                 "#include<stdlib.h>",                 "int main()",                 "{",                 "return 0;",                 "}"            ],            "description": "main template"         }        }
Copy the code

The notes are very clear.

Pre represents the triggered string and body represents the inserted code.

This one up here is in C and main will pop up. If you select it, it inserts.

See vscode’s documentation for more advanced features.