vimtricks.wiki Concise Vim tricks, one at a time.

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

  • :reg with no arguments lists all non-empty registers
  • :reg a shows only register a
  • :reg abq shows registers a, b, and q together 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"0 shows q, the unnamed register, and numbered register 0
  • Spaces between names are ignored — :reg a b and :reg ab are equivalent
  • Useful before pasting a macro register to double-check its contents without wading through the full register list

Next

What is the difference between the inner word (iw) and inner WORD (iW) text objects in Vim?