mirror of
https://github.com/andwati/dotfiles.git
synced 2026-10-18 02:52:52 +00:00
Cuts shell startup from ~440ms to ~150ms by lazy-loading nvm and pyenv (previously sourced eagerly on every shell start) and caching oh-my-zsh's completion rescan, which otherwise reran unconditionally every session. Also fixes a latent bug where oh-my-zsh's extendedglob option silently broke nvm's default-version auto-activation. Adds powerlevel10k, zsh-autosuggestions, zsh-syntax-highlighting, zsh-history-substring-search, zsh-completions, you-should-use, fzf, and zoxide. install.sh bootstraps a fresh machine: symlinks these dotfiles and clones the oh-my-zsh theme/plugins.
50 lines
1.9 KiB
Bash
Executable File
50 lines
1.9 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Bootstraps zsh config on a new machine: symlinks dotfiles into $HOME and
|
|
# clones oh-my-zsh + the custom theme/plugins referenced by .zshrc.
|
|
set -euo pipefail
|
|
|
|
DOTFILES_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
ZSH_CUSTOM="${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}"
|
|
|
|
link() {
|
|
local src="$1" dst="$2"
|
|
if [ -e "$dst" ] && [ ! -L "$dst" ]; then
|
|
mv "$dst" "$dst.bak.$(date +%s)"
|
|
echo "Backed up existing $dst"
|
|
fi
|
|
ln -sfn "$src" "$dst"
|
|
echo "Linked $dst -> $src"
|
|
}
|
|
|
|
clone_if_missing() {
|
|
local url="$1" dst="$2"
|
|
[ -d "$dst" ] || git clone --depth=1 "$url" "$dst"
|
|
}
|
|
|
|
if [ ! -d "$HOME/.oh-my-zsh" ]; then
|
|
echo "Installing oh-my-zsh..."
|
|
RUNZSH=no CHSH=no KEEP_ZSHRC=yes sh -c \
|
|
"$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
|
|
fi
|
|
|
|
clone_if_missing https://github.com/romkatv/powerlevel10k.git "$ZSH_CUSTOM/themes/powerlevel10k"
|
|
clone_if_missing https://github.com/zsh-users/zsh-autosuggestions "$ZSH_CUSTOM/plugins/zsh-autosuggestions"
|
|
clone_if_missing https://github.com/zsh-users/zsh-syntax-highlighting.git "$ZSH_CUSTOM/plugins/zsh-syntax-highlighting"
|
|
clone_if_missing https://github.com/zsh-users/zsh-history-substring-search "$ZSH_CUSTOM/plugins/zsh-history-substring-search"
|
|
clone_if_missing https://github.com/zsh-users/zsh-completions "$ZSH_CUSTOM/plugins/zsh-completions"
|
|
clone_if_missing https://github.com/MichaelAquilina/zsh-you-should-use "$ZSH_CUSTOM/plugins/you-should-use"
|
|
|
|
link "$DOTFILES_DIR/zsh/.zshrc" "$HOME/.zshrc"
|
|
link "$DOTFILES_DIR/zsh/.zshenv" "$HOME/.zshenv"
|
|
link "$DOTFILES_DIR/zsh/.zprofile" "$HOME/.zprofile"
|
|
link "$DOTFILES_DIR/zsh/.p10k.zsh" "$HOME/.p10k.zsh"
|
|
|
|
cat <<'EOF'
|
|
|
|
Done. This does NOT install (grab these separately if missing):
|
|
- nvm, pyenv, bun, pnpm, deno, rustup, docker, fzf, zoxide
|
|
- a Nerd Font (JetBrains Mono Nerd Font) — set it as your terminal's font
|
|
|
|
Start a new shell to pick everything up: exec zsh
|
|
EOF
|