How do I load yanked text into search as a literal pattern without regex escaping headaches?
:let @/='\V'.escape(@", '\\')
When you yank text that contains regex characters like .
488 results for ":e!"
:let @/='\V'.escape(@", '\\')
When you yank text that contains regex characters like .
<C-a> (insert mode)
While in insert mode, pressing re-inserts the exact text you typed during your previous insert session.
<C-v>{motion}~
Visual block mode () selects a rectangular column region, and pressing ~ at the end toggles the case of every character in that exact column range across all se
:set diffopt+=algorithm:patience
Vim's default diff algorithm (Myers) can produce noisy diffs when working with code — it sometimes matches unrelated lines containing common tokens like {, },
b: w: t: s:
Vimscript variables are prefixed with a one-letter scope identifier followed by a colon.
:g/^./,/^$/join
The :g/^.
command-line #command-line #editing #global #formatting #paragraphs
:keeppattern s/old/new/g
When you run a :s or :g command, Vim updates the search register (@/) with the pattern you used.
!{motion} {cmd}
The ! operator passes text selected by a motion through an external shell command, replacing it with the command's output.
fnameescape(filename)
When building Vim Ex commands dynamically, filenames with spaces, , %, #, [, or other special characters will be misinterpreted — the space looks like an argu
:compiler
Vim ships with built-in compiler plugins for many languages and tools — including gcc, python, cargo, eslint, tsc, and more.
command-line #ex-commands #config #buffers-windows #command-line
:match {group} /pattern/
:match, :2match, and :3match give you three independent highlight slots that overlay patterns on the buffer using any highlight group — without touching the s
:v/pattern/command
:v (short for :vglobal) is the inverse of :g.
p (in visual mode)
In visual mode, pressing p replaces the selected text with the contents of the default register.
:windo {cmd}
:windo {cmd} executes an Ex command in every window in the current tab page, cycling through each one and applying the command before returning focus to the ori
buffers-windows #windows #buffers #ex-commands #buffers-windows
vip=
Pressing = in visual mode re-indents all selected lines according to the current filetype's indent rules — the same engine used by == for a single line, but a
visual-mode #visual-mode #indentation #editing #text-objects
set showbreak=↪\
When wrap is enabled, long lines visually wrap to the next screen row.
/pattern1/;/pattern2/
Vim's search offsets allow chaining two patterns together with a semicolon.
:next
When Vim is opened with multiple files (e.
command-line #buffers-windows #ex-commands #navigation #editing
<C-v>I#<Esc>
Vim's Visual Block mode lets you prepend characters (like comment markers) to multiple lines simultaneously.
getchar()
getchar() blocks and waits for the user to press a key, returning its numeric character code.