Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

tmux: how to toggle "on" and "off" options with the same key

Tags:

tmux

This is a bit of my tmux.conf

cat tmux.conf ... bind a set-window-option synchronize-panes on bind b set-window-option synchronize-panes off 

As you can see, sync and unsync options for panes are bound to two different keys. Is it possible to toggle sync/unsync with the same key?

like image 691
facha Avatar asked Sep 18 '14 10:09

facha


People also ask

How do you use key bindings tmux?

KEY BINDINGS. tmux may be controlled from an attached client by using a key combination of a prefix key, 'C-b' (Ctrl-b) by default, followed by a command key. The default command key bindings are: C-b Send the prefix key (C-b) through to the application. C-o Rotate the panes in the current window forwards.

How do I switch between tmux panes?

Tmux uses the keybinding 'Prefix' followed by 'Ctrl+o' to cycle around the panes. When you use this key-binding for the first time, it moves the pane in one position clockwise.

Where do I put tmux config?

The config file is located in /usr/share/tmux , not in /usr/share/doc/tmux .


1 Answers

If you don't explicitly specify "on" or "off", the option will get toggled. The following would suffice:

bind-key a set-window-option synchronize-panes\; display-message "synchronize-panes is now #{?pane_synchronized,on,off}" 
like image 101
Ojp Avatar answered Sep 21 '22 13:09

Ojp