I'm not sure whether this is an appropriate question for tex.SE. If you think questions like this should not be asked here, please voice you concern. If necessary I'll open a question on meta.
For readability I like to keep line lengths in my source files at about 80 characters. Vim has the nice shortcut gqap
that reflows the current paragraph to fit within 80 characters without wasting space with lines that are too short. It even keeps indentation. Unfortunately it considers paragraphs to be marked by empty lines and considers everything that is not separated by an empty line to be in the same paragraph. In particular any equations (started with \[
or \begin{...}
) are always considered to be part of the paragraph and reflowed.
Is there any way to have vim handle LaTeX syntax more intelligently in this respect? Are there any other text editors which can to that?
(I know that I can highlight only the text and then use gq
, but if possible I'd like to have a single command to reflow a paragraph without the need to manually mark what a paragraph is.)
gqq
do what you need? (orVgq
). It's line-wise, ie. if you type-in text without manual line-breaks.