From 0ca73bf02901c7647289efb19170845f19d90b0b Mon Sep 17 00:00:00 2001 From: Mathias Date: Mon, 21 Sep 2026 21:42:09 +0200 Subject: [PATCH] tmux: fix styling --- term/.config/tmux/tmux.conf | 18 ++++++++++++------ term/scripts/setup.sh | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 6 deletions(-) diff --git a/term/.config/tmux/tmux.conf b/term/.config/tmux/tmux.conf index 950a5ed..3fac407 100644 --- a/term/.config/tmux/tmux.conf +++ b/term/.config/tmux/tmux.conf @@ -42,6 +42,11 @@ bind x kill-pane # Auto-bootstrap TPM if not installed if "test ! -d ~/.config/tmux/plugins/tpm" \ "run 'git clone https://github.com/tmux-plugins/tpm ~/.config/tmux/plugins/tpm && ~/.config/tmux/plugins/tpm/bin/install_plugins'" +# Auto-install missing plugins when TPM exists but a plugin dir is absent +# (e.g. a new @plugin was added after the first bootstrap). +# NOTE: TPM clones `user/repo` to `plugins/repo`, so catppuccin/tmux -> plugins/tmux. +if "test ! -d ~/.config/tmux/plugins/tmux" \ + "run '~/.config/tmux/plugins/tpm/bin/install_plugins'" set -g @plugin 'tmux-plugins/tpm' set -g @plugin 'tmux-plugins/tmux-sensible' @@ -67,16 +72,17 @@ set -g @catppuccin_window_current_text "#W" set-environment -g TMUXIFIER_LAYOUT_PATH "$HOME/.tmuxifier/layouts" -# ── Initialize TPM (must be last line before status bar) ────────────────────── - -run '~/.config/tmux/plugins/tpm/tpm' - - # ── Status bar ──────────────────────────────────────────────────────────────── -# (must come after TPM run so catppuccin variables are available) +# NOTE: #{E:@catppuccin_...} expands at display time, so this intentionally +# comes before `run tpm` (TPM requires `run tpm` to be the last line). set -g status-position top set -g status-left-length 100 set -g status-right-length 100 set -g status-left "#{E:@catppuccin_status_session}" set -g status-right "#{E:@catppuccin_status_date_time}" + + +# ── Initialize TPM (must be last) ─────────────────────────────────────────── + +run '~/.config/tmux/plugins/tpm/tpm' diff --git a/term/scripts/setup.sh b/term/scripts/setup.sh index 32953ac..647fe87 100755 --- a/term/scripts/setup.sh +++ b/term/scripts/setup.sh @@ -84,6 +84,38 @@ install_tmuxifier() { fi } +install_tmux_tpm() { + if [[ -x "$HOME/.config/tmux/plugins/tpm/tpm" ]]; then + echo "tmux TPM bereits installiert; fahre fort." + else + echo "Klone tmux TPM ..." + mkdir -p "$HOME/.config/tmux/plugins" + git clone https://github.com/tmux-plugins/tpm "$HOME/.config/tmux/plugins/tpm" + fi +} + +install_tmux_plugins() { + local tpm_install="$HOME/.config/tmux/plugins/tpm/bin/install_plugins" + if ! command -v tmux >/dev/null 2>&1; then + echo "Warnung: tmux nicht installiert; ueberspringe Plugin-Installation (C-Space I beim ersten Start)." + return 0 + fi + if ! command -v git >/dev/null 2>&1; then + echo "Warnung: git nicht installiert; ueberspringe tmux Plugin-Installation." + return 0 + fi + if [[ ! -f "$HOME/.config/tmux/tmux.conf" ]]; then + echo "tmux.conf noch nicht verlinkt (stow laeuft nach setup.sh); Plugins werden beim ersten tmux-Start bzw. Re-Run installiert (C-Space I)." + return 0 + fi + if [[ ! -x "$tpm_install" ]]; then + echo "Warnung: TPM install_plugins nicht gefunden; ueberspringe tmux Plugin-Installation." + return 0 + fi + echo "Installiere tmux-Plugins via TPM ..." + "$tpm_install" +} + add_yazi_git_plugin() { if command -v yazi >/dev/null 2>&1 && command -v ya >/dev/null 2>&1; then if ya pkg list 2>/dev/null | grep -q 'yazi-rs/plugins:git'; then @@ -110,6 +142,8 @@ main() { set_fish_default_shell install_tmuxifier + install_tmux_tpm + install_tmux_plugins add_yazi_git_plugin echo "==> Aktualisiere locate-Datenbank ..."