Home > Mobile >  Execute the currently selected line in the text editor directly in the terminal in visual studio cod
Execute the currently selected line in the text editor directly in the terminal in visual studio cod

Time:01-30

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?

CodePudding user response:

Currently There is no feature like those.

CodePudding user response:

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

  •  Tags:  
  • Related