Vim syntax highlight limited to 3000 chars

syntax highlightingvim

How do I allow vim to work its syntax highlight on lines longer than 3000 characters?

I am having to write tests for a system and the input for the tests are a mess of encapsulated formats.

My tests must have hardcoded inputs that are a huge string with the language I am using around JSON around HTML which may contain scripts, etc, etc. And since I am getting them from the output of another system, I do not want to manipulate them to fit my editor.

I managed to get it to a somewhat bearable level except that the vim limitation breaks syntax highlight for everything past those long lines. I assume this about vim saving resources, but I really want syntax highlight when working on those files.

Best Answer

Use :set synmaxcol=0 to remove the limit or choose any large value.

Warning: This setting may add a significant redraw delay.

Vim documentation: options - synmaxcol

'synmaxcol' 'smc' number  (default 3000)

Notes: local to buffer, not in vi

Maximum column in which to search for syntax items. In long lines the text after this column is not highlighted and following lines may not be highlighted correctly, because the syntax state is cleared. This helps to avoid very slow redrawing for an XML file that is one long line.

Set to zero to remove the limit.

Related Question