Skip to content

Instantly share code, notes, and snippets.

@imfing
Last active September 15, 2023 01:55
Show Gist options
  • Save imfing/d7a58eb676a784c57f49afc46ca2f56f to your computer and use it in GitHub Desktop.
Save imfing/d7a58eb676a784c57f49afc46ca2f56f to your computer and use it in GitHub Desktop.
WSL + ZSH + Hyper Setup

My WSL Setup

A guide to setup your WSL with Hyper and zsh

Download & Install the WSL

  • Follow the very thorough instructions here

Get a prettier terminal

  • Download Hyper.js here - I went with the 'hyperblue' theme.

Automatically open in Bash

  • Open up Hyper and type Ctrl + ,
  • Scroll down to shell and change it to C:\\Windows\\System32\\bash.exe

Install Zsh

  • Run this sudo apt-get install zsh
  • Open your bash profile nano ~/.bashrc
  • Add this to set it to use ZSH as default:
if [ -t 1 ]; then
exec zsh
fi

Get your terminal looking pretty pt.2

  • Install Oh My Zsh with sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
    • Read docs here on how to add more plugins and change themes (I went with their out of the box 'robbyrussell').

Zsh Syntax Highlighting

This was a late addition but is an amazing add-on to the terminal. Follow the steps here to get it up and running.

Zsh Auto Suggestions

Another late addition but amazing as well. Just follow the Maunal instructions here.

Fix the ls and cd colours

Out of the box when you ls or cd + Tab you get some nasty background colours on the directories. To fix this, crack open your ~/.zshrc file and add this to the end:

#Change ls colours
LS_COLORS="ow=01;36;40" && export LS_COLORS

#make cd use the ls colours
zstyle ':completion:*' list-colors "${(@s.:.)LS_COLORS}"
autoload -Uz compinit
compinit

Install Git

  • Run this sudo apt update
  • Then run sudo apt install git

Setup a SSH key and link to your Github

  • Follow the Linux steps here to create a key and add it to your SSH agent
  • Then type cat ~/.ssh/id_rsa.pub
  • Copy your key from the terminal and paste it into your Github keys

Install Gulp CLI

  • Follow the Gulp docs here.

Aliases

Just to test out using aliases, I picked a few things I type a lot into the terminal that could save me some keystrokes. Add this to your .zshrc file to do the same and add anything else you see fit:

# aliases for git
alias add='git add -A'
alias status='git status'
alias push='git push -u origin master'
alias pull='git pull'
alias log='git log'

Always Update & Upgrade

Every few days it's a good idea to run sudo apt update then sudo apt upgrade to get the latest updates from Ubuntu.

Easter Eggs

A few goodies I installed recently for fun:

  • Cowsay sudo apt-get install cowsay
  • htop sudo apt-get install htop
  • Isn't via apt-get but Bash-Snippets is great
@hjdarnel
Copy link

This is awesome, thank you! Especially the ls color fixes! I just reinstalled Ubuntu, but I didn't have that fixed even before :)

@jacksonblankenship
Copy link

Thanks, this worked perfect.

@pau-lo
Copy link

pau-lo commented Nov 24, 2020

Great. Just started using wsl2. Thanks.

@aaronpaulgz
Copy link

Thanks
Worked perfect for me

@aybasaran
Copy link

Awesome guide!!! TYTY

@AkshatBajaj
Copy link

Awesome, thanks 👍

@JhonWilderParionaVilca
Copy link

Thanks 😀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment