Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add multiple terminals in VS Code?

Can we add multiple different terminals in the VS Code? I am planning to add following three terminal and work with all of those :

  1. Windows Command prompt
  2. PowerShell
  3. Git Bash

I know I need to add the following command in Preferences => Setting

 // // 64-bit cmd if available, otherwise 32-bit  "terminal.integrated.shell.windows": "C:\\Windows\\sysnative\\cmd.exe", // // 64-bit PowerShell if available, otherwise 32-bit  "terminal.integrated.shell.windows": "C:\\Windows\\sysnative\\WindowsPowerShell\\v1.0\\powershell.exe", // // Git Bash  "terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe", 

I want to add all of the above three commands in setting.json

enter image description here

And when I click + different terminal should open and I want to work with those terminals without changing the preferences. Is it possible in VS Code or not?

like image 891
MANISH KUMAR CHOUDHARY Avatar asked Apr 15 '17 15:04

MANISH KUMAR CHOUDHARY


People also ask

How do you close multiple terminals in VS Code?

There is a Terminal: Kill All Terminals command, not bound to anything by default. Or search for the command in your Keyboard Shortcuts page and click on the pencil icon to enter some keybinding.

How do I switch between two terminals in VS Code?

Once the cursor is in the terminal section you can use ctrl+x ctrl+up or ctrl+x ctrl+down to cycle through the active terminals (note that moving between on-screen split terminals is done with ctrl+x left or ctrl+x right ). cmd-J is still used to hide/show the terminal pane.

How do you add a shell command to VS Code?

Launching from the command line# You can also run VS Code from the terminal by typing 'code' after adding it to the path: Launch VS Code. Open the Command Palette (Cmd+Shift+P) and type 'shell command' to find the Shell Command: Install 'code' command in PATH command.


1 Answers

There is a way to make this happens with these steps by installing an extension:

  1. Find an extension called Shell launcher and install it or you can find it here. Reload VS Code if you want or after you finished all steps.

  2. Go to Files --> Preferences --> Settings and this will open settings.json file and you then insert this (you can edit this to your heart's content):

Code:

"shellLauncher.shells.windows": [     {         "shell": "C:\\Windows\\<sysnative>\\cmd.exe",         "label": "cmd"     },     {         "shell": "C:\\Windows\\<sysnative>\\WindowsPowerShell\\v1.0\\powershell.exe",         "label": "PowerShell"     },     {         "shell": "C:\\Program Files\\Git\\bin\\bash.exe",         "label": "Git bash"     },     {         "shell": "C:\\Windows\\<sysnative>\\bash.exe",         "label": "WSL Bash"     } ] 

PS: You can use shellLauncher.shells.linux for Linux or shellLauncher.shells.osx for macOS.

  1. Go to Files --> Preferences --> Keyboard Shortcuts and then find on {} icon on the top right corner to open keybindings.json file. Insert this:

Code:

[     { "key": "ctrl+alt+`", "command": "shellLauncher.launch" } ] 

Update: Type shelllauncher into the search bar. You can then see Shell Launcher: Launch command. Highlight and use any keybinding you like. For example, I picked Ctrl + Alt + (backtick)` for myself.

You can reload your VS Code and click the key combination you have assigned and that will give you the option to choose which integrated terminal you want to use.

enter image description here

For more details, please check the official site: https://marketplace.visualstudio.com/items?itemName=Tyriar.shell-launcher

Enjoy!

like image 95
ian0411 Avatar answered Sep 20 '22 17:09

ian0411