Ranges
- In Vim, one can execute several commands on ranges (:help range).
- Ranges are:
[Start],[End]
- Or alternatively
%
- for the entire file.
- Or an empty range-specifier for context-specific default (such as the current line or the entire file)
[Start]
and[End]
can be:
[Digits]
- an absolute line number.
- the current line$
- last line in a file.'t
or'T
- the position of mark t./{pattern}[/]
- next line where matches.?{pattern[?]
- previous line\/
- the next line where the previously used search pattern matches.\?
- the previous line
- For example if you've set marks "a" and "e", then you can say:
:'a,'es/^/# /
- To comment out the text.