仅在特定缓冲区中禁用vim中的语法突出显示

时间:2014-09-15 13:04:14

标签: vim

我想禁用语法突出显示,但仅限于特定缓冲区。我尝试在缓冲区末尾使用modeline:

#vim:syntax off:

#vim:set syntax=off:

但它没有用。

2 个答案:

答案 0 :(得分:4)

在评论符号和vim之间需要一个空格(最小)来解析模式行。第一个也缺少一个等号。

# vim:syntax=off:

或者

# vim:set syntax=off:

如果查看:h modeline,您会看到vim之前可能有任何前导文本:但在该文本之后需要有空格。

这两种形式修复了模式

[text]{white}{vi:|vim:|ex:}[white]{options}

[text]                  any text or empty
{white}                 at least one blank character (<Space> or <Tab>)
{vi:|vim:|ex:}          the string "vi:", "vim:" or "ex:"
[white]                 optional white space
{options}               a list of option settings, separated with white space
                        or ':', where each part between ':' is the argument
                        for a ":set" command (can be empty)

[text]{white}{vi:|vim:|Vim:|ex:}[white]se[t] {options}:[text]

[text]                  any text or empty
{white}                 at least one blank character (<Space> or <Tab>)
{vi:|vim:|Vim:|ex:}     the string "vi:", "vim:", "Vim:" or "ex:"
[white]                 optional white space
se[t]                   the string "set " or "se " (note the space); When
                        "Vim" is used it must be "set".
{options}               a list of options, separated with white space, which
                        is the argument for a ":set" command
:                       a colon
[text]                  any text or empty

答案 1 :(得分:2)

您可以手动设置语法:

:syntax manual

然后你可以在你喜欢的缓冲区中启用:

:syntax on