How do I run an Ex command on exactly the current visual selection without typing the range manually?
:
In Visual mode, typing : does more than open the command line: Vim automatically inserts the exact selection range as '.
:
In Visual mode, typing : does more than open the command line: Vim automatically inserts the exact selection range as '.
:{range} normal @{reg}
The :normal command lets you execute Normal mode keystrokes over a range of lines.
:%norm A;
The :%norm command runs normal mode commands on every line in the file (or a range).
:10,20w newfile.txt
Use :10,20w newfile.
:10,20d
Specify a line range before a command.
:%normal A;
Use :%normal followed by normal mode keystrokes.
/\%>10l\%<20lpattern
Vim's \%>Nl and \%10l matches only after line 10 \%10l\%10l\%<20lold/new/g Combine with column restrictions for precise region targeting Tips Line numbers in \%