Development environment based on Windows Terminal + WSL + ZSH + dotfiles

Introduction

I would like to share with you how to implement dotfiles concept for your working environment lightning fast. This post is based on my dotfiles repository — nikiforovall/dotifles.

It is a good time to be a .NET developer. It is not only mature and enterprise-ready ecosystem but vibrant and active community. I feel like guys from Microsoft doing a lot to support and encourage .NET community. In particular, that is why we have something like Windows Subsystem For Linux, Windows Terminal and many more.

So I use Windows Terminal. It is a modern terminal emulator for windows. I switched from a really nice terminal emulator cmder to Windows Terminal (Preview). And I don’t regret it, especially after the release of Windows Terminal Preview v0.7 Release. This release includes PowerLine fonts for Cascadia Fonts, tab reordering splitting of tab windows into panes. Sweat!

Windows Terminal is highly configurable, so you could adjust keybindings, color schemes, and profiles.

You can install Windows Terminal from Microsoft Store or by using chocolatey windows package manager.

Also, see my Windows Terminal profiles.json https://github.com/NikiforovAll/dotfiles/tree/master/artifacts/wt_profile.json.

I use Visual Studio Code as the main editor and development environment. Although, it is possible to use dotfiles for synchronization concept for I encourage you to use Settings Sync extension. It uses GitHub as storage and makes use of API key to authorize and manage your configurations. You could install it like this:

And now, here where the fun begins. The end goal is to bootstrap and configure working environment with the minimum effort. Basically, we want to run bash one-liner and have everything arranged nice and clean. Something like:

WSL Setup

But first, let’s see how we set up brand new WSL instance. Here I list available Linux distros and unregister ubuntu-18.04

Let’s register new user in Ubuntu-18.04 LTS.

And set default distro “Ubuntu-18.04”

We can login to WSL via Windows Terminal by specifying in corresponding Windows Terminal profile.

Installation

🔧 If it is a brand-new WSL instance you might want to run . In the demo below I've already had everything.

Let’s see how the bash one-liner works:

It installs a bunch of essentials for development environment: utils, tools, and dotnet sdk. Also, it symlinks git and shell configs. So after reloading your shell, it is familiar and responsive working environment. The goal of dotfiles technique is to provide the way to manage various .* configuration files. The basic idea is to have git repository responsible for installing and managing configurations on a working machine so you don’t need to worry about losing favorite aliases, programs, and configurations. Perfect! 🚀

Demo

At the demonstration below I create a folder for the new dotnet console project. I slightly modify Program.cs and run the application inside WSL. There are a lot of details that make the process of development easier and promote productivity. I just mention a few of them: simplicity of setup, syntax and commands highlighting and autocompletion.

Summary

It was a brief overview of my dotfiles setup. I encourage you to investigate the internals of my dotfiles repository for mode details. Feel free to fork and work on dream setup of your own. Let me know what you think about it!

Originally published at https://nikiforovall.github.io.

Software Engineer at EPAM