I am often burdened with "converting" and "including" stuff into larger documents. I have compiled some scripts and voodoo to ease my work but rather often I'm still facing the task of manually converting a list given to me as plain text into LaTeX, for example:
1. Foo
2. Bar
When doing so, I select the plain text list in visual mode and replace the prefix with \item
. In this example s/^../\\item/
yields:
\item Foo
\item Bar
Then I select the list again and hit F5 and when asked which environment I want i type itemize
(or whatever) and this finally leads to what I want:
\begin{itemize}
\item Foo
\item Bar
\end{itemize}
My question is: How can I create a shortcut in Vim that does both steps in one? Ultimately I just want to select a list and hit F6.
Of course I will need to redefine the function (or just global variables) ocationally to use a different pattern when replacing prefixes with \item and to use different environments. I think I can do that once I have the initial shortcut/function working.
pandoc
to export to latex - markdown for example uses1. foo
syntax for enumerated lists andpandoc
can translate markdown to LaTeX. see johnmacfarlane.net/pandoc