How do I select or operate on the content of an HTML or XML tag using text objects?
it and at
Vim provides two built-in text objects for HTML and XML tags: it (inner tag) and at (a tag).
editing #text-objects #editing #visual-mode #html #normal-mode
189 results for ""+y"
it and at
Vim provides two built-in text objects for HTML and XML tags: it (inner tag) and at (a tag).
editing #text-objects #editing #visual-mode #html #normal-mode
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
:set operatorfunc=MyFunc<CR>g@{motion}
Vim's operatorfunc and g@ let you define custom operators that accept any motion or text object, just like built-in operators d, c, and y.
:/pattern1/,/pattern2/
Ex command ranges in Vim are not limited to line numbers and marks — you can use /pattern/ as a range boundary to select lines between any two matching patter
iW vs iw
Vim has two flavors of the "inner word" text object that are easy to confuse: iw (lowercase) and iW (uppercase).
<C-r>0
In Insert mode, {reg} pastes the contents of any register inline at the cursor.
:set scroll=10
The scroll option determines how many lines (scroll up) and (scroll down) move the viewport.
g_
g moves the cursor to the last non-blank character of the current line — skipping trailing spaces and tabs.
Va{ or Vi{
The a{ (around braces) and i{ (inside braces) text objects combined with visual mode let you instantly select an entire function body or code block, regardless
visual-mode #visual-mode #text-objects #code-navigation #selection
yiw
How it works The command yiw yanks (copies) the inner word under the cursor.
:help registers
Vim has 10 types of registers, each serving a specific purpose.
mA and 'A
Vim has two tiers of marks.
:set opfunc and g@
Vim's operatorfunc option lets you define your own operators — just like the built-in d, y, or c — that accept any motion or text object.
vim.highlight.on_yank()
After yanking text in Vim it can be hard to tell exactly what was captured, especially with larger motions or text objects.
"1p
Vim automatically stores your deletion history in numbered registers "1 through "9.
<C-d>
The (Ctrl+d) command scrolls the window down by half a screen, moving both the viewport and the cursor.
d/{pattern}<CR>
Vim lets you use a / search as a motion for any operator.
dV{motion}
In operator-pending mode — the brief state after typing an operator like d, c, or y but before entering the motion — you can prefix the motion with v, V, or
cgn...{text}<Esc>.
The cgn + .
<C-r>=expression<CR>
The expression register ("=) evaluates Vimscript expressions and returns the result.
registers #registers #insert-mode #expression #calculator #vimscript