Reputation: 244
I love vim, and I really like to hard wrap my texts when I write them. The markdown plugin from Tim Pope is great, and is build such that when I try to hard wrap a list of items it does the job right. Ok here is what I mean by doing the job right:
- here I write a long long long line that is longer than the 80 caracters of a line and therefore should be wrapped.
- This is a short line
- here I write another long long long line that is longer than the 80 caracters of a line and therefore should be wrapped.
should become (after applying gqap):
- here I write a long long long line that is longer than the 80 caracters
of a line and therefore should be wrapped.
- This is a short line
- here I write another long long long line that is longer than the 80 caracters
of a line and therefore should be wrapped.
Now, the behaviour of the same command for a text with a tex filetype is not that smart:
\begin{itemize}
\item here I write a long long long line that is longer than the 80 caracters I fixed and therefore should be wrapped.
\item This is a short line
\item here I write another long long long line that is longer than the 80 caracters I fixed and therefore should be wrapped.
\end{itemize}
becomes (still after a gqap):
\begin{itemize} \item here I write a long long long line that is longer than
the 80 caracters I fixed and therefore should be wrapped. \item This
is a short line \item here I write another long long long line that is
longer than the 80 caracters I fixed and therefore should be wrapped.
\end{itemize}
How can I make the wrapping of the list of items in LateX behave like the markdown list?
To me it looks like I should redefine the syntax file, but I have no idea how (the way markdown works is by using the elements defined for HTML).
Upvotes: 2
Views: 541
Reputation: 161834
:set fo+=n
:let &flp='^\s*\\\w*\s*'
\begin{itemize}
\item here I write a long long long line that is longer than the 80 caracters I fixed and therefore should be wrapped.
\item This is a short line
\item here I write another long long long line that is longer than the 80 caracters I fixed and therefore should be wrapped.
\end{itemize}
gggqG.
\begin{itemize}
\item here I write a long long long line that is longer than the 80
caracters I fixed and therefore should be wrapped.
\item This is a short line
\item here I write another long long long line that is longer than the 80
caracters I fixed and therefore should be wrapped.
\end{itemize}
Upvotes: 6