问题
I am currently using Windows 10 with WSL Ubuntu 18.04 installed. I am trying to use WSL as the default terminal in WebStorm however, I am able to use the bash from WSL but the default directory would not be set to the default project location.
Does anyone know how to set this up correctly?
回答1:
After a bit of search on google found a solution to my question.
First figure out the default wsl with the command:
C:\Windows\System32\wslconfig /list
Windows Subsystem for Linux Distributions:
Ubuntu-18.04
Legacy (Default)
then I set the default to Ubuntu-18.04 by
C:\Windows\System32\wslconfig /setdefault Ubuntu-18.04
Finally set the terminal path in Webstrom settings>tools>terminal to
C:\Windows\System32\wsl.exe
Now open the terminal it is correctly move the current directory to the /mnt/c/blah/blah
回答2:
Set:
Settings > Tools > Terminal > Shell path
Equal to:
"C:\Users\<username>\AppData\Local\Microsoft\WindowsApps\ubuntu.exe" run
The result is:
回答3:
Settings -> Tools -> Terminal
change cmd.exe
to C:\Windows\System32\bash.exe
and restart Webstorm.
回答4:
On Windows builds 16215 and higher:
1. Install WSL and the Linux distro of your choice (I opted for Ubuntu 18.04)
Windows support docs
2. Switch the default terminal to bash
Settings (or Default Settings)->Tools->Terminal->Shell path: bash
I use Webstorm and Rubymine and in my case, that was all that I had to do.
PS Please note that the Webstorm update 2018.2 finally brings in full integration of WSL for Node interpreter
Webstorm 2018.2 WSL
Also, Rubymine 2018.2 has drastically improved support for remote Ruby SDK (allows to use rvm), so now it is also super easy to use WSL/remote/containerized/dockerized Ruby env
Rubymine 2018.2 released
来源:https://stackoverflow.com/questions/51912772/how-to-use-wsl-as-default-terminal-in-webstorm-or-any-other-jetbrains-products