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

How do I display the contents of only certain registers instead of all of them at once?

Answer

:reg a b c

Explanation

The :reg (alias :registers) command accepts a string of register names as its argument. Passing one or more names shows only those registers, making it easy to compare a few specific values without scrolling through all 48+ registers that :reg alone would display.

How it works

  • :reg with no arguments lists every register that has content
  • :reg {chars} displays only the registers whose names appear in {chars}
  • The argument is a string of names, not space-separated: :reg ab shows a and b; :reg a b c does the same (spaces are ignored)
  • Works with named registers (az), numbered registers (09), and special registers (", +, *, -, etc.)

Example

After recording a macro into q and yanking text into a:

:reg qa"

Shows only registers q, a, and " (the default register):

--- Registers ---
"q   dd0^M
"a   some yanked text
""   last deleted/changed text

Tips

  • :reg 0 shows the yank register — the most recently yanked text, unaffected by deletes
  • :reg 0" shows the yank register alongside the default register — useful to confirm a yank before pasting
  • :reg +* shows both clipboard registers on systems with clipboard support
  • :reg 123456789 shows the numbered delete history registers in order
  • In insert mode, <C-r>a pastes from register a directly

Next

How do I encode and decode JSON data in Vimscript for configuration and plugin development?