evnp / tmex

tmux-execute – a lightweight tmux command & layout composer
MIT License
87 stars 5 forks source link

Fix for deprecated split-window -p flag in tmux 3.4 #8

Closed evnp closed 1 year ago

evnp commented 1 year ago

Fix for https://github.com/evnp/tmex/issues/7 (thanks @liangkarl!)

It seems tmux has deprecated split-window -p<value> in favor of split-window -l<value>% in 3.1, fully removing support for split-window -p<value> in 3.4:

CHANGES FROM 3.0a TO 3.1
* Add support for percentage sizes for resize-pane ("-x 10%"). Also change
  split-window and join-pane -l to accept similar percentages and deprecate the
  -p flag.

https://github.com/tmux/tmux/blob/master/CHANGES#L663

This adds a tmux version check, after which split-window calls constructed by tmex will use -l<value>% if current version is >=3.1, and continue using -p<value> if version is <3.1. If tmux version cannot be determined, a warning will be emitted and tmex will continue to use the old -p flag.