Tip 33: Insert the Current Word at the Command Prompt
Return to the top: <<Practical Vim>>
-
<C-r><C-w>
: mapping copies the word under the cursor and inserts it at the command-line prompt. -
<C-r><C-a>
: mapping copies the WORD under the cursor and inserts it at the command-line prompt. -
*
: equivalent to/\<<C-r><C-w>\><CR>
Example:
Application: place your cursor on a Vim script, and use :help <C-r><C-w>
to look up the documentation for that setting.
References:
# If you open the file in vim, # then you can \"ayy@a the next line to execute the vim command: :h c_CTRL-R_CTRL-W