How to run make in vim and open results in a split window?

牧云@^-^@ 提交于 2019-12-02 15:10:37

If you want compile and run if compile succeeded. (i.e !g++ % && ./a.out )

Create a shells script with the following line,

g++ $1 -o /tmp/a.out && /tmp/a.out

Now set the makeprg like this. set makeprg=compileNrun.sh\ %

Cannot set the whole command directly as makeprg because of &&. If set in makeprg directly, the above command will be expanded to,

!g++ file.C -o /tmp/a.out && /tmp/a.out 2>&1 | tee /tmp/errorFile

Hence compilation errors wont be redirected to the error file if compilation failed ;P as && takes precedence over |

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!