3

I'm trying to get into the habit of using VIM help pages, and came across the following line when reading about command-line ranges:

/{pattern}[/]   the next line where {pattern} matches     *:/*

Now, my understanding of the help-pages syntactic convention is that [/] marks an optional forward slash character. However, reading further, the following is said about the line above (emphasis mine):

The "/" and "?" after {pattern} are **required** to separate the pattern from
anything that follows.

Am I misunderstanding the syntactic convention?

stensootla
  • 13,945
  • 9
  • 45
  • 68

1 Answers1

7

The "/" and "?" after {pattern} are required to separate the pattern from anything that follows.

If anything follows (such as an offset, e.g. /foobar/3 to go to the third line after the match), the / after a pattern is required.

L3viathan
  • 26,748
  • 2
  • 58
  • 81
  • Thank you, this settles it. Out of curiosity, may I ask in which context would something **not** follow the pattern? I was reading about it in the context of the substitute command, in which case the command `s` always follows a pattern. – stensootla Aug 05 '18 at 13:41
  • 1
    In the context of a normal search: `/foo`. In a substitution command you always need to terminate the substitution with a `/`/`?` – L3viathan Aug 05 '18 at 16:32
  • Oh yeah, of course. Didn't realize that I'm making use of this exact syntax every day :) – stensootla Aug 05 '18 at 22:40