Derek Croote

Configuring a new laptop

This post is mostly for my future self, but others may find it useful. It assumes a Windows machine (😱), with most development work done in WSL 2.

General

  • Replace the preinstalled antivirus trial with something legitimate. If you don’t do this first the popups will drive you insane.
  • Uninstall bloatware, trials, games, etc.
  • Disable personalization and related ‘features’
  • Disable unnecessary programs at startup in Task Manager
  • Disable Bing in the Windows 11 start menu (instructions)

Windows programs:

  • Inkscape
  • paint.net
  • Brave
  • Docker desktop
  • VS Code - use Settings Sync to easily port entire setup (extensions, keybindings, fonts, etc.) to a new machine or Codespaces
  • Alacritty - modern terminal emulator, configured for WSL 2 as follows in the file %APPDATA%\alacritty\alacritty.toml:
[shell]
args = ["--cd ~"]
program = "wsl"

Software dev

First things first

Install WSL2 using PowerShell as an administrator:

wsl --install -d Ubuntu-22.04

On WSL2:

sudo apt update
sudo apt upgrade
sudo apt install ripgrep tree tmux

ssh, gpg, and git

Generate a GPG key for signing commits:

gpg --full-generate-key

WSL 2 needed the following added to ~/.profile to avoid the error gpg failed to sign the data:

export GPG_TTY=$(tty)

Configure git:

git config --global user.email "github_username@users.noreply.github.com"
git config --global user.name "name"
git config --global core.editor vim
git config --global commit.gpgsign true
gpg --list-secret-keys --keyid-format=long

Now use signing key from above command:

git config --global user.signingkey <16 character key>

Create an ssh key for GitHub:

ssh-keygen -t ed25519 -C "github_username@users.noreply.github.com"

Developer experience

  • starship - fast and useful prompt e.g. displays current git branch and Node version
  • fzf - fast finding. I suggest installing with git since package manager versions can be quite outdated. Enable key bindings.
  • ripgrep - rust alternative of grep, installed in command above
  • nvm - install and switch between multiple node environments seamlessly
  • miniforge - python package manager without the environment solving issues. Bonus tip: use mamba instead of conda.
  • My own vim preferences
  • gitalias simplifies git e.g. git c instead of git commit and git s instead of git status. It might seem unimportant, but the frequency with which these commands are used can accrue nontrivial time and keystroke savings. There are also handy aliases for when you find yourself in some weird merge hell and need to torch everything and reset to upstream / pristine.
  • difftastic generates diffs that better distinguish meaningful changes from formatting changes e.g. nesting, alignment, and wrapping.
curl https://raw.githubusercontent.com/GitAlias/gitalias/main/gitalias.txt -o ~/.gitalias.txt
git config --global include.path ~/.gitalias.txt

.bashrc aliases and exports. At a bare minimum, for me:

alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
alias v="vim"
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."

Let me know if there is anything I missed!

Share on:

This work by Derek Croote is licensed under CC BY-NC 4.0Creative Commons IconCreative Commons Attribution IconCreative Commons Noncommercial Icon