How do I access the text from my last insert session?
".
The .
".
The .
Use :let i=1 with macro
By combining a Vimscript variable with a macro, you can create sequences with incrementing numbers.
":
The : register contains the last Ex command that was executed.
"=2+3<CR>p
The expression register = evaluates a Vimscript expression and stores the result.
:let @a = ""
The :let @{register} = "" command empties a register.
"ap, edit, "add
Since macros are stored in registers, you can paste the register content into the buffer, edit it, and yank it back.
U (in visual mode)
In visual mode, pressing U converts all selected text to uppercase.
y (in visual mode)
In visual mode, pressing y yanks (copies) the selected text into the default register.
c""<Esc>P
Without a surround plugin, you can manually wrap selected text by changing it, typing the delimiters, and pasting the original text back.
v/pattern<CR>
Starting a search while in visual mode extends the selection to the search match.
vi{a{
In visual mode, you can expand your selection to include outer nested blocks by pressing additional text object commands.
vi[
The vi[ command selects the text inside square brackets without including the brackets themselves.
:'<,'>normal @q
The :'normal @q command runs macro q on every line of the visual selection.
y/\V<C-r>"<CR>
By yanking a visual selection and pasting it into the search prompt with \V (very nomagic), you can search for exact text including special characters.
<C-v>jjjg<C-a>
Selecting a column of identical numbers with visual block mode and pressing g turns them into an incrementing sequence.
:'<,'>s/\%Vpattern/replacement/g
Using \%V in a substitute pattern restricts matching to within the visual block area only, rather than the full lines.
u (in visual mode)
In visual mode, pressing u converts all selected text to lowercase.
visual select + d, move, P
To swap two pieces of text, delete the first selection, navigate to the second, select it, and paste.
>
In visual mode, pressing > indents all selected lines by one shiftwidth.
J (in visual mode)
In visual mode, pressing J joins all selected lines into a single line with spaces between them.