How do I apply an ex-command on a set of visually selected lines?
When you select a range of lines in visual mode, the < register is set to the start of the visual region and the > register is set to the end of the visual region. You can use these registers to specify the range for an ex command. After visually selecting the lines, press “:” to go to the command mode. Vim will automatically insert the visual range ‘<,’>. You can run any ex-command on the visual range.