I am binding a key in my tmux configuration for synchronize-panes
window option. I would also like to display the current state of the same option with the same key press. So far, I have tried:
# one or more of the following
bind-key S run-shell "tmux setw synchronize-panes; TMUX_STATUS=`tmux showw synchronize-panes`;tmux display-message $TMUX_STATUS"
bind-key S "setw synchronize-panes; display-message `showw synchronize-panes`"
bind-key S run-shell "tmux setw synchronize-panes; TMUX_STATUS=$(tmux showw synchronize-panes); tmux display-message $TMUX_STATUS"
You can achieve that with the following binding in .tmux.conf
Tested with tmux 2.4
# Toggle synchronize-panes with ^S m
bind S \
set synchronize-panes \;\
display "Sync #{?synchronize-panes,ON,OFF}"
You have details about tmux variables and format in the man page. https://www.systutorials.com/docs/linux/man/1-tmux/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With