There was a very useful answer on how to highlight openmp directives in Fortran code (Vim syntax highlighting for multiline fortran openmp directives). So lines like
!$omp parallel
are no longer highlighted as comments.
It would be great also to make vim not to treat as comments
lines starting with "!$
", i.e. in constructs like
! Make it compile both with and without OMP
nThreads = 1
!$ nThreads = omp_get_num_threads()
I want to have !$
highlighted as fortrandirective
,
and the rest of the last line highlighted normally.
You could use syn match
for this:
:syn match fortranDirective "\v!\$\s"
This matches !$
with a trailing whitespace (to distinguish it from !$omp
).