With this text and textwidth set to 80:
foo = dfgdfgdgf + dfgdfgdgf + dfgdfgdgf + dfgdfgdgf + dfgdfgdgf + dfgdfgdgf + sd
Typing another letter results in:
foo = dfgdfgdgf + dfgdfgdgf + dfgdfgdgf + dfgdfgdgf + dfgdfgdgf + dfgdfgdgf +
sdf
Which is a SyntaxError.
I think a simple fix would be to add this:
setlocal formatoptions-=t
Maybe there's some way to detect if there are unclosed parentheses or other syntax that would allow line wrapping, and only wrap if it wouldn't be a SyntaxError? Not sure it's worth the additional complication though, even if that is possible.
With this text and textwidth set to 80:
Typing another letter results in:
Which is a SyntaxError.
I think a simple fix would be to add this:
Maybe there's some way to detect if there are unclosed parentheses or other syntax that would allow line wrapping, and only wrap if it wouldn't be a SyntaxError? Not sure it's worth the additional complication though, even if that is possible.