How can I can specific word wrapping for specific tags. For example, in LaTex I want word wrapping for my paragraphs but not for my figure commands (they are always very long and run off the screen).
Or with Javascript, I want the right margin for code to be at, for example 50 columns, but for the comments to be at only 40 columns
This is not builtin
You could probably script something yourself using a devious combination of
`formatexpr`andsynID(). I suggest you look at the help of the latter first, because it contains inspirational samples:taken from
:he synstackThe
formatexpris usually set to something likethus delegating to a filetype plugin. You could implement the function to use different margins for different syntax contexts.
Bear in mind
that syntax highlighting may become out of sync. I’m not sure what happens when the cursor is at, say, 70% of a large document and you issue ggVGgq. It might not update the syntax highlighting all the way (meaning that your
formatexprfunction would get the ‘wrong’synID()values. You get around this by saying something likethis again might impact the highlighting performance depending on the size/complexity of the source and highlighting scripts