mirror of
https://github.com/andwati/dotfiles.git
synced 2026-10-18 02:52:52 +00:00
Bumps the GPG passphrase cache from the 10-minute default to 8 hours (24h hard cap) and switches to pinentry-qt for a native KDE dialog, so signed commits stop re-prompting constantly.
55 lines
2.1 KiB
Bash
Executable File
55 lines
2.1 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"
|
|
|
|
mkdir -p "$HOME/.gnupg"
|
|
chmod 700 "$HOME/.gnupg"
|
|
link "$DOTFILES_DIR/gnupg/.gnupg/gpg-agent.conf" "$HOME/.gnupg/gpg-agent.conf"
|
|
gpgconf --kill gpg-agent 2>/dev/null || true
|
|
|
|
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
|