Skip to content

Instantly share code, notes, and snippets.

@fedemengo
Last active May 18, 2026 10:45
Show Gist options
  • Select an option

  • Save fedemengo/e7d95a98ac22d58004ba7b001219b04f to your computer and use it in GitHub Desktop.

Select an option

Save fedemengo/e7d95a98ac22d58004ba7b001219b04f to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -euo pipefail
# ── colours ────────────────────────────────────────────────────────────────────
RED='\033[0;31m'; GREEN='\033[0;32m'; YELLOW='\033[1;33m'; CYAN='\033[0;36m'; NC='\033[0m'
info() { echo -e "${CYAN}==>${NC} $*"; }
success() { echo -e "${GREEN}✓${NC} $*"; }
warn() { echo -e "${YELLOW}⚠${NC} $*"; }
die() { echo -e "${RED}✗ $*${NC}" >&2; exit 1; }
# ── helpers ────────────────────────────────────────────────────────────────────
need() { command -v "$1" &>/dev/null || die "Required tool not found: $1"; }
# ── preflight: sudo deps must already be installed ────────────────────────────
info "Checking required system dependencies"
missing=()
for cmd in xclip xsel fdfind rg nvim; do
command -v "$cmd" &>/dev/null || missing+=("$cmd")
done
if [[ ${#missing[@]} -gt 0 ]]; then
die "Missing system deps: ${missing[*]}
Install them first (requires sudo):
sudo apt install -y xclip xsel fd-find ripgrep
sudo snap install nvim --classic"
fi
success "All system dependencies present"
# ── 1. dotfiles ────────────────────────────────────────────────────────────────
info "Setting up dotfiles"
if [[ ! -d "$HOME/.dotfiles" ]]; then
git clone git@github.com:fedemengo/.dotfiles.git --recursive "$HOME/.dotfiles"
else
warn ".dotfiles already cloned — updating submodules"
git -C "$HOME/.dotfiles" submodule update --init --recursive
fi
success "dotfiles ready"
# ── 2. oh-my-zsh ───────────────────────────────────────────────────────────────
info "Installing oh-my-zsh"
if [[ ! -d "$HOME/.oh-my-zsh" ]]; then
RUNZSH=no KEEP_ZSHRC=yes \
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
else
warn "oh-my-zsh already installed — skipping"
fi
success "oh-my-zsh ready"
# ── 3. zsh plugins & theme ─────────────────────────────────────────────────────
ZSH_CUSTOM="${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}"
info "Installing powerlevel10k theme"
if [[ ! -d "$ZSH_CUSTOM/themes/powerlevel10k" ]]; then
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git \
"$ZSH_CUSTOM/themes/powerlevel10k"
else
warn "powerlevel10k already installed — skipping"
fi
info "Installing zsh-autosuggestions plugin"
if [[ ! -d "$ZSH_CUSTOM/plugins/zsh-autosuggestions" ]]; then
git clone https://github.com/zsh-users/zsh-autosuggestions \
"$ZSH_CUSTOM/plugins/zsh-autosuggestions"
else
warn "zsh-autosuggestions already installed — skipping"
fi
success "zsh plugins ready"
# ── 5. symlink configs ─────────────────────────────────────────────────────────
info "Linking .zshrc"
rm -f "$HOME/.zshrc"
ln -s "$HOME/.dotfiles/.zshrc" "$HOME/.zshrc"
success ".zshrc linked"
info "Linking .config"
rm -rf "$HOME/.config"
ln -s "$HOME/.dotfiles/.config" "$HOME/.config"
success ".config linked"
info "Linking .gitconfig"
rm -rf "$HOME/.gitconfig"
ln -s "$HOME/.dotfiles/.gitconfig" "$HOME/.gitconfig"
success ".gitconfig linked"
# ── 6. neovim ──────────────────────────────────────────────────────────────────
success "neovim ready"
# ── 7. nvm + Node LTS ─────────────────────────────────────────────────────────
info "Installing nvm"
if [[ ! -d "$HOME/.nvm" ]]; then
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash
fi
# source nvm so we can use it immediately
export NVM_DIR="$HOME/.nvm"
# shellcheck disable=SC1091
[[ -s "$NVM_DIR/nvm.sh" ]] && source "$NVM_DIR/nvm.sh"
info "Installing Node LTS"
nvm install --lts
success "Node LTS installed"
# ── 8. Python LSP tools ────────────────────────────────────────────────────────
info "Installing Python LSP tools via uv"
need uv
uv tool install python-lsp-server
uv tool install black
uv tool install ruff
success "Python tools installed"
# ── 9. tmux plugin manager ─────────────────────────────────────────────────────
info "Installing tpm (tmux plugin manager)"
if [[ ! -d "$HOME/.tmux/plugins/tpm" ]]; then
git clone https://github.com/tmux-plugins/tpm "$HOME/.tmux/plugins/tpm"
else
warn "tpm already installed — skipping"
fi
success "tpm ready"
# ── done ───────────────────────────────────────────────────────────────────────
echo -e "${YELLOW}To set zsh as default shell run:${NC} chsh -s $(which zsh)"
echo ""
echo -e "${GREEN}All done!${NC} Re-login or run: ${CYAN}exec zsh${NC}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment