Once I compile and run the code in currently opened vim, the window shifts to terminal where I can input the data. I want the code to run on a separate window, so that I can look at my code too at the same time. SublimeText is a good example, where I can choose which terminal emulator to run my code on. And, the code runs on a separate window.
You can run your program in vim integrated window terminals with:
:term ./%<
" or
:vert term ./%<
(I've used ./%<
to designate foo
in the current directory supposing your edited file is foo.cpp
that you've compiled into foo
).
If you prefer you could use instead another windowed terminal by using :!xterm
, :!gterm
or whatever. Don't forget the argument that tells what to run in the terminal. Sometimes it changes from one to the other.