How do I send a range of lines as stdin to a shell command without modifying the buffer?
:[range]w !{cmd}
The :[range]w !{cmd} command writes a range of lines to the standard input of a shell command, leaving the buffer completely unchanged.
:[range]w !{cmd}
The :[range]w !{cmd} command writes a range of lines to the standard input of a shell command, leaving the buffer completely unchanged.
vim.keymap.del()
vim.
<C-\><C-o>
In a Neovim terminal buffer, exits to normal mode permanently.
buffers-windows #terminal #buffers-windows #insert-mode #neovim #normal-mode
:reg {names}
The :registers command dumps every register at once, which is noisy when you only care about a handful.
dgn
The gn motion is a versatile text object that selects the next occurrence of the last search pattern.
editing #editing #search #text-objects #normal-mode #motions
\U, \L, \u, \l, \e in :substitute replacement
Vim's substitute command supports in-replacement case conversion metacharacters that transform the case of matched text without extra scripting.
z. and z<CR> and z-
Vim has two parallel sets of scroll commands: the well-known zz, zt, zb which reposition the view without moving the cursor, and the lesser-known z.
: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
:wincmd {cmd}
:wincmd {key} is the Ex command equivalent of every {key} window shortcut.
buffers-windows #buffers-windows #windows #ex-commands #normal-mode
\%(pattern\)\@=
Vim's lookahead assertion \@= confirms that the current position is followed by a pattern — without including those characters in the match.
g??
Vim has a built-in ROT13 operator g? that encodes text by rotating each letter 13 positions in the alphabet.
:put =''
Using :put ='' with an empty expression lets you insert blank lines in normal mode without ever entering insert mode.
editing #editing #normal-mode #ex-commands #expression-register #blank-line
cgn...{text}<Esc>.
The cgn + .
:'<,'>normal {command}
After making a visual selection, :'normal {command} runs any normal-mode command on each selected line individually.
<SID>
(Script ID) is a Vimscript token that expands to a unique, per-script prefix at runtime.
:<C-u>MyCommand<CR>
When writing nnoremap or vnoremap mappings that call Ex commands, Vim may silently prepend a count or a visual range (') to your command before it runs.
matchadd('Group', 'pattern', priority)
matchadd() accepts an optional third argument: a priority integer that controls which match wins when two patterns cover the same text.
:echo synIDattr(synID(line('.'),col('.'),1),'name')
When customizing a colorscheme or debugging unexpected colors, you need to know exactly which highlight group is coloring the text under your cursor.
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
shellescape({expr})
The shellescape() function wraps a string in shell-safe quoting, escaping any special characters so it can be embedded in a shell command constructed with :exec
command-line #ex-commands #command-line #editing #normal-mode