繁体   English   中英

如何在Vim中制作PRCC GCC管道T恤errors.err?

[英]How to makeprg gcc pipe tee errors.err in vim?

我想将stderrgcc传递到tee errors.err但是尝试这两个组成部分我没有运气:

setlocal makeprg=gcc\ -Wall\ -Wextra\ -g\ -O0\ -ansi\ -pedantic-errors\ %\ -o\ %<.x\ 2>\ >(tee\ errors.err)

该文件在那里,但是空白。 起初我以为:make正在删除它,但是即使使用set makeef=makeerrors.errerrors.err文件仍为空白。

另一个(实际上是我以前的解决方案)是:

setlocal makeprg=gcc\ -Wall\ -Wextra\ -g\ -O0\ -ansi\ -pedantic-errors\ %\ -o\ %<.x\ 2>&1\ |\ tee\ errors.err

但是我遇到了这个错误,但我从未想出如何消除它: E10: \\ should be followed by /, ? or & E10: \\ should be followed by /, ? or &


编辑1:我也尝试使用其他文件名,例如teerrors.err ,以防万一。 同样的问题。

编辑2:我也尝试过:

set shellredir=2>errorsredir.err
!gcc % -o %<.x

无济于事。 但是,无论如何,这不是解决方案,因为我无法将makeprg设置为过滤器。

编辑3:此(管道中的\\

setlocal makeprg=gcc\ -Wall\ -Wextra\ -g\ -O0\ -ansi\ -pedantic-errors\ %\ -o\ %<.x\ 2>&1\ \|\ tee\ teeerrors.err

给出vim错误: E492: Not an editor command: tee teeerrors.err

我的想法不多了。

有点晚了,但是...您可以使用管道,只需添加其他双反斜杠即可:

setlocal makeprg=gcc\ -Wall\ -Wextra\ -g\ -O0\ -ansi\ -pedantic-errors\ %\ -o\ %<.x\ 2>&1\ \\\|\ tee\ teeerrors.err

我想我找到了解决方案。 比我想象的简单。

:set makeprg=gcc\ -Wall\ -Wextra\ -g\ -O0\ -ansi\ -pedantic-errors\ %\ -o\ %<.x\ 2>errors.err;\ cat\ errors.err

底线:你不能管道。 (至少我找不到管道解决方案)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM