57 lines
1.5 KiB
Bash
Executable File
57 lines
1.5 KiB
Bash
Executable File
#!/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 |