我想禁用语法突出显示,但仅限于特定缓冲区。我尝试在缓冲区末尾使用模型行:
#vim:syntax off:
Run Code Online (Sandbox Code Playgroud)
和
#vim:set syntax=off:
Run Code Online (Sandbox Code Playgroud)
但它不起作用。
您需要在注释符号和 vim 之间(至少)有一个空格,以便解析模式行。第一个也缺少等号。
# vim:syntax=off:
Run Code Online (Sandbox Code Playgroud)
或者
# vim:set syntax=off:
Run Code Online (Sandbox Code Playgroud)
如果你看一下,: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)
Run Code Online (Sandbox Code Playgroud)
或者
[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
Run Code Online (Sandbox Code Playgroud)