What I'm looking for is a different window than the current one containing the output of a command into the same buffer. So I can execute:
:!php %
And see the output in a bottom split window. That's commonly seen in most graphical editors I've used.
Notes:
- Not the current window. Don't want to have to switch back
- Not creating a new buffer each time. (have to reuse "output" buffer)
- I don't want that in a register, I want to be able to see the output straight away.
The flow would be:
- Open vim -S session ...
- Edit a file
- Execute a simple make-type command
- Look at command output in output window
without having hundreds of new buffers and ha开发者_JS百科ving to switch between windows.
What I've tried so far that is not satisfactory ... sending output to file, turning autoread on, opening a buffer on that file. That works but I have to turn autoread on for all files.. a bit annoying. Is there a way to turn autoread for a single buffer/file?
Thanks for your help.
It sounds like you are looking for Vim's "quickfix" window. I'd use 'makeprg'
, :make
and :copen
, like this:
:set makeprg=php\ %
:make
:copen
Additionally, you can use the 'errorformat'
option to deliver the cursor to the first line containing an error.
:set errorformat=%m\ in\ %f\ on\ line\ %l
And for speed, I have F5 mapped to make
:
:nnoremap <F5> :<C-U>make<CR>
精彩评论