feat: persistent help tab with keybindings cheat sheet

- Colorized reference card auto-redraws on resize
- Ctrl-A ? jumps to help tab (recreates if closed)
- Fixed tmux config syntax error in capture/logging bindings
This commit is contained in:
Mortdecai
2026-03-26 19:20:47 -04:00
parent d1eea4f26a
commit ff33967020
3 changed files with 87 additions and 3 deletions
+7 -3
View File
@@ -113,8 +113,8 @@ bind -T copy-mode-vi y send -X copy-selection-and-cancel
bind -T copy-mode-vi MouseDragEnd1Pane send -X copy-selection-and-cancel bind -T copy-mode-vi MouseDragEnd1Pane send -X copy-selection-and-cancel
# --- Capture & logging --- # --- Capture & logging ---
bind S capture-pane -pS - \; save-buffer ~/logs/capture-#{session_name}-#{window_index}-#{pane_index}-#(date +%s).txt \; display "Pane captured to ~/logs/" bind S run-shell 'tmux capture-pane -pS - > ~/logs/capture-#S-#I-#P-$(date +%%s).txt && tmux display "Pane captured to ~/logs/"'
bind L pipe-pane -o "cat >> ~/logs/live-#{session_name}-#{window_index}-#(date +%s).log" \; display "Logging toggled" bind L pipe-pane -o 'cat >> ~/logs/live-#S-#I.log' \; display "Logging toggled"
# --- Clipboard --- # --- Clipboard ---
set -g set-clipboard on set -g set-clipboard on
@@ -154,5 +154,9 @@ set -g default-terminal "tmux-256color"
set -ga terminal-overrides ",xterm-256color:Tc" set -ga terminal-overrides ",xterm-256color:Tc"
set -sg escape-time 10 set -sg escape-time 10
# --- Help tab shortcut ---
# Ctrl-A ? = jump to help tab (or recreate if closed)
bind ? if-shell 'tmux select-window -t help 2>/dev/null' '' 'new-window -n help /opt/sethmux/sethmux-help.sh'
# --- Session startup layout --- # --- Session startup layout ---
# Windows created by sethmux-start.sh: code, git, run, logs # Windows created by sethmux-start.sh: code, git, run, logs, help
+79
View File
@@ -0,0 +1,79 @@
#!/bin/bash
# sethmux cheat sheet — runs in the persistent help tab
# Redraws on terminal resize via trap
draw() {
clear
COLS=$(tput cols)
W=$((COLS > 80 ? 80 : COLS))
ORANGE=$'\033[38;2;211;84;0m'
DIM=$'\033[2m'
BOLD=$'\033[1m'
WHITE=$'\033[97m'
GRAY=$'\033[90m'
RST=$'\033[0m'
UL=$'\033[4m'
echo ""
echo "${ORANGE}${BOLD} sethmux cheat sheet${RST}"
echo "${GRAY} ─────────────────────────────────────────────${RST}"
echo ""
echo "${ORANGE}${UL}Tabs${RST}${GRAY} (kitty-style)${RST}"
echo " ${WHITE}Ctrl+Shift+T${RST} New tab"
echo " ${WHITE}Ctrl+Shift+W${RST} Close tab"
echo " ${WHITE}Ctrl+Shift+Right${RST} Next tab"
echo " ${WHITE}Ctrl+Shift+Left${RST} Previous tab"
echo " ${WHITE}Ctrl+Shift+1-9${RST} Go to tab N"
echo " ${WHITE}Ctrl+Shift+. / ,${RST} Move tab fwd / back"
echo ""
echo "${ORANGE}${UL}Splits & Panes${RST}"
echo " ${WHITE}Ctrl+Shift+Enter${RST} New split"
echo " ${WHITE}Ctrl+Shift+] / [${RST} Next / prev pane"
echo " ${WHITE}Ctrl+Shift+L${RST} Cycle layouts"
echo " ${WHITE}F11${RST} Zoom pane (fullscreen)"
echo " ${WHITE}Ctrl-A v${RST} Split vertical ${DIM}(dvorak)${RST}"
echo " ${WHITE}Ctrl-A s${RST} Split horizontal ${DIM}(dvorak)${RST}"
echo ""
echo "${ORANGE}${UL}Scrollback & Copy${RST}"
echo " ${WHITE}Ctrl+Shift+Up/Down${RST} Scroll line"
echo " ${WHITE}Ctrl+Shift+PgUp/Dn${RST} Scroll page"
echo " ${WHITE}Ctrl+Shift+Home/End${RST} Top / bottom"
echo " ${WHITE}Ctrl+Shift+H${RST} Scrollback in pager"
echo " ${WHITE}Ctrl+Shift+C${RST} Enter copy mode (vi)"
echo " ${WHITE}Ctrl+Shift+V${RST} Paste"
echo " ${DIM} In copy mode: v=select y=yank q=quit${RST}"
echo ""
echo "${ORANGE}${UL}AI Workflow${RST}"
echo " ${WHITE}Ctrl-A S${RST} Save pane → ~/logs/"
echo " ${WHITE}Ctrl-A L${RST} Toggle live logging"
echo " ${WHITE}Ctrl+Shift+Delete${RST} Clear terminal+history"
echo ""
echo "${ORANGE}${UL}Quick Access${RST}${GRAY} (no prefix)${RST}"
echo " ${WHITE}Alt-T${RST} New tab"
echo " ${WHITE}Alt-W${RST} Close tab"
echo " ${WHITE}Alt-1..5${RST} Go to tab 1-5"
echo " ${WHITE}Alt-Left/Right${RST} Prev / next tab"
echo ""
echo "${ORANGE}${UL}Session Windows${RST}"
echo " ${WHITE}1:code${RST} ${WHITE}2:git${RST} ${WHITE}3:run${RST} ${WHITE}4:logs${RST} ${WHITE}5:help${RST} ${DIM}(this)${RST}"
echo ""
echo "${ORANGE}${UL}Mobile Toolbar${RST}"
echo " ${DIM}Row 1:${RST} +Tab Next Prev │ ^C ^D Clr │ Esc Tab ▲ ▼"
echo " ${DIM}Row 2:${RST} Sel Paste Zoom Save │ V.Spl H.Spl Pane Kill"
echo ""
echo "${ORANGE}${UL}Notifications${RST}"
echo " ${WHITE}sethmux-notify \"msg\"${RST} Push to browser"
echo " ${WHITE}cmd | sethmux-notify${RST} Pipe output"
echo ""
echo "${GRAY} ─────────────────────────────────────────────${RST}"
echo "${GRAY} Status bar shows: cwd + git branch + time${RST}"
echo "${GRAY} Scrollback: 200K lines │ Prefix: Ctrl-A${RST}"
echo ""
}
trap draw WINCH
draw
# Stay alive, redraw on resize
while true; do sleep 86400; done
+1
View File
@@ -11,6 +11,7 @@ tmux new-session -d -s "$SESSION" -n "code" -x 120 -y 40
tmux new-window -t "$SESSION" -n "git" tmux new-window -t "$SESSION" -n "git"
tmux new-window -t "$SESSION" -n "run" tmux new-window -t "$SESSION" -n "run"
tmux new-window -t "$SESSION" -n "logs" tmux new-window -t "$SESSION" -n "logs"
tmux new-window -t "$SESSION" -n "help" "/opt/sethmux/sethmux-help.sh"
tmux select-window -t "$SESSION:1" tmux select-window -t "$SESSION:1"
# Ensure logs dir exists # Ensure logs dir exists