How do I quickly re-insert the text I just typed without leaving insert mode?
<C-a> (in insert mode)
While in insert mode, pressing re-inserts whatever text you typed during your previous insert session.
2125 results for "i' a'"
<C-a> (in insert mode)
While in insert mode, pressing re-inserts whatever text you typed during your previous insert session.
<C-a>
The command increments the number under or after the cursor by 1.
:let i=0 | g/pattern/s/pattern/\=printf('%d', i+=1)/
By combining :let, the :g global command, and an expression substitution with \=, you can replace every match of a pattern with a unique incrementing number.
:for i in range(1,5) | put ='item '.i | endfor
Vimscript's for loop is available directly from Vim's command line and can be used to generate repetitive or parameterized text without a macro or external scri
:%s/pattern/\r/g
In the replacement part of :s, \r inserts a newline.
<C-a> (insert mode)
While in insert mode, pressing re-inserts the exact text you typed during your previous insert session.
:let @a = ''
Registers persist their contents throughout your Vim session and even across sessions if viminfo or shada is enabled.
:tjump /pattern
:tjump is a smarter variant of :tag.
qaI<li><Esc>A</li><Esc>jq
This macro wraps each line in tags by inserting the opening tag at the start and appending the closing tag at the end.
:set guicursor=n-v-c:block,i-ci-ve:ver25,r-cr:hor20
Neovim's guicursor option lets you assign a distinct cursor shape and style to each mode, providing immediate visual feedback about which mode you are in.
:set formatoptions+=a
Vim's formatoptions setting controls how automatic text formatting works.
"ayi(
Combining named registers with text object motions lets you precisely yank structured content — like function arguments, quoted strings, or bracketed expressi
:%normal command
The :normal command executes normal mode commands programmatically on a range of lines.
zf (in visual mode)
In visual mode, pressing zf creates a manual fold from the selected lines.
vi{a{
In visual mode, you can expand your selection to include outer nested blocks by pressing additional text object commands.
{count}%
When used with a count, the % command jumps to the line at that percentage of the file.
"adiw
The "adiw command deletes the inner word under the cursor and stores it in register a.
=i{
When editing code with messy indentation — after a paste, a merge conflict, or a refactor — you often need to fix just one block rather than the entire file
qa ... q ... @a
Macros let you record a sequence of commands and replay them.
:let @q = @:
The : register always holds the last Ex command you ran.