WSL2 · April 15, 2021 0

How to open project with sublime / vscode in wsl

WSL is a great facility provided by Microsoft for open source developers. You can still keep coding in linux while enjoying windows os.

You can run many windows applications from wsl terminal like Visual studio code and explore using following commands

 $ code . 
This would open visual studio code in current linux dir

To open your code with sublime is not supported directly, to open it with sublime, you need to create a shortcut for wsl in sublime

Edit your .bashrc file from wsl terminal

 $ vi ~/.bashrc 

And add following line to end of file, it ll create an alias for sublime in wsl

alias subl='"/mnt/c/Program Files/Sublime Text 3/subl.exe"' 

Save the file and close the terminal, reopen the terminal and go to code directory and then use sublime like below

$ subl . 

It ll open sublime with your code.