In Visual Studio Code on windows. The key binding Ctrl + Shift + C opens a new external terminal.
By default, this opens a cmd console. Is there a way to change this default terminal because I want to use git bash instead.
I do know that the command answers to the "ComSpec" environment variable, but changing this variable to the path of the git bash throws this The console closes with the code 126
Use this setting:
Terminal > External: Windows Exec
with something like C:\Program Files\Git\bin\bash.exe or wherever your git bash is installed.
That is for opening an external terminal. For the integrated terminal within vscode, use:
Terminal > Integrated > Shell: Windows
with "C:\\\\Program Files\\\\Git\\\\bin\\\\bash.exe"
My suggestion is to open directly Window Terminal
where wt
C:\Users\UserName\AppData\Local\Microsoft\WindowsApps\wt.exe
Related
Is there any way so when I run a program with terminal it will make a new window terminal not using the default terminal in VS Code?
1: https://i.stack.imgur.com/Y8Il0.png (Like this for example)
If you are looking for way to use a different terminal profile in VS Code, and you don't care to open the terminal in a new window, you can try these steps:
Open the VS Code Command Palette: Cmd + Shift + P
Type "Default"
Select Terminal: Select Default Profile
Select the desired terminal profile you want to use
You can then toggle the terminal in VS Code using Ctrl + ` .
I need to open a terminal in Visual Studio. I've tried
Re-installing VS Code
The usual Windows shut down / restart
Run vs code as admin
Change settings.json file
I didn't change anything but something is broken in my code Editor help needed :)
For Windows users:
Open PowerShell terminal (windows button + r -> cmd)
Right click on the title bar
Open properties
Check the "Use legacy console" checkbox
For Linux users:
Open VS Code
Ctrl + ,
Search env and find Terminal > Integrated> Env: Linux
Add this "terminal.integrated.inheritEnv": true to the object body
Press ctrl + `. It might work, and if it doesn't, try reinstalling the vs-code again and then try the above key combo again.
I can live with it, but...
I have changed the terminal from PowerShell to git bash in the settings:
"terminal.integrated.defaultProfile.windows": "Git Bash"
This does its job. When I create a new terminal, it is git bash by default.
However, when I start Visual Studio Code, it opens with a PowerShell terminal. (All new terminals are git bash terminals.)
To set the default terminal in VS Codem , you should follow this steps:
Open VS Code
Press CTRL+Shift+P / โงโP and search for terminal select default shell
Make your selection and press enter (In my case I chose Git Bash)
All of your new terminals will now default to your choice ๐
I hoped this helped you.
The title mostly says it all about the question.
I want to set the newest Microsoft's Windows Terminal as an external terminal in Visual Studio Code.
I found the WT's executable in C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_0.4.2382.0_x64__8wekyb3d8bbwe\WindowsTerminal.exe. Then I entered the path into VSC in the terminal.external.windowsExec. Then tried to run my program, but VSC showed a pop-up which says "Could not find "C:\Program". Check whether the path is written right an try again."
Also I have tried to use a shortcut (literally dragged the WT tile from Start to my desktop folder), then entered its path into the setting, but it just opens the app without starting the program.
You are essentially asking VS Code to Run... a program via the Ctrl + Shift + C command.
Per the tip here, you can achieve what you are looking for by simply entering:
wt
...into the terminal.external.windowsExec section.
It might not be handling the space in the filename correctly. Try surrounding the pathname in quotes like this: "C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_0.4.2382.0_x64__8wekyb3d8bbwe\WindowsTerminal.exe"
WT now supports the "-d" parameter to open itself in a given directory: https://github.com/microsoft/terminal/pull/4023
But VSCODE does not allow to pass arguments to an external terminal: https://github.com/microsoft/vscode/issues/58086
The workaround for this is to create a batch script somewhere called wt.bat containing:
#start wt.exe -d "."
#exit
And put it on vscode Terminal>External: Windows Exec setting.
Note that the "Windows Terminal", as external terminal, does not launch in the workspace directory (issue 90734)
Set terminal.external.windowsExec to wt
Run "Open New External Terminal" from the command palette
A new instance of Windows Terminal opens, but with the default directory, instead of ${workspaceFolder}.
So while the Windows Terminal Preview v0.9 Release allows a starting directory to be specified with -d <starting dir>, it would not work with VSCode up to 1.44 (March 2020).
This should be fixed with VSCode 1.45 (April 2020): PR 90773.
I can open it with this configuration
"terminal.external.windowsExec": "wt.exe"
My windows terminal version is 1.11.2921.0
Then I found that Windows terminal is actually wt.exe
It's in a path like this C:\Program Files\WindowsApps\************\wt.exe
Then, I add the above 'wt.exe' to the vscode configuration file
The VSCode python extension has a feature to right click and run a file from the terminal. Is there a way that I can use a similar feature to quickly execute a ruby file from the terminal? Perhaps a hot key to start a new terminal session and run the current file within the ruby install directory.
You can install the code-runner package opening the command palette:
command + shift + p (Mac)
control + shift + p (Windows/Linux)
Find and install it:
ext install code-runner
Then it'll ask you to reload the window, and depending which file type you're working in, you can type the ctrl + alt + n keybinding and your file output will be in the output tab.
Keep your Ruby code saved inside .rb extension file
And in the terminal run
ruby file_name.rb
Example:
ankita#ankita-Inspiron-5559:~/Ruby_asignment$ ruby prob_sol1.rb