Skip to content

Latest commit

 

History

History
210 lines (154 loc) · 5.85 KB

2020-wsl2-journey.md

File metadata and controls

210 lines (154 loc) · 5.85 KB

Pre-work & Install WSL2

New Environment

  • sudo apt update
    • Needed to turn off the VPN so DNS would resolve /shrug
  • sudo apt upgrade

Install Fonts

You should do this before you install Powerlevel10k, so that the configuration displays the correct fonts.

Follow the instructions here. It will tell you how to install fonts for VSCode & Microsoft Terminal. Download them, highlight, right click, install.

https://github.com/romkatv/powerlevel10k/blob/master/README.md#meslo-nerd-font-patched-for-powerlevel10k

VS Code

Open FilePreferencesSettings, enter terminal.integrated.fontFamily in the search box and set the value to MesloLGS NF.

Microsoft Terminal Settings

Add this to your corresponding profile after you have installed the fonts.

"fontFace": "MesloLGS NF"

Gnome Terminal

  • Open Terminal
  • Preferences
  • Profiles (Pop)
  • Change Custom Font to MesloLGS NF Regular

Install ZSH & Oh My ZSH & Powerlevel 10k

# https://blog.nillsf.com/index.php/2020/02/17/setting-up-wsl2-windows-terminal-and-oh-my-zsh/
sudo apt install git zsh -y

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

# Consider restarting/reopening a new shell
# https://github.com/romkatv/powerlevel10k
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
# Set ZSH_THEME="powerlevel10k/powerlevel10k" in ~/.zshrc.
# Restart/reopen a new shell
# You should be presented with the Powerlevel10k Conifguration Wizard
# You may want to get 

Gnome Users

If you're following these on Unix on something like Pop! OS and you're using the Gnome Terminal, then you will need to also need to set the terminal to zsh.

  • Open Terminal
  • Preferences
  • Profiles (Pop)
  • Command Tab
  • Check Run a custom Command instead of my shell set it to zsh
    • Make sure When command exists: is set to Exit the terminal

Aliases

code ~/.zshrc

# Add these to `~/.zshrc`, should have some examples commented out near the bottom
alias projects="cd ~/projects"

Protip: run source ~/.zshrc to reload the changes.

Change Prompt Icons

If you chose to have many icons, I often don't need to see the OS in the terminal, so I remove it.

  • Open ~/.p10k.zsh
  • Find the line with POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
  • Comment out os_icon

ASDF Version Manager

sudo apt install curl git
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.8.0

code ~/.zshrc
# Add `asdf` to plugins section ie: `plugins=(git asdf)`

Install Node JS

asdf plugin-add nodejs [email protected]:asdf-vm/asdf-nodejs.git

# https://github.com/asdf-vm/asdf-nodejs/issues/119
bash ~/.asdf/plugins/nodejs/bin/import-release-team-keyring

# List available versions
asdf list-all nodejs
# Remember even major versions are LTS and odd are not
asdf install nodejs 14.15.1
# Set global so that npm/npx works
asdf global nodejs 14.15.1 

Add SSH Key to Github

# I tend to use no password if my system is already protected, and I use the same passwords anyways. Sloppy, but eh. 🤫
ssh-keygen -t ed25519 -C "[email protected]"
ssh-add ~/.ssh/id_ed25519

# https://stackoverflow.com/questions/18695934/unable-to-copy-ssh-id-rsa-pub
# Be patient
clip < ~/.ssh/id_ed25519.pub
# or just cat it and copy it
cat ~/.ssh/id_ed25519.pub

Add GPG Key to Github

Generate a GPG Key

# Note: Size must be at least 4096
# No passphrase to avoid annoying VS Code integration with secure commits
gpg --full-generate-key

# Grab the hash from `sec`
# ie: sec   rsa4096/DEADBEEF1337 2020-11-28 [SC]
#  You would copy: DEADBEEF1337
gpg --list-secret-keys --keyid-format LONG

gpg --armor --export DEADBEEF1337
# or slow clipboard method
gpg --armor --export DEADBEEF1337 | clip.exe

Use VSCode for Git Operations

git config --global core.editor "code --wait"

Now you can use git config --global -e

Configure Git

This will allow:

  • To make commits with your name and email
  • VSCode for Git Editor
  • VSCode for Git Differencing & Merging
  • Sign commits

Note: Change singing key with the hash from the GPG Generation step above.

[user]
	name = "Your Cool Name"
	email = "[email protected]"
	signingkey = "DEADBEEF1337"
[commit]
	gpgsign = true
[tag]
	gpgsign = true
[core]
	editor = "code --wait"
[diff]
	tool = default-difftool
[difftool "default-difftool"]
	cmd = code --wait --diff $LOCAL $REMOTE
[merge]
	tool = vscode
[mergetool "vscode"]
	cmd = code --wait $MERGED

Configure VSCode to Sign Commits

"git.enableCommitSigning": true