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

How do I redisplay the output from the last Ex command that already scrolled away?

Answer

g<

Explanation

Pressing g< in normal mode redisplays the last page of output produced by the previous Ex command. When a command like :registers, :ls, or :scriptnames produces more output than fits on the screen, it shows a -- More -- prompt and then clears when you dismiss it. g< lets you scroll back to review that output without re-running the command.

How it works

  • g< shows the output that was most recently displayed by a command in the pager (the "more" prompt)
  • It restores whatever was last shown in the command output area, not just the last line
  • Works for any command that produced paged output, including :help, :ls, :map, :registers, and :messages
  • The output is read-only; press <Space> or q to dismiss it again

Example

:scriptnames
" ... output flashes by and disappears after pressing <CR>

" Now you want to re-read it:
g<
" The full scriptnames output reappears for review

Tips

  • :messages also shows recent messages (and those accumulate across the session), while g< only shows the last paged output
  • For frequently-needed output, use :redir @a | {cmd} | redir END to capture it to a register permanently
  • In Neovim, :messages is often preferred because it provides a scrollable buffer

Next

How do I run a normal mode command from the ex command line without triggering my custom key mappings?