How do I target outer nested brackets using counted text objects?
d2i(
Vim text objects accept a count prefix that lets you target outer layers of nested delimiters.
370 results for "insert mode"
d2i(
Vim text objects accept a count prefix that lets you target outer layers of nested delimiters.
^ vs 0
Vim has two distinct motions for moving to the start of a line: 0 goes to column 1 (the absolute start), while ^ goes to the first non-blank character.
navigation #navigation #motions #line-navigation #indentation
y/<C-r>"<CR>
To search for the exact text you have selected in visual mode, yank it and paste it into the search prompt.
cw vs ciw
The cw and ciw commands both change a word, but they behave differently depending on cursor position.
editing #editing #text-objects #motions #normal-mode #productivity
:setlocal nomodifiable
While :set readonly prevents accidental writes, nomodifiable goes further by preventing any changes to the buffer contents entirely.
buffers-windows #buffers-windows #readonly #modifiable #protection
<C-v>jjr<C-k>12
Visual block mode combined with the replace command and digraph input lets you replace a column of characters with special Unicode characters.
D
The D command deletes everything from the cursor position to the end of the current line.
:cabbrev tn tabnew
Command-line abbreviations with cabbrev let you create short aliases for frequently used Ex commands.
command-line #command-line #abbreviation #shortcuts #productivity
qa ... q ... @a
Macros let you record a sequence of commands and replay them.
<C-v>j$A;<Esc>
When lines have varying lengths, a normal visual block selection stops at the shortest line.
:call feedkeys("iHello\<Esc>", 'n')
The feedkeys() function injects keystrokes into Vim's input buffer as if the user typed them.
<Leader>tm
The vim-table-mode plugin by Dhruva Sagar turns Vim into a powerful table editor that automatically formats and aligns table columns as you type.
dit
The dit command deletes the text inside the nearest enclosing HTML or XML tag pair without removing the tags themselves.
:verbose nmap <leader>
The :verbose prefix on mapping commands shows not just the mapping definition but also the file and line number where it was defined.
{count}{motion}
Almost every Vim motion and operator accepts a numeric count prefix that repeats or amplifies the action.
:call setreg('a', "foo\nbar", 'b')
Most register examples focus on interactive yanks, but setreg() lets you construct registers programmatically, including their type.
*cgn
Global substitution is fast, but sometimes you need selective control over each occurrence.
:%norm A;
The :%norm command runs normal mode commands on every line in the file (or a range).
:'<,'>normal! I//
Visual Block insert (I.
:let @+=@%
The % register always holds the name of the current file (as a relative path).