When using vim to do spell checking in a package.html
file it will flag words it doesn't recognize in code snippets (<code>...</code>
) and inside Javadoc tags (e.g., {@link com.example.Foobar}
). How do I make Vim's spell checker ignore those words?
This can be fixed using the @NoSpell
directive of Vim syntax highlighting.
Put this into a file somewhere:
" Don't spell check embeded Javadoc tags and code snippets in package.html
syn region javadoc_tag start=+{@+ end=+}+ contains=@NoSpell
syn region javadoc_see start=+@see *+ end=+\( \|\$\)+ contains=@NoSpell
syn region code start=+<code>+ end=+</code>+ contains=@NoSpell
Then add this line to your vimrc file:
au BufRead,BufNewFile package.html source /PATH/TO/FILE