在 Vim 中编辑 Fortran 时消除制表符空间的红色突出显示

发布于 2024-12-22 19:03:20 字数 120 浏览 2 评论 0原文

当我编写 Fortran 代码并使用制表符进行缩进时,Vim 以红色突出显示这些空格,因为在旧版 Fortran 中,前 6 列是特殊的,为标签/行号和延续符号保留。我怎样才能让 Vim 停止这样做呢?

谢谢。

When I code Fortran, and use tabs for indentation, Vim highlights those spaces in red, because in older Fortran the first 6 columns were special and reserved for labels/line numbers and continuation symbols. How can I make Vim stop doing that?

Thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

烟雨扶苏 2024-12-29 19:03:20

停止突出显示 Tab

:hi link fortranTab NONE

开始突出显示 Tab

:hi link fortranTab Error

stop highlighting Tab

:hi link fortranTab NONE

start highlighting Tab

:hi link fortranTab Error
晚雾 2024-12-29 19:03:20

实际上,制表符不是 Fortran 字符集的一部分,可移植代码应该避免使用它。因此,我建议将 vim 配置为使用空格而不是制表符进行缩进,请参阅“expandtab”选项。

Actually, tab is not part of the Fortran character set, and portable code should avoid it. So instead I'd recommend to configure vim to use spaces instead of tabs for indentation, see the "expandtab" option.

裂开嘴轻声笑有多痛 2024-12-29 19:03:20

将以下内容放入 .vimrc 中:

let fortran_have_tabs=1

文档中有解释: http://vimdoc.sourceforge.net/ htmldoc/syntax.html

Put the following in your .vimrc:

let fortran_have_tabs=1

Explained in the documentation: http://vimdoc.sourceforge.net/htmldoc/syntax.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文