How do I inspect the contents of specific Vim registers without listing all of them?
Answer
:reg {names}
Explanation
The :registers command dumps every register at once, which is noisy when you only care about a handful. You can pass one or more register names directly to :reg to display only those — no plugins, no filtering required.
How it works
:regwith no arguments lists all non-empty registers:reg ashows only registera:reg abqshows registersa,b, andqtogether in a single clean output- Works with any register type: named (
a–z), unnamed ("), numbered (0–9), clipboard (+,*), expression (=), small delete (-)
Example
After recording macros and yanking some text:
:reg aq
Outputs only those two registers:
--- Registers ---
"a :wq<CR>
"q :s/foo/bar/g<CR>gg
Compare this to :registers which would list all 25+ registers including many empty ones.
Tips
- Pass the register names as a single string:
:reg q"0showsq, the unnamed register, and numbered register0 - Spaces between names are ignored —
:reg a band:reg abare equivalent - Useful before pasting a macro register to double-check its contents without wading through the full register list