Rangelist
Qedit commands usually contain a part called the rangelist. A rangelist is simply a sequence of line ranges separated by spaces or commas. A rangelist indicates which lines the command should operate on. Here are some sample ranges:
1{a single line}
1/4{lines 1 through 4, inclusive}
25/100.1{lines 25 through 100.1}
100/{lines 100 through the LAST line}
ALL{lines FIRST through LAST}
*-9/*+9{area around current line}
Here are some sample rangelists:
1,5{lines 1 and 5}
1/5 10/20{lines 1 through 5 and 10 through 20}
25,33/100{lines 25 and 33 through 100}
A rangelist can contain overlapping lines. Qedit does not try to resolve the ranges into a list of ordered, unique lines. The ranges are processed as they appear in the list.
30/40,1/10{lines 30 to 40, then 1 to 10}
1/10 5/20{lines 5 to 10 are processed twice}
all,all{process the entire file twice}
A rangelist can also contain a string search:
“strg”{search the entire file for “strg”}
“strg” 10/20{search only lines 10 through 20}
A rangelist can include up to 10 strings (see String for definition). Strings are separated from each other by an OR
or AND
keyword. Each string can have its own search setting such as column range and options. OR
and AND
keywords can not be mixed in a rangelist.
When OR
is used, each string is compared in turn against the text. As soon as a match is found, the line is selected. Thus, most commonly found strings should be placed at the beginning of the list to increase speed. For example,
/List "abc" or "xyz" { search for "abc" or "xyz" } /C 1/2 "ME" "abc" (u 30/35) or "xyz" (50/60 s) { search for caseless "abc" in columns 30/35 or } { smart "xyz" in columns 50/60 }
When AND
is used, all strings are searched for on each line and all strings must be found for the line to be selected. The strings do not have to be in the same order. As soon as one string is not found, the line is rejected.
For example,
/List "abc" and "xyz" { search for "abc" and "xyz". Both strings must be present, } { anywhere on the line, in any order } /C 1/2 "ME" "abc" (u 30/35) and "xyz" (50/60 s) { search for caseless "abc" in columns 30/35 and } { smart "xyz" in columns 50/60 } { If either string is missing, the line is not selected. }
The complete rangelist is saved and used when the “previous string” syntax (i.e., a null string) is entered. For example, /List ""
.
Each command has a default rangelist. The following commands default to “*”, the current line:
Add, Append, Change, Delete, Find (start search at *), Hold, List, Modify, Proc, Replace, Visual (enter Visual mode at current line), ZZ.
Justify defaults to “*” for Center, Left, or Right, and to */end (maintaining blank lines between paragraphs) for Format or Both.
Before, Do, and Redo defaults to the last command entered.