How can I run text selected in the active editor in VS Code’s integrated terminal?

There is no default keybindings for command “Run Selected Text in Active Terminal”, but you can create one.

  • Press Ctrl+K, Ctrl+S to open File → Preferences → Keyboard Shortcuts.
  • Search for workbench.action.terminal.runSelectedText in keybindings.
  • Press the icon on the left to open a windnow with this message “Press desired key combination…” and make your choice. (I’ve pressed Ctrl+Alt+R – as this combination was not used yet.)
  • Press Enter to store your keybinding.

Tested on VSCode 1.30.2 on Windows 10 Pro.

Leave a Comment