你如何让Vim突出C ++语法错误像Visual Studio? [英] How do you get Vim to highlight C++ syntax errors like Visual Studio?

查看:201
本文介绍了你如何让Vim突出C ++语法错误像Visual Studio?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有可能让gVim像Visual Studio一样实时地突出显示C ++语法错误(下面的红色波浪)。

Is it possible to get gVim to highlight C++ syntax errors (the red squiggles underneath) in real-time like Visual Studio?

推荐答案

简短的答案:是的,但它不会像IDE中那么流畅/直接。

Short answer: Yes, but it won't be so smooth / immediate as in IDEs.

答案很长:虽然IDE具有内置支持,等等)对于(通常非常有限的)一组编程语言,Vim是通用编辑器,因此必须依靠外部工具来进行语法检查。内置的方法是执行:make ,并在 quickfix list 中接收(语法或编译器)错误的列表。有自动化的插件; Syntastic 非常受欢迎,支持多种语言。

Long answer: Whereas IDEs have built-in support (and parsers, etc.) for a (usually very limited) set of programming languages, Vim is a general-purpose editor, and therefore has to rely on external tools to do the syntax checking. The built-in way is to execute :make and receive a list of (syntax or compiler) errors in the quickfix list. There are plugins to automate that; Syntastic is a very popular one with support for many languages.

但仍然,因为Vim必须调用外部可执行文件,并且几乎不支持异步运行任务,将有更多的延迟,直到你看到错误。如果你不能没有IDE的功能,可以根据自己的优势使用它们:Vim用于超高效文本编辑,IDE用于代码导航,调试和编译。

But still, because Vim has to invoke an external executable and has little support for running tasks asynchronously, there will be more delay until you see the errors. If you can't do without the features of an IDE, it's fine to use both according to their strengths: Vim for super-efficient text editing, and the IDE for code navigation, debugging, and compilation.

这篇关于你如何让Vim突出C ++语法错误像Visual Studio?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆