How do I search for a pattern that spans multiple lines?
/pattern\n next-line
Using \n in a Vim search pattern matches a newline character, allowing you to find patterns that cross line boundaries.
396 results for "it at"
/pattern\n next-line
Using \n in a Vim search pattern matches a newline character, allowing you to find patterns that cross line boundaries.
<C-v>jj$A
Combining visual block mode with $ and A lets you append text at the end of multiple lines, even when the lines have different lengths.
<C-w>}
How it works The } command opens a preview window showing the tag definition of the word under your cursor.
m{A-Z}
Uppercase marks (A-Z) are global marks that remember both the file and the cursor position.
vat
The vat command visually selects the nearest enclosing HTML or XML tag and all of its contents, including the opening and closing tags themselves.
visual-mode #visual-mode #text-objects #editing #normal-mode
v_o
When you start a visual selection, the cursor is at one end and the anchor is at the other.
<C-n>
The vim-visual-multi plugin (formerly vim-multiple-cursors) brings VS Code-style multiple cursor editing to Vim.
plugins #plugins #visual-multi #editing #multiple-cursors #refactoring
:set pumheight=10
By default, Vim's completion popup menu (the PUM — Pop-Up Menu) can expand to fill the entire screen if there are many candidates.
<C-e>
The command scrolls the window down one line at a time while keeping the cursor on its current line (until the cursor would go off-screen).
qa/https\?:\/\/\nyiW:put\nq
Record a macro that searches for URLs, yanks the URL, and puts it at the end of the file.
qqq qq{commands}@qq @q
A recursive macro calls itself at the end of its recording, causing it to repeat automatically until a motion fails (like j at the last line).
qama{edits}'aq
How it works When a macro needs to jump to different parts of the file and then return to a starting position, marks are the perfect tool.
<C-r><C-f>
While typing a command, inserts the filename under the cursor in the buffer at the command-line prompt.
Paste with "ap and execute keys manually
To debug a macro, paste its contents into the buffer, read each keystroke, and execute them one at a time to find where the macro goes wrong.
o (visual mode)
In visual mode, pressing o swaps the cursor between the two ends of the selection (the anchor and the free end).
qa$bywdw0Pa <Esc>q
Record a macro that yanks the last word, deletes it, pastes it at the beginning of the line.
highlight TrailingWhitespace ctermbg=red and match TrailingWhitespace /\s\+$/
How it works Vim's highlight and match commands let you create custom visual indicators.
// vim: set ts=2 sw=2 et:
Add a modeline comment at the beginning or end of a file.
"=expression<CR>p
The expression register ("=) lets you evaluate any Vimscript expression and paste the result directly into your buffer from normal mode.
registers #registers #editing #normal-mode #productivity #math
( ) { } [[ ]]
Vim provides structural navigation motions that move by sentences, paragraphs, and sections.