vim Command-line ranges Search


Example

The commands below execute :command on every line from the first matching from to the first matching to:

:/from/,/to/command    " from next 'from' to next 'to'
:?from?,/to/command    " from previous 'from' to next 'to'
:?from?,?to?command    " from previous 'from' to previous 'to'

See :help search-commands.