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.

1 Answer 1


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.

  • Afterwards, you may have to :syntax sync fromstart to highlight existing text. Commented Jun 14, 2021 at 16:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .