在vim中制作后的空白文件

时间:2016-05-10 14:33:12

标签: vim makefile

当我运行时:make in vim,如果我在我的唯一cpp文件(main.cpp)中有错误,vim会向我显示错误,当我按回车键时,它会打开一个名为

的文件
^[[H^[[Jmain.cpp

而不是

main.cpp

我必须手动重新打开我的文件。知道如何告诉vim打开正确的文件吗?

我正在运行

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Apr 20 2016 11:17:28) 
MacOS X (unix) version 
Included patches: 1-1655 Compiled by Homebrew

错误输出:

main.cpp:40:2: error: unknown type name 'obvious'
        obvious error
        ^
main.cpp:40:15: error: expected ';' at end of declaration
        obvious error
                     ^
                     ;
2 errors generated.
rm: main: No such file or directory
make: *** [all] Error 1

Press ENTER or type command to continue

vim errorformat(报告:e​​cho& errorformat)

%*[^"]"%f"%*\D%l: %m,"%f"%*\D%l: %m,%-G%f:%l: (Each undeclared identifier is reported only once,%-G%f:%l: for each function it appears in.),%-GIn file included from %f:%l:%c:,%-GIn file included from %f:%l:%c\,,%-GIn file included from %f:%l:%c,%-GIn file included from %f:%l,%-G%*[ ]from %f:%l:%c,%-G%*[ ]from %f:%l:,%-G%*[ ]from %f:%l\,,%-G%*[ ]from %f:%l,%f:%l:%c:%m,%f(%l):%m,%f:%l:%m,"%f"\, line %l%*\D%c%*[^ ] %m,%D%*\a[%*\d]:Entering directory %*[`']%f',
%X%*\a[%*\d]: Leaving directory %*[`']%f',%D%*\a: Entering directory %*[`']%f',%X%*\a: Leaving directory %*[`']%f',%DMaking %*\a in %f,%f|%l| %m

1 个答案:

答案 0 :(得分:0)

Makefile看起来像这样:

all:
    clear && g++ main.cpp -o main

而且明显似乎正在抛弃它。解决方法是删除清除或在

之后添加回显
all:
    g++ main.cpp -o main

all2:
    clear && echo "" && g++ main.cpp -o main