Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Server version compare in tmux.conf

14 views
Skip to first unread message

japin li

unread,
Apr 18, 2025, 1:53:48 AMApr 18
to tmux-users
Hi, Nicholas

I found that Tmux has a version variable in string format (like next-3.5). However, this does not facilitate easier version comparison.  Currently, I use the following to do version comparsion:

%if #{>=:#{s|next-||:version},3.5}
do something
%endif

 Would it be possible to add a numeric server version? Or is there another effective way to compare versions?

Nicholas Marriott

unread,
Apr 19, 2025, 3:00:37 PMApr 19
to japin li, tmux-users
Couldn't you just remove all non-numbers from the string to get a number version?


--
You received this message because you are subscribed to the Google Groups "tmux-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tmux-users+...@googlegroups.com.
To view this discussion, visit https://groups.google.com/d/msgid/tmux-users/8e11fff3-e0df-4266-aaf4-1977971cdc04n%40googlegroups.com.

japin li

unread,
Apr 26, 2025, 2:29:52 AMApr 26
to Nicholas Marriott, tmux-users
 Thanks, it's pretty cool.

On Sunday, April 20, 2025, Nicholas Marriott <nicholas...@gmail.com> wrote:
Couldn't you just remove all non-numbers from the string to get a number version?
On Fri, 18 Apr 2025, 06:53 japin li, <japin...@gmail.com> wrote:
Hi, Nicholas

I found that Tmux has a version variable in string format (like next-3.5). However, this does not facilitate easier version comparison.  Currently, I use the following to do version comparsion:

%if #{>=:#{s|next-||:version},3.5}
do something
%endif

 Would it be possible to add a numeric server version? Or is there another effective way to compare versions?

--
You received this message because you are subscribed to the Google Groups "tmux-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tmux-users+unsubscribe@googlegroups.com.

japin li

unread,
Apr 27, 2025, 6:24:23 AMApr 27
to tmux-users
After some digging, it may not work because we have versions such as 3.2 and 3.2a.
 If we remove all non-numbers, then 3.2a and 3.2 are combined. I'm not sure about this.

On Saturday, April 26, 2025 at 2:29:52 PM UTC+8 japin li wrote:
 Thanks, it's pretty cool.

On Sunday, April 20, 2025, Nicholas Marriott <nicholas...@gmail.com> wrote:
Couldn't you just remove all non-numbers from the string to get a number version?
On Fri, 18 Apr 2025, 06:53 japin li, <japin...@gmail.com> wrote:
Hi, Nicholas

I found that Tmux has a version variable in string format (like next-3.5). However, this does not facilitate easier version comparison.  Currently, I use the following to do version comparsion:

%if #{>=:#{s|next-||:version},3.5}
do something
%endif

 Would it be possible to add a numeric server version? Or is there another effective way to compare versions?

--
You received this message because you are subscribed to the Google Groups "tmux-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tmux-users+...@googlegroups.com.

Nicholas Marriott

unread,
Apr 27, 2025, 6:30:02 AMApr 27
to japin li, tmux-users
3.2 and 3.2a should be pretty much the same, only minor bug fixes. If you need to know the difference you would need to check for the "a" as well.

Michael Grant

unread,
Apr 27, 2025, 6:58:20 AMApr 27
to tmux-users
What if you append a '0' to the end if there's no letter, and if there is a letter, convert that to a number.  How about something like this:

echo '3.2a' | sed -e 's/\([0-9]\)$/\10/;s/\.//g' | tr '0123456789abcdefghi' '0123456789123456789'

which produces 321 and without the a produces 320.  Thing is, in the future, who knows if a version 9a or 14b.6 will come out.

However, I agree, adding a numeric version would be a good idea.  I have also had to do above hacks like the above on other things.

japin li

unread,
Apr 29, 2025, 12:18:16 AMApr 29
to Michael Grant, tmux-users
On Sun, Apr 27, 2025 at 6:58 PM Michael Grant <michae...@gmail.com> wrote:
What if you append a '0' to the end if there's no letter, and if there is a letter, convert that to a number.  How about something like this:

echo '3.2a' | sed -e 's/\([0-9]\)$/\10/;s/\.//g' | tr '0123456789abcdefghi' '0123456789123456789'

Thank you for this suggestion. It works, but it's cumbersome.

which produces 321 and without the a produces 320.  Thing is, in the future, who knows if a version 9a or 14b.6 will come out.

However, I agree, adding a numeric version would be a good idea.  I have also had to do above hacks like the above on other things.

+1 

--
You received this message because you are subscribed to the Google Groups "tmux-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tmux-users+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages