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

  \item Apple
  \item Banana

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.


Your Answer

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

Browse other questions tagged or ask your own question.