Under :help [range] it states:

Some Ex commands accept a line range in front of them. This is noted as [range]. It consists of one or more line specifiers, separated with ',' or ';'.

I am wondering if there is actually a command that takes more than two line specifiers. I can think of at most two.

When I try to use more than two line specifiers, all but the final two seem to be disregarded:

:8,10,20,11,5,9,13 #

lists lines 9 through 13.

So, is there actually a scenario when using more than two line specifiers are useful?

2 Answers 2


Almost right below your quote from documentation it also says:

When separated with ';' the cursor position will be set to that line before interpreting the next line specifier.

So while there seems to be no commands that are able to accept more than two specifiers, they still can be useful to adjust starting position of other specifiers.


Consider a buffer like this with cursor positioned on the first line:


/2/,/a/,/1/ # finds this reversed range:

b1 # <-- match of /1/
a2 # <-- match of /a/

but /2/;/a/,/1/ # outputs

a1' # <-- match of both /1/ and /b/

because /2/; moved the cursor to the third line (a2) before running two other searches.


In the following range, the offset is calculated from "the current line" which may or may not be a match for /foo:


You can use ; to make the first line matching foo the first line specifier of your range:


which gives you three line specifiers.

You can use more semicolons to refine your range:

  • So, the last 2 line specifiers give the range delimiters, i take it.
    – VanLaser
    Nov 28, 2016 at 11:23
  • The last example doesn't really make sense. I think (correct me if I'm wrong!). That is: :?foo?;+2,/bar/;+6# is identical to :?foo?;/bar/;+6#. This is because it is the last two line specifiers that define the range. Thus, if there are more than two line specifiers, the one's that do not set the cursor position are irrelevant if they are not among the last two specifiers (and thus define the range). Nov 28, 2016 at 11:44
  • @KarlYngveLervåg yes I may have been a bit sloppy with that example. I will remove it.
    – romainl
    Nov 28, 2016 at 12:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.