문제

Sometimes, I'd like to see output source code and standard output of compiled version of this code in vim simultaneously. Let's say, I have code source.cpp and compiled app main. Of course I can redirect main output to file and open it in vim:

 $ main > /tmp/main_output.txt
 $ vim /tmp/main_output.txt

However, it is too boring (especially if you have a lot of pairs code/app). So I'd like to write in vim something like

 :e source.cpp
 :vsp <someway obtained output of main>

How I can obtain it?

도움이 되었습니까?

해결책

Just create a new scratch buffer (:new) and use :read !{cmd} to execute an external command and use its output:

:e source.cpp
:vnew | 0r !main
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top