I am using vim to compile my code using the command :w | !make.

If this output produces a lot of compiler errors (not uncommon lol), then I'd like to scroll to the top of the output, where the command was executed, so that I can handle the first error first.

My terminal has a 'scroll to last command' feature, but of course the last actual command that the terminal is aware of is >vim ..., so this feature doesn't take me to the top of the last command executed from vim - it takes me to the the top of all the output from vim since i started the session.

Is there a way to scroll my terminal to the last external command? I'm imagining something like w | !make | <scroll-to-last-command>.

  • 1
    Do not make "!make". Make yourself to see :h :make instead.
    – Matt
    Sep 2, 2022 at 10:35
  • Since you're using !, the scroll in question pertains to an external terminal and not to Vim, making this off-topic. Inside Vim using :terminal, you could backwards-search for the prompt (interactive programs, like the shell) or use gg (batch programs). I'm inclined to let this stand, though, since Matt hints at an answer around using built-in facilities which might "redeem" the question.
    – D. Ben Knoble
    Sep 2, 2022 at 14:21


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.