简体   繁体   中英

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. 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:

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

The second line is copied from the standard java syntax file, but without

[^-]->

For more about the ~/.vim/after/ directory, see :help after-directory .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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