# Remove blank lines in minted

Is it possible to remove blank (empty) lines in minted, and gobble multiple blank lines to a specified amount, like the emptylines option in listings?

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{minted}
\usepackage{listings}
% I want something like the emptylines option
\lstset{language=[Visual]{C++},emptylines=1}
\begin{document}
\begin{minted}[frame=single]{cpp}
int i = 0;

i++;
\end{minted}
\begin{lstlisting}
int i = 0;

i++;
\end{lstlisting}
\end{document}

-
Thanks Marco, it seems I have programmed to much C++ today. – Juri Robl Sep 29 '12 at 17:55
Af far I know you can globbe the star of lines or disable numbering of blank lines (numberblanklines=false) but wihout removing lines. – Fran Jul 7 '13 at 22:07

The minted package uses fancyvrb behind the scenes. This package doesn't have a build-in facility to skip blank lines. It is possible to add a test to skip blank lines, for example

\begingroup
\makeatletter
\catcode\^^M=\active
\gdef\FancyVerbGetLine#1^^M{%
\@nil
\FV@CheckEnd{#1}%
\ifx\@tempa\FV@EnvironName
\let\next\FV@EndScanning
\else
\def\FV@Line{#1}%

Dealing with picking particular numbers of blank lines is more tricky: Id be tempted to simply go for listings` or edit the code source rather than try to alter this.