Windows Development

With the recent advent of .NET 5, I’m taking the plunge and setting up my gaming PC as a development work station. I haven’t had to setup a Windows PC since last year, so I figured it was time to revisit my setup and document what I did. Here we go!

Scoop

Chocolatey is usually the go-to package manager on Windows, but for awhile I’ve been watching the cool things done over at Scoop. After installing it, I wanted to do a few more things.

sudo command

It’s generally a pain-in-the-ass to run CLI things with elevated permissions, and in the past I’ve just run PowerShell as an admin. With the introduction of Windows Terminal, it’s once again difficult to just run things in admin. And that’s fine, really — we shouldn’t be running everything as admin anyway. So to make our lives easier, we can do the following in an elevated PowerShell terminal.

scoop install sudo --global

Then later — when we’re back in a non-elevated PowerShell in Windows Terminal — we can just do sudo <command> and be on our merry way. The sudo command will take care of prompting us to accept the elevated permissions (which we’re used to doing on Windows anyway with that second-nature pop-up) and then run the command, no-sweat. Tadaa! Then later when we want to install global packages like vim we can run the following without a second thought:

sudo scoop install vim --global

Default Git Config

There are a few approaches to this. The first is to figure out where your config file is and just edit it directly. You can figure out where each config is located by running the following:

git config --list --show-origin

The second way is to just run a bunch of commands, since that way you don’t need to worry about getting the syntax right. Here’s a list of commands I usually run:

git config --global core.editor "vim"
git config --global alias.co checkout
git config --global alias.b branch
git config --global alias.ci commit
git config --global alias.s status

PowerShell Setup

Next I want to activate some nicer features in PowerShell, so I need to edit my PowerShell profile. Since its location is stored in $profile I can just do

vim $profile

I can then add the following, for starters:

Import-Module posh-git
 Import-Module oh-my-posh
 Set-Theme Zash

 Set-Location ~/Workspaces

Obviously there’s lots more customization you can do. Scott Hanselman wrote a good post to get you started.

AutoHotkey

AutoHotkey is a lifesaver for anyone wanting to do keystroke customization on Windows. I specifically use it to rebind my caps lock key to escape. Below is the script I launch when Windows starts. (The script isn’t actually Ruby, but I wanted to get some syntax-highlighting working for y’all.)

#SingleInstance force
Capslock::Esc

Conclusion

There’s a lot of customization to be had here! My next steps will probably be to automate setup to some degree — I’ve already done that with my dotfiles repository for macOS. Now that I’ve become much more of a .NET developer over the years, I think it makes sense for me to be able to do development on either my MacBook Pro or my Windows gaming rig, whichever feels more comfortable, subject to my whimsy.