How do I search and replace across multiple files using the quickfix list?
:cdo s/old/new/g
The :cdo command executes a command on every entry in the quickfix list.
Search Vim Tricks
Searching...:cdo s/old/new/g
The :cdo command executes a command on every entry in the quickfix list.
:set scrollbind
The scrollbind option locks the scrolling of two or more windows together so they scroll in unison.
(
The ( motion moves the cursor backward to the start of the current or previous sentence.
`[ and `]
The ` [ ` and ] ` marks automatically track the boundaries of the last changed or yanked text.
``
The double backtick jumps to the exact position before the last jump.
:set incsearch
The incsearch option enables incremental search, which highlights matches in real time as you type the search pattern.
:tags
The :tags command displays the tag stack, showing all the tag jumps you have made with and their return points.
:tselect
When a tag has multiple definitions (e.
<C-w>]
The ] command opens the definition of the tag under the cursor in a new horizontal split.
<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).
<C-y>
The command scrolls the window up one line at a time while keeping the cursor position fixed.
:set scrolloff=5
The scrolloff option keeps a minimum number of lines visible above and below the cursor when scrolling.
zb
The zb command redraws the screen with the current line at the bottom of the window.
/pattern/e
Search offsets let you place the cursor at a specific position relative to the match.
]] and [[
The ]] and [[ motions jump between sections, traditionally defined as lines starting with { in the first column.
<C-t>
The command pops the tag stack and returns to the position from which you last used or :tag.
`{mark}
The backtick command ` ` followed by a mark name jumps to the exact line and column of that mark, unlike the single-quote ' which only goes to the line.
:lnext and :lprev
The location list is a per-window alternative to the quickfix list.
:cnext and :cprev
The quickfix list holds a set of file positions, typically from compiler errors, grep results, or other tools.
m{A-Z}
Uppercase marks (A-Z) are global marks that remember both the file and the cursor position.