Vim syntax highlighting for Fortran OpenMP comments

There was a very useful answer on how to highlight openmp directives in Fortran code ( Vim syntax highlighting for multi-line fortran openmp directives ). So strings like

!$omp parallel

no longer stand out as comments.

It would also be nice to get vim not to consider lines starting with " !$" as comments , i.e. in type constructions

! Make it compile both with and without OMP
nThreads = 1
!$ nThreads = omp_get_num_threads()

I want to highlight !$how fortrandirective, and the rest of the last line is highlighted normally.

+4
source share
1 answer

syn match :

:syn match fortranDirective "\v!\$\s" 

!$ ( !$omp).

+4

All Articles