aboutsummaryrefslogtreecommitdiff
path: root/tmux.1
diff options
context:
space:
mode:
authornicm <nicm>2020-03-11 14:17:55 +0000
committernicm <nicm>2020-03-11 14:17:55 +0000
commitc820585dd0b5060d57296ae1086908e0b67b47b5 (patch)
treed131d36b6abac737e0cd07da3ba7757daa1e611a /tmux.1
parent2991f4aad0d010db57ce979d151191836036cb5f (diff)
downloadrtmux-c820585dd0b5060d57296ae1086908e0b67b47b5.tar.gz
rtmux-c820585dd0b5060d57296ae1086908e0b67b47b5.tar.bz2
rtmux-c820585dd0b5060d57296ae1086908e0b67b47b5.zip
Add some number operators for formats, from Tyler Culp.
Diffstat (limited to 'tmux.1')
-rw-r--r--tmux.134
1 files changed, 33 insertions, 1 deletions
diff --git a/tmux.1 b/tmux.1
index c36ad1c5..42d0da2b 100644
--- a/tmux.1
+++ b/tmux.1
@@ -4107,7 +4107,7 @@ specifies an
.Xr fnmatch 3
or regular expression comparison.
The first argument is the pattern and the second the string to compare.
-An optional third argument specifies flags:
+An optional argument specifies flags:
.Ql r
means the pattern is a regular expression instead of the default
.Xr fnmatch 3
@@ -4134,6 +4134,38 @@ ignores case.
For example:
.Ql #{C/r:^Start}
.Pp
+Numeric operators may be performed by prefixing two comma-separated alternatives with an
+.Ql e
+and an operator.
+An optional
+.Ql f
+flag may be given after the operator to use floating point numbers, otherwise integers are used.
+This may be followed by a number giving the number of decimal places to use for the result.
+The available operators are:
+addition
+.Ql + ,
+subtraction
+.Ql - ,
+multiplication
+.Ql * ,
+division
+.Ql / ,
+and modulus
+.Ql m
+or
+.Ql %
+(note that
+.Ql %
+must be escaped as
+.Ql %%
+in formats which are also expanded by
+.Xr strftime 3 ) .
+For example,
+.Ql #{e|*|f|4:5.5,3}
+multiplies 5.5 by 3 for a result with four decimal places and
+.Ql #{e|%%:7,3}
+returns the modulus of 7 and 3.
+.Pp
A limit may be placed on the length of the resultant string by prefixing it
by an
.Ql = ,