vim doesn't recognize columns beyond 72 with f

2020-03-03 07:22发布

I am editing a fortran90 code with vim. Note that I'm working with a *.f90 file, not *.f. vim doesn't recognize as legitimate code anything beyond column 72. This is an annoying problem because if a quote is opened at, say, column 50 but not closed until column 80, then vim colors all the following lines as part of the same quote. This would make sense if I was working with an old fortran77 file, but I'm clearly not. Is there any way to convince vim to recognize code beyond column 72?

2条回答
smile是对你的礼貌
2楼-- · 2020-03-03 07:54

This could be related to the 'synmaxcol' variable. If you run

:set synmaxcol?

In vim's command line, what do you get back? Setting this option higher might fix your issue. It's generally set low as vim can get laggy when syntax highlighting very long lines, such as those found in XML.

查看更多
Anthone
3楼-- · 2020-03-03 07:59

if I create a new .f90 file syntax is highlighted as if it is fortran 77 (fixed line length, comments in first col, code at 6th col, etc etc) rather than modern free form fortran.

:let b:fortran_fixed_source=0
:set syntax=fortran

does the trick to get vim highlighting it correctly.

查看更多
登录 后发表回答