are used for special characters appearing in strings, strings proper,
boolean literals, and special instance references (`super`, `this`, `null`),
respectively.
Javadoc is a program that takes special comments out of Java program files and
creates HTML pages. The standard configuration will highlight this HTML code
similarly to HTML files (see |html.vim|). You can even add JavaScript and CSS
inside this code (see below). The HTML rendering and the Markdown rendering
diverge as follows:
1. The first sentence (all characters up to the first period `.`, which is
followed by a whitespace character or a line terminator, or up to the
first block tag, e.g. `@param`, `@return`) is colored as
`*SpecialComment` special comments.
2. The text is colored as
`*Comment` comments.
3. HTML comments are colored as
`*Special` special symbols.
4. The standard Javadoc tags (`@code`, `@see`, etc.) are colored as
`*Special` special symbols
and some of their arguments are colored as
`*Function` function names.
To turn this feature off for both HTML and Markdown, add the following line to
your startup file: >
:let g:java_ignore_javadoc = 1
Alternatively, only suppress HTML comments or Markdown comments: >
:let g:java_ignore_html = 1
:let g:java_ignore_markdown = 1
See |ft-java-plugin| for additional support available for Markdown comments.
If you use the special Javadoc comment highlighting described above, you can
also turn on special highlighting for JavaScript, Visual Basic scripts, and
embedded CSS (stylesheets). This only makes sense if any of these languages
actually appear in Javadoc comments. The variables to use are >
:let g:java_javascript = 1
:let g:java_css = 1
:let g:java_vb = 1
Note that these three variables are maintained in the HTML syntax file.
Numbers and strings can be recognized in non-Javadoc comments with >
:let g:java_comment_strings = 1
When 'foldmethod' is set to "syntax", blocks of code and multi-line comments
will be folded. No text is usually written in the first line of a multi-line
comment, making folded contents of Javadoc comments less informative with the
default 'foldtext' value; you may opt for showing the contents of a second
line for any comments written in this way, and showing the contents of a first
line otherwise, with >
:let g:java_foldtext_show_first_or_second_line = 1
HTML tags in Javadoc comments can additionally be folded by following the
instructions listed under |html-folding| and giving explicit consent with >
:let g:java_consent_to_html_syntax_folding = 1
Do not default to this kind of folding unless ALL start tags and optional end
tags are balanced in Javadoc comments; otherwise, put up with creating runaway
folds that break syntax highlighting.
Trailing whitespace characters or a run of space characters before a tab
character can be marked as an error with >
:let g:java_space_errors = 1
but either kind of an error can be suppressed by also defining one of >
:let g:java_no_trail_space_error = 1
:let g:java_no_tab_space_error = 1
In order to highlight nested parens with different colors, define colors for
`javaParen`, `javaParen1`, and `javaParen2`. For example, >
:hi link javaParen Comment
or >
:hi javaParen ctermfg=blue guifg=#0000ff
Certain modifiers are incompatible with each other, e.g. `abstract` and
`final`: >
:syn list javaConceptKind
and can be differently highlighted as a group than other modifiers with >
:hi link javaConceptKind NonText
If you notice highlighting errors while scrolling backwards, which are fixed
when redrawing with CTRL-L, try setting the "g:java_minlines" variable to
a larger number: >
:let g:java_minlines = 50
This will make the syntax synchronization start 50 lines before the first
displayed line. The default value is 10. The disadvantage of using a larger
number is that redrawing can become slow.
Significant changes to the Java platform are gradually introduced in the form
of JDK Enhancement Proposals (JEPs)