I like to call :clear-history
on panes with a huge scrollback. However, I want to script a way to send this command to all the panes in the various windows.
A bit late to the party but I didn't want to set and unset synchronize-panes just to send one command so I created a wrapper function around tmux and added a custom function called send-keys-all-panes
.
_tmux_send_keys_all_panes_ () {
for _pane in $(tmux list-panes -F '#P'); do
tmux send-keys -t ${_pane} "$@"
done
}
I also create a wrapper around the tmux command to simplify calling this function (for convenience). The wrapper and the above code are all here.
This allows me to run tmux send-keys-all-panes <command>
or tmux skap <command
to send <command>
to all panes.
Note that tmux is aliased to my wrapper function tmux_pp.
tmux send-keys -t <session id> <command> C-m
Replace the "session id" and "command" accordingly.