How do I get Vim to know the Java 8 lambda syntax?

The Java syntax file that comes with Vim 7.4 is choked with Java 8 lambda syntax. It highlights red ->

. How can I fix this?

+3


source to share


1 answer


Create a file in ~/.vim/after/syntax

named java.vim

and add the following to that 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 information on the catalog, ~/.vim/after/

see :help after-directory

.

+9


source







All Articles