How do you paste from a register while in visual mode?
"ap
In visual mode, "ap replaces the selected text with the contents of register a.
"ap
In visual mode, "ap replaces the selected text with the contents of register a.
5"ap
Prefix the paste command with a count.
"aP
Use "aP (uppercase P) to paste the contents of register a before the cursor position, as opposed to "ap which pastes after.
:call setreg('a', @a, 'v') then "ap
Use setreg() to change register a to characterwise mode (v), then paste.
/<C-r>a
While in the search prompt (/), press a to insert the contents of register a.
:@:
The : register stores the last command-line command.
<C-r>.
In insert mode, .
"0p vs "1p
Register 0 always contains the last yanked text.
"a]p
Use ]p after specifying a register to paste with adjusted indentation.
<C-r>%
In insert mode, % inserts the current filename.
:echo getreg('a')
Use getreg('a') to get the contents of register a as a string.
<C-r>a
In insert mode, press followed by the register name.
<C-r>=expand('%:t')<CR>
In insert mode, = opens the expression register.
"adiw then move, "aP and diw
Delete the first word into register a with "adiw, move to the second word, paste register a before with "aP, then delete the remaining original.
<C-r>=42*7<CR>
In insert mode, press = to access the expression register, type a math expression like 42*7, and press Enter to insert the result (294).
:let @a = toupper(@a)
Use Vimscript functions toupper() or tolower() with :let @a = toupper(@a) to convert the case of the entire register contents.
<C-r>#
The # register holds the alternate (previously edited) filename.
"_dd
Use the black hole register " before a delete command.
<C-r>{reg} in command line
While on the : command line, pressing followed by a register name inserts that register's contents.
"+yy
The "+yy command yanks the current line directly to the system clipboard register, making it available for pasting in other applications.