Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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.

question from:https://stackoverflow.com/questions/65916752/how-to-run-c-programs-on-new-terminal-window-after-compilation-in-vim

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
940 views
Welcome To Ask or Share your Answers For Others

1 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...