:syn match specialComment #//!!.*# | hi specialComment ctermfg=red guifg=red
As Ingo Karkat points out, you can have the commands executing after a .c
file is loaded by placing them in ~/.vim/after/syntax/c.vim
.
Another option, if you'd like to place everything in a single file, such as ~/.vimrc
, could be to bind the commands to the buffer enter event:
au! BufEnter *.c syn match specialComment #//!!.*# " C files (*.c)
au! BufEnter *.py syn match specialComment /#!!.*/ " Python files (*.py)
...
hi specialComment ctermfg=red guifg=red