VS Code – custom hotkeys for terminal


I got addicted to VS Code. I’ve fallen in love with this little bastard from Microhard. It’s convenient for Go, nothing to do with it… And for this very Go, you need to constantly loop with the console to run the project via go run . Doing it every time by hand is, of course, unkosher. So here’s what we do, Mikhalych:

    • Ctrl+Shift+p
    • Preferences: Open keyboard shortcuts
    • click on icon in the right top corner Open keyboards shortcuts (JSON)
    • add there:

[
    {
        "key": "f7",
        "command": "workbench.action.terminal.sendSequence", 
        "args": { "text": "go run .\n" }
    }
]

Hallelujah. Now, when you press the useless (for Go) button F7, we start the project.

There you can add more useful features, for example, like this:

[
    {
        "key": "ctrl+shift+u",
        "command": "editor.action.transformToUppercase"
    },

    {
        "key": "f7",
        "command": "workbench.action.terminal.sendSequence", 
        "args": { "text": "go run .\n" }
    }
]

And then with ctrl+shift+u – we change the case of letters 🙂


This entry was posted in Visual Studio Code (en). Bookmark the permalink.

Leave a Reply

🇬🇧 Attention! Comments with URLs/email are not allowed.
🇷🇺 Комментарии со ссылками/email удаляются автоматически.