DEV Community

Simon Bundgaard-Egeberg for IT Minds

Posted on • Originally published at insights.it-minds.dk

VS Code and WSL => Godmode

Going from Linux to Windows is not easy. When it came to working, nothing could beat the power of the commandline and my legendary vim config (as i so fitted has named it).

Why Windows?

I recently bought me a Dell XPS 15. Really nice computer. However it seems that Dell has implemented some nice features, which to my knowledge only works on a Windows distribution. Sucks when i spent so much time mastering the vim+zsf.

The linux subsystem for windows brought light to my weary bones though, and i will teach you how you can harness the true power of Windows (Which is a linux VM).

To harness the power of the linux gods you will have to finish the tasks of three.

  1. Activate The linux subsystem for windows.
  2. Install a linux distro from the windows store(i use ubuntu)
  3. Install the WSL extension for VSCode.

Activate the linux subsystem

This is done by searching for "Turn windows features on or off" and checking the linux subsystem option.
.

Install the linux

Simple, get it, run it, love it.
.

Notes on the linux distro

this will come with git preinstalled, but i have compiled a set of nice to have features which you can copy paste to your WSL terminal to get to the godlike level of linux terminal control.

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
Enter fullscreen mode Exit fullscreen mode
  • Node version manager link
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
Enter fullscreen mode Exit fullscreen mode

NOTE: if you installed oh my zsh first, it will add the NVM to the path.

  • Yarn package manager link
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install --no-install-recommends yarn
Enter fullscreen mode Exit fullscreen mode

We will use the --no-install-recommends since we use NVM as our node host. Otherwise delete the flag.

nvm install <version number>
Enter fullscreen mode Exit fullscreen mode

The Visual Studio code part

Now this is where the magic happends, in VS Code install the plugin WSL
.

Now Simple ctrl-shift-p and search WSL and click open vscode in wsl.

VS code will then start a server in WSL and keep VSCode as a frontend.

If you open a terminal in the new vs code window it will open in the linux bash, and you are now free to keep bash or install zsh and be a linux god on Windows.

This should cover all the basic of getting to use WSL in Windows.
If you like WSL in windows with VS code, leave a comment below or show some love!

Top comments (0)