How do you run a command on a specific range of lines?
:10,20d
Specify a line range before a command.
:10,20d
Specify a line range before a command.
:r !date
Use :r !command to read the output of a shell command into the buffer below the cursor.
:10,15m 25
Use :m (move) with a range and destination.
:%normal A;
Use :%normal followed by normal mode keystrokes.
:marks
Use :marks to display all current marks with their line numbers, column positions, and file/text.
:10,15t 25
Use :t (copy) with a range and destination.
<C-f> on command line
While typing a command, press to open the command-line editing window.
:args *.py
Use :args *.
:argdo %s/old/new/ge | update
Use :argdo to execute a command in every file in the argument list.
<C-r>{reg} in command line
While on the : command line, pressing followed by a register name inserts that register's contents.
<C-r>=system('cmd')
In command-line mode, =system('command') evaluates the shell command and inserts its output into the command line.
:s/pattern/replace/flags
The substitute command supports several flags that modify its behavior.
:command Name action
The :command command defines a new user Ex command.
augroup name | autocmd! | ... | augroup END
Using augroup with autocmd! inside prevents duplicate autocommands from accumulating when you reload your vimrc.
:{range}w filename
The :w command with a range and filename saves only the specified lines to a new file.
:verbose set option?
The :verbose prefix shows where an option was last set (which file, which line).
:help topic
Vim has an extensive built-in help system.
:{start},{end} command
Ex commands accept range specifiers that control which lines are affected.
:set option
The :set command changes Vim options for the current session.
:silent command
The :silent prefix suppresses all output from a command, including messages and prompts.