How do I paste text and automatically adjust its indentation?
]p
The ]p command pastes text and adjusts its indentation to match the current line.
1029 results for "i" a""
]p
The ]p command pastes text and adjusts its indentation to match the current line.
/\%>10l\%<20lpattern
Vim's \%>Nl and \%10l matches only after line 10 \%10l\%10l\%<20lold/new/g Combine with column restrictions for precise region targeting Tips Line numbers in \%
U
In visual mode, pressing U converts all selected characters to uppercase and u converts them to lowercase.
:s/^/\=line('.') - line("'<") + 1 . '. '/
When you need to quickly number a set of lines — such as TODO items, steps, or bullet points — you can use a visual selection combined with a substitution e
visual-mode #visual-mode #editing #ex-commands #formatting #substitute
vaB
The aB text object (around Block) selects everything from the matching { to the closing } — including the braces themselves.
:norm
:normal (abbreviated :norm) executes a sequence of normal-mode keystrokes on each line of an address range.
:helpgrep {pattern}
:helpgrep searches the full text of every Vim help file for a pattern and loads all matches into the quickfix list.
`[v`]
The ` [v] sequence visually selects the exact region of text that was last changed, pasted, or yanked into the buffer.
visual-mode #editing #visual-mode #marks #paste #productivity
:topleft split {file}
By default, Vim places horizontal splits below and vertical splits to the right (controlled by splitbelow and splitright).
Create plugin/myplugin.vim
A basic Vim plugin is just a .
qa0f:dwj0q
How it works When recording a macro that you plan to repeat across multiple lines, the key technique is to end the macro positioned on the next line, ready for
vi[
The vi[ command selects the text inside square brackets without including the brackets themselves.
qa:s/old/new/g<CR>jq
How it works You can combine Ex commands like :s (substitute) with macro recording to create powerful repeatable find-and-replace operations that go beyond what
:{line}put {register}
How it works The :put Ex command pastes the contents of a register after a specified line.
J
The J command joins the current line with the line below it, replacing the newline with a space.
:help registers
Vim has 10 types of registers, each serving a specific purpose.
<C-r>=2+2<CR>
The expression register (=) in insert mode lets you evaluate any Vimscript expression and insert the result inline.
:keepjumps
When writing scripts or running commands that move the cursor (like :g, :s, or :normal), Vim normally adds each cursor position to the jump list.
'0
Pressing '0 in normal mode jumps to the exact cursor position in the most recently edited file, even after closing and reopening Vim.
:set wildmenu wildmode=longest:full,full
By default, Vim's command-line tab completion just cycles through options.