Checking the version of Tmux in a tmux.conf

Tmux 1.9 was just released today!

Which is awesome... but it changed a feature I really liked. Tmux, when creating a new window, used to start in the same directory as the one that you're current window was in. It made for a predictable flow.

Luckily its easily fixed with a redefinition of the "new-window" key binding in your tmux.conf file. So, I made the change and pushed it, then checked to see if it would still behave on my older box with tmux 1.6 (out of my hands)... and it failed.

So, how can we create statements, set options, or define key bindings based on a version in a tmux.conf file? Here's how:

# Use "if-shell" to run a bash command
# and check the version string of tmux
if-shell "[[ `tmux -V` == *1.9 ]]" 'command-to-be-run-here'