4

I use vim to edit latex files and the automatic formatting option (formatoptions+=a) works very well, since you can enter text anywhere in the paragraph and vim will reformat the entire paragraph.

The problem is that when I edit a set of lines containing commands, like this

\begin{enumerate}
  \item Apple
  \item Banana
\end{enumerate}

vim treats the text as though it were a paragraph, and will reformat to this

\begin{enumerate} \item Apple \item Pear \end{enumerate}

I am wondering if there is a way to automatically reformat prose only. A solution specific to latex might just ignore lines beginning with \ but perhaps there is a smart general solution involving some vim settings.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.