3

From time to time I do a source of a script and N errors and warnings manifest. As the errors/warnings show it is impossible to scroll buffer/window. Cursor, at least in gvim is a bold white x.

The log part of Vim is typically:

 Error detected while processing function Foo:
 line  16:
 E123: blah
 E456: blah
 line  38:
 E789 blah
 Press Enter or type a command to continue

My want is to be able to scroll the buffer, typically to investigate reported errors, while the errors are showing. (So I do not have to memorize it for each run …).

3

I don't believe it's possible to scroll the buffer while the Ex-command output is displaying.

A workaround is to redirect the output to a new file, which you can then open in a split.

:redir > output.txt
:source script.vim
:redir END
:split output.txt

Alternatively, if it's a script you're writing yourself, you could investigate the Decho plugin, which provides debug commands that can log output to a variety of destinations. Decho is included with the standard installation of Vim (:help Decho.vim).

  • Trying out some solutions based on the commands. Yes; it is when writing own scripts, (or debugging others), typically by :so % or the like. – Runium Mar 11 '15 at 19:10
3

Vim stores up to 20 error messages by default in its messages history. This list can be reviewed using the command :messages.

For further information check:

:help :messages
:help 'shortmess'
  • Can't believe I forgot to mention that in my answer! Upvoted. – Rich Mar 11 '15 at 12:58
  • Yes, I use the :messages command, but this also renders the main window un-scrollable. Another issue I have with it is that it stores 200 messages (running normal, not tiny Vim.) If one have typically 200 messages it is going to fill entire height of Vim + it usually yield 1NN+ messages before the ones I want. The whole process becomes somewhat cumbersome - especially on multiple errors. But; +1 as it is relevant. – Runium Mar 11 '15 at 18:40
  • In that case I think that the answer @Rich posted is what you are looking for. Maybe he could expand his answer to include mine such that it contains all relevant information? – Vitor Mar 11 '15 at 19:26
  • @Vitor I don't think that's necessary. It's fine for different answers to contain different solutions for the same problem. If people don't like my answer I'm sure they'll read yours, and vice versa! – Rich Mar 11 '15 at 22:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.