Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable syntax hightlighting in vim only for specific buffer

Tags:

vim

I want to disable syntax highlighting but only for a specific buffer. I tried using modeline at the end of the buffer:

#vim:syntax off:

and

#vim:set syntax=off:

But it is not working.

like image 773
milarepa Avatar asked Feb 13 '23 01:02

milarepa


1 Answers

You need a space (minimally) between the comment symbols and vim for mode lines to be parsed. The first one is also missing an equals sign.

# vim:syntax=off:

Or

# vim:set syntax=off:

If you look at :h modeline you will see that there can be any leading text before vim: but there needs to be whitespace after that text.

The two forms fix the patterns

[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)

Or

[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
like image 115
FDinoff Avatar answered May 20 '23 14:05

FDinoff