How to save command output window in vim

What I'm looking for is a different window than the current one, containing the output of the command in the same buffer. Therefore, I can do:

:!php % 

And see the result in the bottom split window. This is usually seen in most of the graphic editors that I used.

Notes:

  • Not current window. Do not want to switch back.
  • Do not create a new buffer every time. (you must reuse the "output" buffer)
  • I do not want this to be in the register, I want to see the output right away.

The stream will be:

  • Open vim -S session ...
  • Edit file
  • Running a simple make-type command
  • Look at the output of the command in the output window

without hundreds of new buffers and switching between windows.

What I have tried so far, which is not satisfactory ... sending output to a file, including autoread, opening a buffer in this file. This works, but I have to enable autoread for all files .. a little annoying. Is there a way to enable autoread for a single buffer / file?

Thank you for your help.

+7
source share
1 answer

Looks like you are looking for Vim " quickfix ". I would use 'makeprg' :make and :copen , for example:

 :set makeprg=php\ % :make :copen 

Alternatively, you can use the 'errorformat' parameter to deliver the cursor to the first line containing the error.

 :set errorformat=%m\ in\ %f\ on\ line\ %l 

And for speed I have F5 showing make :

 :nnoremap <F5> :<CU>make<CR> 
+8
source

All Articles