How do I paste a register in insert mode without triggering auto-indent?
<C-r><C-o>{reg}
When you use a in insert mode to paste register a, Vim inserts the text as if you typed it character by character.
2125 results for "i{ a{"
<C-r><C-o>{reg}
When you use a in insert mode to paste register a, Vim inserts the text as if you typed it character by character.
:options
:options opens a special Vim buffer that lists every available option, grouped by category (appearance, editing, search, etc.
mode()
The mode() function returns a short string identifying the current editing mode — 'n' for Normal, 'i' for Insert, 'v' for Visual character-wise, 'V' for Visua
macros #macros #normal-mode #visual-mode #insert-mode #editing
:helpgrep {pattern}
:helpgrep searches the full text of every Vim help file for a pattern and loads all matches into the quickfix list.
cx{motion} … cx{motion} (vim-exchange)
The vim-exchange plugin provides cx{motion} to mark a region, then cx{motion} again on a second region to swap them in place.
:[range]center / :[range]right / :[range]left
Vim has built-in Ex commands for text alignment: :center, :right, and :left.
:cdo
:cdo {cmd} executes {cmd} on each entry in the quickfix list — one by one, jumping to each location in turn.
command-line #ex-commands #quickfix #search #editing #buffers
:%s/\v(old)/\=toupper(submatch(0)[0]).tolower(submatch(0)[1:])/g
Standard substitutions don't preserve the original case of matched text.
:%s/\d\+/\=printf('%03d', submatch(0))/g
Combining Vim's \= expression substitution with the printf() function lets you apply arbitrary formatting to matched text.
:~
The :~ command repeats the last substitution but uses the current search pattern instead of the original pattern.
:args {pattern}
The :args command sets Vim's argument list to all files matching a glob pattern.
:djump /MY_MACRO/
:djump searches for matches using Vim's definition search rules and jumps to the selected hit.
/pattern1/;/pattern2/
Vim's search offsets allow chaining two patterns together with a semicolon.
:'<,'>w {filename}
After making a visual selection, you can write only those lines to a new file using :'w {filename}.
"=strftime('%Y-%m-%d %H:%M')<CR>p
The expression register lets you evaluate Vimscript on demand and paste the result immediately.
registers #registers #expression-register #automation #timestamps
v:count1
The v:count1 variable holds the count typed before a command, defaulting to 1 if no count was given.
:set wildmode=longest,list
By default, Vim's command-line completion just cycles through matches one at a time.
yyp
The yyp command duplicates the current line by yanking it and immediately pasting it below.
:set undodir^=$HOME/.vim/undo//
If you already have an undodir configured by a distro config or plugin, replacing it outright can remove fallback paths you still want.
:s/pattern/~/
In a Vim substitution, using ~ as the replacement string repeats the replacement text from the most recent :s command.