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

Categories

0 votes
897 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 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...