Is there a way to configure tmux to maintain its current zoomed/not zoomed state when switching panes? I can add a keybinding to automatically zoom after switching pane as follows:
bind-key -n C-l select-pane -t :.+\; resize-pane -Z
However this will zoom the new pane even if I was not previously zoomed. I would like to use the same keybinding to switch pane whether currently zoomed or not zoomed, and preserve the zoomed/not zoomed state.
Depending on your version of tmux you can try this binding:
bind-key -n C-l if-shell -F "#{window_zoomed_flag}" 'select-pane -t :.+; resize-pane -Z' 'select-pane -t :.+'
This worked for me on tmux 2.2. if-shell -F
does not run a shell command but just expands the window_zoomed_flag
to 0 or 1, and runs the first or second command sequence.