Display the current parameter value in tmux display-message

I am binding a key in my tmux config for a window option synchronize-panes

. I would also like to display the current state of the same option with the same keystroke. 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"

      

+3


source to share


1 answer


You can achieve this 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 information about tmux variables and format in the man page. https://www.systutorials.com/docs/linux/man/1-tmux/

+7


source







All Articles