Files
herolib_python/examples/tmuxrunnerexamples/tasks/1/tmux_config.sh
2025-08-25 07:06:50 +02:00

57 lines
1.5 KiB
Bash
Executable File
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env bash
set -euo pipefail
source source ../../functions/base.sh
# --- create ~/.tmux.conf ---
TMUX_CONF="$HOME/.tmux.conf"
cat > "$TMUX_CONF" <<'EOF'
# ~/.tmux.conf
# Enable mouse support (scroll, resize, select panes/windows)
set -g mouse on
# Use the mouse wheel to scroll in copy mode automatically
bind -T root WheelUpPane if-shell -F -t = "#{mouse_any_flag}" \
"send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'copy-mode -e'"
# Allow resizing panes by dragging borders
setw -g aggressive-resize on
# Easier navigation in copy mode
setw -g mode-keys vi
# Status bar improvements
set -g status-bg black
set -g status-fg green
set -g status-left-length 40
set -g status-left '#S '
set -g status-right '#(whoami)@#H %Y-%m-%d %H:%M'
# Pane borders more visible
set -g pane-border-style fg=cyan
set -g pane-active-border-style fg=yellow
# Reload config quickly
bind r source-file ~/.tmux.conf \; display-message "Reloaded tmux.conf"
# Use system clipboard on macOS
if-shell "command -v pbcopy >/dev/null 2>&1" \
"bind -T copy-mode-vi y send -X copy-pipe-and-cancel 'pbcopy'" \
"bind -T copy-mode-vi y send -X copy-pipe-and-cancel 'xclip -selection clipboard -in'"
EOF
echo "✅ Wrote $TMUX_CONF"
# --- apply config if tmux is running ---
if pgrep -x tmux >/dev/null 2>&1; then
echo "🔄 Reloading tmux config..."
tmux source-file "$TMUX_CONF"
else
echo " tmux is not running yet. Config will apply on next start."
fi
mark_done