0

Today if I have a command in my text editor in vs code, I have to copy it and paste it into the terminal and then execute it. Is there is a way or a keyboard shortcut to execute the currently selected line in the text editor directly in the terminal of visual studio code?

Cyrus
  • 84,225
  • 14
  • 89
  • 153
  • Does this answer your question? [How can I run text selected in the active editor in VS Code's integrated terminal?](https://stackoverflow.com/questions/38952053/how-can-i-run-text-selected-in-the-active-editor-in-vs-codes-integrated-termina) – starball Aug 31 '23 at 18:22

2 Answers2

0

Currently There is no feature like those.

Ajay Raja
  • 336
  • 3
  • 11
0

You can use the extension Command Variable

Define this key binding

  {
    "key": "ctrl+i f5",  // or any other combo
    "command": "extension.commandvariable.inTerminal",
    "args": {
      "command": "extension.commandvariable.transform",
      "args": { "text": "${selectedText}" },
      "addCR": true
    }
  }

You can add arguments to the ${selectedText} variable

rioV8
  • 24,506
  • 3
  • 32
  • 49