# How do I change the style of the minted line numbers with line skips?

I'm using minted to show pieces of code in my document. Some of the code has skipped line numbers. The resulting problem is that listings with skipped line numbers have different line number formatting than the ones without.

The minted documentation and this StackExchange question shows a way to modify the theFancyVerbLine command to change the formatting. However that won't effect the listings with line skips.

I tried combining the two approaches but that would duplicate the line numbers. What do I miss from the minted documentation?

Minimal working example:

% arara: xelatex: {shell: yes }
\documentclass{scrreprt}
\usepackage{minted}

\renewcommand{\theFancyVerbLine}{\textcolor[rgb]{0.5,0.5,1.0}{\footnotesize\arabic{FancyVerbLine}}}

\begin{document}

\begin{listing}[H]
\begin{minted}[linenos]{py}
import bar from foo

print("Hello %s!" % "World")
\end{minted}
\end{listing}

\begin{listing}[H]
\renewcommand\theFancyVerbLine{%
\ifnum\value{FancyVerbLine}=2
\setcounter{FancyVerbLine}{125}\ldots
\else
\arabic{FancyVerbLine}%
\fi
}
\begin{minted}[linenos]{py}
import deep_thought as dt

\end{minted}
\end{listing}

\end{document}


The required modification is to replace \arabic{FancyVerbLine} in the second listing with the definition above, i.e., \textcolor[rgb]{0.5,0.5,1.0}{\footnotesize\arabic{FancyVerbLine}}.

Furthermore you can color the dots and make them vertical.

MWE:

\documentclass{scrreprt}
\usepackage{minted}

\renewcommand{\theFancyVerbLine}{\textcolor[rgb]{0.5,0.5,1.0}{\footnotesize\arabic{FancyVerbLine}}}

\begin{document}

\begin{listing}[H]
\begin{minted}[linenos]{py}
import bar from foo

print("Hello %s!" % "World")
\end{minted}
\end{listing}

\begin{listing}[H]
\renewcommand\theFancyVerbLine{%
\ifnum\value{FancyVerbLine}=2
\setcounter{FancyVerbLine}{125}\color[rgb]{0.5,0.5,1.0}\vdots
\else
\textcolor[rgb]{0.5,0.5,1.0}{\footnotesize\arabic{FancyVerbLine}}%
\fi
}
\begin{minted}[linenos]{py}
import bar from foo

print("Goodbye %s!" % "World")
\end{minted}
\end{listing}

\end{document}


Result: