I ruined my Mac after upgrading to "Bug Sur", while waiting for Apple to relase a patch, I continue my stuff on my PC with a Windows 10 running on it.

I Know, right?!

I don't use Windows unless I play games. Windows has so-called "notorious" reputation for not being friendly to software engineers. However as I learned, 2020 is already a different year compared with 2002. Besides, they are just tools after all. As long as it does my sh**, I'm happy.

WSL is short for "Windows Subsystem for Linux". With WSL installed, you can do almost everything as if you were on a Linux machine. I tried WSL long time ago when it first released but I didn't utilize it correctly and I felt it was so bad at that time. However, tonight I read some articles and played with it, turned out it is quite good.

Install WSL and Linux Distribution

WSL

For this step, just follow the official guide.

WSL2 has been relased since September, 2020. I chose to use the latest one. Overall WSL2 is better except the file I/O, per Microsoft Documentation.

Linux Distribution

There are a couple Linux Distributions, the one that is getting quite popular recently is "Manjaro", but Windows store doesn't have it. Therefore I chose the one I'm most familiar with - Ubuntu and currently the latest version is 20.04.

Once Ubuntu is installed, simply launch it and create your username and password.

Install Windows Terminal

Although this step is optional, I'd highly recommend to have it. Windows Terminal is way better than the the Ubuntu native terminal.

Simply go to Windows Store and download one.

Configuration

The full configuration can be referenced from the official doc. What I did was to change the default launch terminal and the terminal theme.

Open the settings:
Windows Terminal Settings

It pops the settings.json file, I believe the names have been changed as the current documents all shows profile.json or default.json.

Notice the "guid" of the json file, for example, mine is shown as this:

"defaultProfile": "{2c4de342-38b7-51cf-b940-2309a097f518}",
...

"profiles":
{
    "list":
    [
      {
        "guid": "{2c4de342-38b7-51cf-b940-2309a097f518}",
        "name": "Ubuntu",
        ...
      },
      {
        // Make changes here to the powershell.exe profile.
        "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
        "name": "Windows PowerShell",
        ...
      },
    ]
  },

  ...

Just to make the defaultProfile has the same guid as your primary terminal, for my case, I'd like to have Ubuntu start when I launch Windows Terminal.

Theme

I use Nord, it's pretty good and I love it. You can find it here.

Install ZSH

Now you are accessing the Ubuntu. The first thing I usually do is to replace the default shell with zsh:

sudo apt-get update

then

sudo apt-get install zsh

oh-my-zsh

zsh is not easier to use, without certain configurations. I've tried many repos on Github, still oh-my-zsh is the best and easiest.

Simply

sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

Useful Plugins

zsh-autosuggestions

With this plugin you can auto-complete previously typed commands.

git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

Then in the ~/.zshrc, enable the plugin as

plugins = (git zsh-autosuggestions) # use space

zsh-syntax-highlighting

It shows better looking and suggests wrong command in terminal, in real time!
syntax-highlighting

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

Similarly, add it to ~/.zshrc plugins settings.

fzf
Fuzzy search for the history. fzf

git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install

# choose yes when fzf asks you to add configs to .zshrc file
# Those configs are used for running the tool

Starting from Here

At this point my setup is almost done. The rest of my work is to download my repos on Github. Maybe set up my editor since I use Vim mostly, but I also learned that VS Code is super cool under Windows, so I'm going to give it a try.

Happy coding!