How do I inspect a register as a list of lines in Vimscript?
:echo getreg('a', 1, 1)
For advanced register debugging and macro tooling, plain getreg('a') is often not enough.
Search Vim Tricks
Searching...:echo getreg('a', 1, 1)
For advanced register debugging and macro tooling, plain getreg('a') is often not enough.
:let @q .= "A;\<Esc>"
If a recorded macro is almost correct but missing a final step, re-recording from scratch is slow and error-prone.
:drop {file}
When the same file is already open elsewhere, using :edit can create extra navigation friction because you stay in the current window and may lose layout contex
buffers-windows #buffers-windows #windows #buffers #workflow
5<C-o>
Most Vim users know jumps backward in the jumplist, but fewer use a count with it.
:set diffopt+=iwhite,algorithm:patience
When whitespace-only churn and noisy line matching make diffs hard to review, tuning diffopt can dramatically improve signal.
:call setreg('q', getreg('a'), getregtype('a'))
Simple register copies can silently change behavior when register type is lost.
:
In Visual mode, typing : does more than open the command line: Vim automatically inserts the exact selection range as '.
<C-o>zvzz
Jumping backward with is fast, but in folded or dense files it can land you in a collapsed section or near the edge of the screen, forcing extra cleanup keystro
:lockmarks keepjumps keeppatterns %s/foo/bar/ge
Large substitutions are efficient, but they often leave side effects: your last search changes, your jumplist gets noisy, and marks can shift in ways that break
command-line #command-line #editing #substitution #navigation
/\V<C-r><C-r>"
When your yanked text includes regex symbols like .
:keepjumps normal! /\Vtarget\<CR>
Repeated navigational searches can pollute the jump list, especially when you are doing targeted inspections before returning to your main edit location.
navigation #navigation #search #jumplist #normal-mode #workflow
:'<,'>sort n /\d\+/
Plain :sort n is useful, but it only works when the numeric key starts at the beginning of each line.
visual-mode #visual-mode #sorting #ex-commands #text-processing
:set timeoutlen=300 ttimeoutlen=10
If key mappings feel laggy, many users reduce timeoutlen and stop there.
config #config #mappings #terminal #performance #insert-mode
:set switchbuf=usetab,newtab
When you jump to buffers from quickfix, tags, or command-line completions, Vim's default window selection can feel unpredictable.
buffers-windows #buffers #windows #tabs #quickfix #navigation
:cdo keepjumps keeppatterns %s/\<OldSymbol\>/NewSymbol/ge | update
When you run :cdo over a large quickfix list, Vim can leave your jump list noisy and your last search pattern overwritten.
command-line #quickfix #ex-commands #search #editing #refactoring
:packadd gzip
Compressed logs and artifacts often appear in debugging workflows, and repeatedly shelling out to decompress and recompress wastes time.
:set grepformat=%f:%l:%c:%m
When :grep output does not land cleanly in quickfix, the parser format is usually the missing piece.
:let @+ = @a
If you already have carefully collected text in a named register, re-yanking just to reach the system clipboard is noisy and error-prone.
*cgn
Global substitution is fast, but sometimes you need selective control over each occurrence.
:tabdo only
When you are deep in a refactor, each tab can accumulate helper splits, previews, and temporary views.
buffers-windows #buffers #windows #tabs #ex-commands #workflow