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

How do I see all recent Vim messages, errors, and echo output I may have missed?

Answer

:messages

Explanation

:messages displays the full log of recent Vim messages — errors, warnings, echo output, and status notifications. When a message flashes by too quickly to read, or gets overwritten by the next command, :messages lets you scroll back through everything Vim has told you during the session.

How it works

  • Vim stores up to 'messages' entries (default 20, increase with :set messages=200)
  • :messages opens a scrollable pager showing all stored output, newest at the bottom
  • You can navigate it with normal pager keys
  • :messages clear empties the message history
  • :1messages or :1mes shows only the most recent message

Example

You run a macro that produces several lines of output, but only the last line is visible. Running:

:messages

Shows the full history:

could not find pattern 'foo'
substituted 3 occurrences
E486: Pattern not found: bar
1 line changed

Tips

  • Use :verbose set {option}? to see where an option was last set — the output appears in :messages
  • When debugging a plugin or autocmd, add echo calls and inspect them with :messages after the fact
  • Map :messages to a key for quick access: nnoremap <leader>m :messages<CR>
  • In Neovim, :Notifications (Noice plugin) replaces this with a richer UI, but :messages always works natively

Next

How do I refer to the matched text in a Vim substitution replacement?