I use this command :!g++ % -g -lm && a.exe & pause The result comes out in a new command prompt. I'm using gvim7.3. How can i make VIM to display the result in the same window (horizontal split)? Thanks in advance.
:make then :copen should do the trick. You can also close the window with :cclose.
Try this:
:new +r\ !g++\ #\ -g\ -lm
That opens a new "window" and reads the output of the g++ command into it. Note that you need to use # instead of % because you have switch to a new buffer.
I'm not sure how to get && to work, so I would just create a script that compiles and executes.
You might want to also do "set nomod" so you can close that window without saving the file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With