Newer
Older
ops-toolkit / packs / tmux / install-030-tpm.sh
@JANeumatrix JANeumatrix 2 hours ago 980 bytes Initial upload
#!/usr/bin/env bash
# packs/tmux/install-030-tpm.sh -- install TPM (tmux plugin manager).
#
# Mutates: clones https://github.com/tmux-plugins/tpm into
# ~/.tmux/plugins/tpm if not already present. No-ops if it is.
# Plugin installation itself is interactive: inside tmux, press prefix + I.
#
# Usage: bash install-030-tpm.sh   [TOOLKIT_DRY_RUN=1 to preview]
# Exit codes: 0 PROCEED, 1 HOLD, 2 precondition missing. ASCII + LF.

set -euo pipefail
shopt -s inherit_errexit 2>/dev/null || true
IFS=$'\n\t'
PACK_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
. "$PACK_DIR/../../lib/lib-install.sh"

require_cmd git "apt-get install git"

TPM_DIR="$HOME/.tmux/plugins/tpm"
if [ -d "$TPM_DIR/.git" ]; then
    ok "TPM already present: $TPM_DIR (update inside tmux with prefix + U)"
else
    ensure_dir "$HOME/.tmux/plugins"
    run_mut git clone --depth 1 https://github.com/tmux-plugins/tpm "$TPM_DIR"
    ok "TPM installed; start tmux and press prefix + I to install plugins"
fi