Insert the word under the cursor
Ctrl-r Ctrl-w
Example
Command-line 0 / 1Command-line 1 / 1one two
three four
five six
keepCursor on line 1, column 1one two
three four
five six
keepCursor on line 1, column 1Copy the cursor word into the command line.
Command line
- Prompt
:echo 'red blue'- Insertion column
16- Editing mode
Insert- Completion menu
inactive
Vim messages
Empty
- Last status message
- Last warning
Command line open · edit or submit
Command line
- Prompt
:echo 'red blue'one- Insertion column
19- Editing mode
Insert- Completion menu
inactive
Vim messages
Empty
- Last status message
- Last warning
Before & after
one two
three four
five six
keepCursor on line 1, column 1Command line
- Prompt
:echo 'red blue'- Insertion column
16- Editing mode
Insert- Completion menu
inactive
Vim messages
Empty
- Last status message
- Last warning
one two
three four
five six
keepCursor on line 1, column 1Command line
- Prompt
:echo 'red blue'one- Insertion column
19- Editing mode
Insert- Completion menu
inactive
Vim messages
Empty
- Last status message
- Last warning
Start in Command-line mode. A literal :echo prompt is already open. This key edits, moves within, cancels, or submits that prompt; the text buffer is separate.
Details & Vim help
Example replayed in Vim
Copy the cursor word into the command line.
While editing a : command or search prompt, Ctrl-r followed by Ctrl-w inserts the word under the buffer cursor. The text may need escaping when used as a search pattern.