Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

vim plugin - How to run c++ programs on new terminal window after compilation in vim?

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

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

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...