When coding, I like to check the code by running :! g++ %. I map the command to <F5>. sometimes it takes a while to compile and I want to see the errors without spending time recompiling. Also, sometimes I want to compare the new output to previous one.
Is there a way to see the previous output of :! ...?
Provided you have
g++configured withmakeprg, you can use:copento reopen the last list of errors from the:makecommand.Then, to compile, use
When the compile completes, any errors will be listed in the quickfix window, which can (assuming
errorformatis correctly configured) be used to jump to the lines on which errors occur. This usually works out of the box for C/C++.If you dismiss the quickfix window, retrieve the last error list with
Review
:help quickfixand:help makeprgfor full gory details on how this works.