简体   繁体   English

如何让Vim知道Java 8 lambda语法?

[英]How do I make Vim aware of the Java 8 lambda syntax?

The Java syntax file that comes with Vim 7.4 is choking on the Java 8 lambda syntax. Vim 7.4附带的Java语法文件阻塞了Java 8 lambda语法。 It highlights the -> red. 它突出显示->红色。 How can I fix this? 我怎样才能解决这个问题?

Create a file in ~/.vim/after/syntax named java.vim and add the following to this file: 在名为java.vim ~/.vim/after/syntax创建一个文件,并将以下内容添加到该文件中:

syn clear javaError
syn match javaError "<<<\|\.\.\|=>\|||=\|&&=\|\*\/"
syn match javaFuncDef "[^-]->"

The second line is copied from the standard java syntax file, but without 第二行是从标准java语法文件复制的,但没有

[^-]->

For more about the ~/.vim/after/ directory, see :help after-directory . 有关~/.vim/after/目录的更多信息,请参阅:help after-directory

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

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