Visual + Ex Range

Pressing : from Visual auto-fills the range.

Keys: :

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.

From Visual to substitute
KeyNote
VLine Visual
5jExtend down 5 lines
:Vim shows :'<,'>
s/foo/bar/gOperate on those lines only

Watch

See also: Ex Ranges, Substitute ({key::s}), Special Marks