Add a custom command in Visual Studio Code Command Palette

Victor S. picture Victor S. · May 22, 2018 · Viewed 13.7k times · Source

Is it possible out of the box or using extensions to add a custom command in the Command Palette in Visual Studio Code like "External Tools" as in the IDE from JetBrains or in Visual Studio?

I would like to be able to run custom bash/cmd command directly from the Command Palette.

Answer

Flavio Wuensche picture Flavio Wuensche · Apr 24, 2019

You can either use VS Code built-in functionality using shortcuts. Just add to keybindings.json:

{
  "key": "cmd+shift+R",
  "command": "workbench.action.terminal.sendSequence",
  "args": {
    "text": "clear; rails server\u000D"
  }
},

Or you can take a look at this extension: Command Runner