I recently needed to wrap listings in a LaTeX document I was working on in a minipage environment. Essentially, to insert some text before and after each line in a file that matched. To do this I used the following sequence of commands:
:g/lstinputlisting/:norm O\begin{minipage}{\textwidth}
:g/lstinputlisting/:norm o\end{minipage}
While this gave the result I desired it seemed clunky to have to enter two separate commands, both operating on the same matched line. Is it possible to execute multiple commands on the same line or is the repeated command really necessary?
To wrap:
with tags:
You can use this command:
\risnew line.&issearch pattern.