Vim Fortran OpenMP 注释的语法突出显示
Vim syntax highlighting for Fortran OpenMP comments
有一个关于如何在 Fortran 代码中突出显示 openmp 指令的非常有用的答案 (Vim syntax highlighting for multiline fortran openmp directives)。
所以像
这样的行
!$omp parallel
不再突出显示为评论。
如果vim不被当成评论就好了
以“!$
”开头的行,即在
这样的结构中
! Make it compile both with and without OMP
nThreads = 1
!$ nThreads = omp_get_num_threads()
我想将 !$
突出显示为 fortrandirective
,
最后一行的其余部分正常突出显示。
您可以为此使用 syn match
:
:syn match fortranDirective "\v!$\s"
这与尾随空格的 !$
匹配(以区别于 !$omp
)。
有一个关于如何在 Fortran 代码中突出显示 openmp 指令的非常有用的答案 (Vim syntax highlighting for multiline fortran openmp directives)。 所以像
这样的行!$omp parallel
不再突出显示为评论。
如果vim不被当成评论就好了
以“!$
”开头的行,即在
! Make it compile both with and without OMP
nThreads = 1
!$ nThreads = omp_get_num_threads()
我想将 !$
突出显示为 fortrandirective
,
最后一行的其余部分正常突出显示。
您可以为此使用 syn match
:
:syn match fortranDirective "\v!$\s"
这与尾随空格的 !$
匹配(以区别于 !$omp
)。