How do I insert the word under the cursor into the Vim command line?
<C-r><C-w>
When typing a command on the Vim command line, pressing inserts the word currently under the cursor.
<C-r><C-w>
When typing a command on the Vim command line, pressing inserts the word currently under the cursor.
:10,20w newfile.txt
Use :10,20w newfile.
:%!sort
Use :%!command to filter the entire buffer through a shell command.
:verbose map <key>
Use :verbose map to see the mapping definition and the file/line where it was set.
<C-r>/ or q/
Press q/ to open search history in a window.
:set tabstop?
Append ? to any option name to query its value.
:redir @a | silent messages | redir END
Use :redir to capture command output.
:!ls
Use :! followed by any shell command.
:g/pattern/p
Use :g/pattern/p to print all matching lines.
: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.