开发者

Vim syntax/compile-time error highlighting

Is there a Vim script that periodically tries to compile/interpret the code that I'm working on, and highlights syntax errors? I'd like it to point out that something is wrong between these lines:

int a = 42
cout << a << endl;

Such a thing would save me loads of time. I'm primarily searching for a Perl-syntax checker, but I'd also be interested in similar plugins for other languages.

Update: Another error I'd like it to point out:

int a == 42;
cout &l开发者_运维百科t;< a << endl;


You can use eclim : once your eclim server is set up and running, you can use the Vim command :Validate to run a code validation on your file.

Basically, it uses the validation available in eclipse and display it in Vim/gVIm in the location list. (use :lopen )

For your example, the location list contains :

test.cpp|1 col 11 error| Syntax error
test.cpp|2 col 1 error| Syntax error

(the col 11 corresponds to location of the missing ;)

By default the validation is run every time you save a buffer.

The error description are not really crystal clear but once you find the line with the error, you usually spot the error pretty easily.


Auto-indenting should do it. When you start your new line with an extra indentation level it probably means that either you entered a new block or that you did not finish a statement.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜