2

How do I mimic the behavior of Doxygen comment highlighting for PC-lint comments? Comments are in the following formats:

/*lint ... */
//lint ...
/* LINTLIBRARY */
/* ARGUSED */
/* VARARGS[N] */ <--- N is a number
/* NOTREACHED */
/* NOSTRICT */
/* FALLTHROUGH */
/* FALLTHRU */
/* PRINTFLIKEN */ <--- N is a number

Ideally highlighting would mimic the behavior of Doxygen comment highlighting.

EDIT: I want to make lint comments highlight like the Doxygen comment in the screenshot. like this

3
  • Do you want the above to be simply highlighted as comments or is there additional nested highlighting that you want? If it's the latter, a screen-shot might help.
    – Tumbler41
    Apr 13, 2017 at 14:39
  • @Tumbler41 I want to highlight the listed keywords in the comments just like Doxygen commands are highlighted.
    – thetic
    Apr 13, 2017 at 15:09
  • Maybe I'm in the minority, but I don't know how Doxygen commands are highlighted, and a quick google search produced nothing useful. Could you provide a screenshot with the appropriate highlighting you're looking for?
    – Tumbler41
    Apr 13, 2017 at 15:18

1 Answer 1

3

Did you have a look at syntax/doxygen.vim? This is where doxygen highlighting is defined.

What you need to do then, is to add a file for pclint in ~/.vim/syntax/, and a syntax rule inspired from the one in syntax/synload.vim which is:

au Syntax c,cpp,cs,idl,java,php,datascript
    \ if (exists('b:load_doxygen_syntax') && b:load_doxygen_syntax)
    \   || (exists('g:load_doxygen_syntax') && g:load_doxygen_syntax)
    \   | runtime! syntax/doxygen.vim
    \ | endif

See :h mysyntaxfile

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.