2

我喜欢 vim,而且我真的很喜欢在编写文本时对它们进行硬包装。Tim Pope 的 markdown 插件很棒,它的构建使得当我尝试硬包装一个项目列表时,它可以正确地完成工作。好的,这就是我正确完成工作的意思:

- 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.

应该变成(应用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.

现在,对于具有 tex 文件类型的文本,同一命令的行为并不那么聪明:

\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}

变为(仍然在 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}

如何使 LateX 中项目列表的包装表现得像降价列表?

在我看来,我应该重新定义语法文件,但我不知道如何(markdown 的工作方式是使用为 HTML 定义的元素)。

4

1 回答 1

6

配置

: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}
于 2012-06-20T08:35:53.457 回答