Functions in tmux config

Viewed 3070

Is it possible to define a function in tmux config? I have a generic workflow that I want to run for a given tmux window. Right now I have defined this in a bash script which gets the window number as a parameter. Example:

bind 1 run-shell "~/.config/tmux/switchWindow.sh 1"
bind 2 run-shell "~/.config/tmux/switchWindow.sh 2"
bind 3 run-shell "~/.config/tmux/switchWindow.sh 3"
bind 4 run-shell "~/.config/tmux/switchWindow.sh 4"
[...]

I have this setup for multiple functions. So, besides my tmux.config, multiple bash scripts are required for my tmux setup to work. I want to flatten this out and ideally have everything in the tmux.conf. Is there a way to define functions in my tmux config and use bash commands inside them?

1 Answers
Related