Skip to content

Instantly share code, notes, and snippets.

@lexwitte
Last active April 9, 2026 16:49
Show Gist options
  • Select an option

  • Save lexwitte/7fdf3c06ad66c84ab95d8a5448748351 to your computer and use it in GitHub Desktop.

Select an option

Save lexwitte/7fdf3c06ad66c84ab95d8a5448748351 to your computer and use it in GitHub Desktop.
# -----------------------------------------------------------------------------
# WSL2 / Ubuntu install guide for this config
# 0) Nerd Font requirement
# This config is designed for a Nerd Font-enabled terminal because:
# - Starship expects a Nerd Font for its default prompt symbols
# - eza icons look best when the terminal can render Nerd Font glyphs
#
# Good choices:
# - FiraCode Nerd Font
# - CaskaydiaCove Nerd Font / Cascadia Code NF
#
# In Windows Terminal:
# - Settings -> your WSL profile -> Appearance -> Font face
# - set it to your Nerd Font, for example: Cascadia Code NF
#
# In VS Code integrated terminal:
# - set terminal.integrated.fontFamily to your Nerd Font, for example:
# "terminal.integrated.fontFamily": "CaskaydiaCove Nerd Font"
#
# If you do NOT want Nerd Fonts, remove icon-heavy eza aliases and use
# a Starship config/preset that avoids Nerd Font symbols.
#
# 1) Base packages
# sudo apt update
# sudo apt install -y zsh git curl unzip direnv fzf
#
# 2) Make zsh your login shell (optional but recommended)
# chsh -s "$(which zsh)"
#
# 3) Install Starship prompt
# curl -sS https://starship.rs/install.sh | sh
#
# 4) Install fnm (Fast Node Manager)
# # --skip-shell avoids fnm editing ~/.zshrc for us
# curl -fsSL https://fnm.vercel.app/install | bash -s -- --skip-shell
#
# 5) Install zoxide
# curl -sSfL https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | sh
# 6) Install eza
# sudo apt update
# sudo apt install -y gpg
# sudo mkdir -p /etc/apt/keyrings
# wget -qO- https://raw.githubusercontent.com/eza-community/eza/main/deb.asc | sudo gpg --dearmor -o /etc/apt/keyrings/gierens.gpg
# echo "deb [signed-by=/etc/apt/keyrings/gierens.gpg] http://deb.gierens.de stable main" | sudo tee /etc/apt/sources.list.d/gierens.list
# sudo chmod 644 /etc/apt/keyrings/gierens.gpg /etc/apt/sources.list.d/gierens.list
# sudo apt update
# sudo apt install -y eza
#
# 7) Docker zsh completion (requires docker CLI to already be installed)
# mkdir -p ~/.docker/completions
# docker completion zsh > ~/.docker/completions/_docker
#
# 8) Optional: install a Node LTS right away
# fnm install --lts
# fnm default lts-latest
#
# 9) Optional: VS Code shell integration
# # If `code` is on PATH, the block at the end of this file enables it.
#
# Notes:
# - Zinit installs itself automatically from GitHub below, so no separate step.
# - zsh plugins like fzf-tab, autosuggestions, and syntax highlighting are
# installed by Zinit; you do NOT install them manually.
# - Keep your repos inside the Linux filesystem in WSL, e.g. ~/src/project.
# -----------------------------------------------------------------------------
# ---------------------------
# Zinit
# ---------------------------
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
[[ -d $ZINIT_HOME/.git ]] || {
mkdir -p "${ZINIT_HOME:h}"
git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME"
}
source "${ZINIT_HOME}/zinit.zsh"
# ---------------------------
# History
# ---------------------------
HISTFILE="${XDG_STATE_HOME:-$HOME/.local/state}/zsh/history"
HISTSIZE=100000
SAVEHIST=100000
setopt APPEND_HISTORY
setopt SHARE_HISTORY
setopt HIST_IGNORE_DUPS
setopt HIST_IGNORE_ALL_DUPS
setopt HIST_FIND_NO_DUPS
setopt HIST_REDUCE_BLANKS
setopt HIST_VERIFY
setopt INTERACTIVE_COMMENTS
# ---------------------------
# Completion
# ---------------------------
FPATH="$HOME/.docker/completions:$FPATH"
zstyle ':completion:*' menu no
zstyle ':completion:*:descriptions' format '[%d]'
autoload -Uz compinit
compinit
# ---------------------------
# Plugins
# ---------------------------
zinit snippet OMZP::git
# fzf-tab should load after compinit, before autosuggestions/highlighting
zinit light Aloxaf/fzf-tab
zinit light zsh-users/zsh-autosuggestions
zinit light zdharma-continuum/fast-syntax-highlighting
# ---------------------------
# Local user binaries
# ---------------------------
typeset -U path PATH
path=(
"$HOME/.local/bin"
"${XDG_DATA_HOME:-$HOME/.local/share}/fnm"
$path
)
export PATH
# ---------------------------
# Tool init
# ---------------------------
eval "$(starship init zsh)"
eval "$(fnm env --shell zsh --use-on-cd --version-file-strategy=recursive --corepack-enabled)"
eval "$(zoxide init zsh)"
eval "$(direnv hook zsh)"
# ---------------------------
# Aliases / functions
# ---------------------------
alias dc='docker compose'
alias dcu='docker compose up'
alias dcd='docker compose down'
alias dps='docker ps'
alias zshconfig='${EDITOR:-vim} ~/.zshrc'
de() {
docker exec -it "$@"
}
dce() {
docker compose exec "$@"
}
dsh() {
local c="$1"
[[ -z "$c" ]] && { echo "usage: dsh <container>"; return 1; }
docker exec -it "$c" sh -lc 'command -v bash >/dev/null 2>&1 && exec bash || exec sh'
}
dcsh() {
local s="$1"
[[ -z "$s" ]] && { echo "usage: dcsh <service>"; return 1; }
docker compose exec "$s" sh -lc 'command -v bash >/dev/null 2>&1 && exec bash || exec sh'
}
# ---------------------------
# eza
# ---------------------------
alias ls='eza --group-directories-first --icons=auto'
alias l='eza --git-ignore --group-directories-first --icons=auto'
alias ll='eza --all --header --long --git --group-directories-first --icons=auto'
alias la='eza --all --group-directories-first --icons=auto'
alias lt='eza --tree --level=2 --group-directories-first --icons=auto'
alias tree='eza --tree --group-directories-first --icons=auto'
# ---------------------------
# VS Code shell integration
# ---------------------------
if [[ "$TERM_PROGRAM" == "vscode" ]] && command -v code >/dev/null 2>&1; then
. "$(code --locate-shell-integration-path zsh)"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment