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>orqto 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
:messagesalso shows recent messages (and those accumulate across the session), whileg<only shows the last paged output- For frequently-needed output, use
:redir @a | {cmd} | redir ENDto capture it to a register permanently - In Neovim,
:messagesis often preferred because it provides a scrollable buffer