Something that I used to struggle with is remembering whether or not I'm currently zoomed into a particular pane on any particular TMUX window.
The following is what I implemented to resolve this problem for myself, and I thought this may be interesting to others.
In my tmux.conf
file, I added the following zoom binding:
# automatically reload zoomed-in status
bind z {
resize-pane -Z
if-shell "tmux list-panes -F '#{?window_zoomed_flag,yes,no}' | grep yes" {
set -g status-left "[#S | ZOOMED-IN ] " ## Print session label in the left side of the status bar
} {
set -g status-left "[#S] " ## Print session label in the left side of the status bar
}
}
...
...
# simple pane rename binding
bind R command-prompt -p "(rename-pane)" -I "#T" { select-pane -T "%%" }
...
...
# setting the pane status bar how I like it
set -g pane-border-style fg=yellow
set -g pane-active-border-style "bg=default fg=yellow"
set -g pane-border-status top
set -g pane-border-format "[ ###P | #T | CMD: `#{pane_current_command}` ]"
The result is that when I'm "zoomed out" I see, the following in my window status bar:
[SESSION_NAME] (0: WINDOW_NAME)
──[ #0 | PANE_NAME | CMD: `zsh`]───────────
When I zoom into pane #0, my window status bar shows the following:
[SESSION_NAME | ZOOMED-IN ] (0: WINDOW_NAME)
──[ #0 | PANE_NAME | CMD: `zsh`]───────────
Zooming out will automatically return the window status bar back to what it originally was:
[SESSION_NAME] (0: WINDOW_NAME)
──[ #0 | PANE_NAME | CMD: `zsh`]───────────
I just so happened to prefer seeing the "ZOOMED-IN" statement at the very top of my TMUX session's status bar since it catches my attention more easily.
I also threw in here a simple binding for quickly changing pane titles since it's also useful.
Hope others find this info useful :-)
Top comments (1)
Updated this page after realizing that the
if-shell
command I previously provided only worked on my Mac. New command works on both Mac and Linux.