vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit 0d421fa4b7632468c945d38d87d35b211e272ac5
parent 631e10790f10e82e4aa35590dc40879cb1d78563
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Wed, 12 Apr 2017 20:29:29 +0200

man: document new count specifier for `g` and `v` commands

A few examples:

 :x g1              selects the first line
 :x g-1             selects the last line
 :x g-3,            selects the last three lines
 :x g2,4            selects lines 2, 3 and 4
 :x g,5             selects all lines up and including the fifth
 :x g6,             selects all lines starting from the sixth
 :x g%2             selects all even lines
 :x v%2             selects all odd lines

Diffstat:
Mman/vis.1 | 40++++++++++++++++++++++++++++++++++++----
1 file changed, 36 insertions(+), 4 deletions(-)

diff --git a/man/vis.1 b/man/vis.1 @@ -627,10 +627,12 @@ Same as .Ic X , but for files that do not match the regular expression, and the expression is required. -. -.It Ic g/ Ns Ar regexp Ns Ic / Ar command -.It Ic v/ Ns Ar regexp Ns Ic / Ar command -If the range contains +.\" TODO improve markup, use Op macro, make it actually undertandable :/ +.It Ic g Ns [ Ar count ] Ns [ Ar /regexp/ ] Ar command +.It Ic v Ns [ Ar count ] Ns [ Ar /regexp/ ] Ar command +If the +.Ar count +range contains .Po .Ic g .Pc @@ -639,6 +641,36 @@ or does not contain .Ic v .Pc a match for the expression, run command on the range. +.Pp +The +.Ar count +specifier has the following format, where +.Ic n +and +.Ic m +are integers denoting the ranges. +.Bl -tag -width indent +.It Ic n,m +The closed interval from +.Ic n +to +.Ic m . +If +.Ic n +is missing, +.Ic 1 +is substituted. +If +.Ic m +is missing, +.Ic ∞ +is substituted. Negative values are interpreted relative to the last range. +.It Ic %n +Matches every +.Ic n Ns +-th range. +.El +. .El .Pp These may be nested arbitrarily deeply.