Visual + Ex Range
Pressing : from Visual auto-fills the range.
When you press : while in visual mode, Vim drops you to the command line with :'<,'> already typed โ the range covering the selection. Just type your command after.
Visual mode and Ex commands plug right into each other. Press : from any Visual selection and Vim pre-types the range.
| Key | Note |
|---|---|
| {key:V} | visual-line mode |
| {key:5}{key:j} | Extend down 5 lines |
| {key::} | Vim shows :'<,'> |
| `s/foo/bar/g` | Operate on those lines only |
Watch
See also: Ex Ranges, Substitute (:s), Special Marks