Wiki

by yszheda

View project onGitHub

Tip 15: Paste From a Register Without Leaving Insert Mode

Return to the top: <<Practical Vim>>

<C-r>{register}

Example:

References:

# If you open the file in vim,
# then you can \"ayy@a the next line to execute the vim command: 
:h i_CTRL-R

Use <C-r>{register} for Character-wise Registers

If the textwidth and autoindent options are enabled, you might end up with unwanted line breaks or extra indentation when you <C-r>{register} to paste a lot of text.

<C-r><C-p>{register}: inserts text iterally and fixes any unintended indentation.

Suggestion: switch to Normal mode when you want to paste a register containing multiple lines of text.

References:

# If you open the file in vim,
# then you can \"ayy@a the next line to execute the vim command: 
:h i_CTRL-R_CTRL-P