Modern Command Line tooling - Windows edition!

Introduction

In a previous article I've walked through some of the modern command line tools I use on a regular basis when I'm working on Linux. The good news is that all the tools mentioned in my previous article work perfectly on Windows. The bad news is that we don't have zsh on Windows and we're stuck with Powershell.

Getting the tools ready

Installing every command line tool I mentioned in the previous article is absolutely possible by hand, but it's incredibly tedious compared to just using aptitude/pacman/$(yourFavoritePackageManager) on Linux. While Windows does come with a package manager in winget, most of these command line tools are not available through winget (yet?).

Fortunately there are alternatives to winget, namely chocolatey and scoop. I personally vastly prefer scoop, because it installs portable executables behind symlinks, which enables snappier installation and updates. For applications that can't function perfectly in portable mode I still recommend choco or winget though!

Getting everything through scoop is as simple as running the following command:

scoop install starship bat btop-lhm delta fd fzf hyperfine lazygit ripgrep zoxide

The only tool that's unavailable through scoop is exa. In order to get exa for Windows you can either build it from source, or you can get a prebuilt binary from one of the pull requests on Github. I won't provide a link to an unverified binary here, but those that can find it themselves on Github probably know the risks.

We're going to space

So now that our tools are installed, how do we go about replicating the look and feel of oh-my-zsh on Windows?

The first option people generally bump into is oh-my-posh. The naming's no coincidence: it's very explicitly built to be a replacement of oh-my-zsh on Powershell. In my experience however oh-my-posh ends up being somewhat slow, especially when you start using a lot of segments/plugins. With that said, oh-my-posh is decent and it replicates the look of oh-my-zsh themes very well.

Starship on Powershell Core

Starship is another option. It's cross-platform prompt that leverages the underlying shell while providing a set of very performant, cross-platform plugins that emulate both the look and feel of zsh. In my experience Starship is much more responsive than oh-my-posh, but as always, your mileage may vary.

Getting fancy with Powershell

While both oh-my-posh and Starship are good at replicating the basics of Linux shells, they

Setting up syntax highlighting and autocompletion is very simple. All you need is a module called PSReadLine, which you can install by running Install-Module PSReadLine in Powershell.

Syntax highlighting

Once installed, you need to add Import-Module PSReadLine to your Powershell profile so the module is loaded every time you start Powershell. This'll enable both syntax highlighting and autocompletion/predictions by default. PSReadLine enables some additional neat customizations though, so make sure to take a look at their docs.

Where's my fzf?

If you love fzf as much as I do and use it for virtually everything on Linux, then I have good news for you. A module called PSFzf replicates a significant portion of the completion functionality of fzf on zsh. Installation is the exact same as it was for PSReadLine - run Install-Module PSFzf and then add Import-Module PSFzf to your Powershell profile.

Fzf search on Windows

Customization for PSFzf is a bit more involved though, so I highly suggest taking a look at the project's documentation. My Powershell profile could also serve as inspiration, although most of it just taken from the aforementioned github docs.

Conclusion

All in all, once you've installed and set up everything described in this article you'll have a shell that's decently close to its Linux counterpart. Obviously the performance won't be comparable, but hey, you're probably not developing Windows for its snappy performance anyway.

Previous articleModern Command Line tooling
Next articleBook Recommendations