Вопрос

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