 <p>As an ex one-liner:</p> <pre><code>:syn clear Repeat | g/^\(.*\)\n\ze\%(.*\n\)*\1$/exe 'syn match Repeat "^' . escape(getline('.'), '".\^$*[]') . '$"' | nohlsearch </code></pre> <p>This uses the <code>Repeat</code> group to highlight the repeated lines.</p> <p>Breaking it down:</p> <ul> <li><code>syn clear Repeat</code> :: remove any previously found repeats</li> <li><code>g/^\(.*\)\n\ze\%(.*\n\)*\1$/</code> :: for any line that is repeated later in the file <ul> <li>the regex <ul> <li><code>^\(.*\)\n</code> :: a full line</li> <li><code>\ze</code> :: end of match - verify the rest of the pattern, but don't consume the matched text (positive lookahead)</li> <li><code>\%(.*\n\)*</code> :: any number of full lines</li> <li><code>\1$</code> :: a full line repeat of the matched full line</li> </ul></li> <li><code>exe 'syn match Repeat "^' . escape(getline('.'), '".\^$*[]') . '$"'</code> :: add full lines that match this to the <code>Repeat</code> syntax group <ul> <li><code>exe</code> :: execute the given string as an ex command</li> <li><code>getline('.')</code> :: the contents of the current line matched by <code>g//</code></li> <li><code>escape(..., '".\^$*[]')</code> :: escape the given characters with backslashes to make a legit regex</li> <li><code>syn match Repeat "^...$"</code> :: add the given string to the <code>Repeat</code> syntax group </li> </ul></li> </ul></li> <li><code>nohlsearch</code> :: remove highlighting from the search done for <code>g//</code></li> </ul> <p>Justin's non-regex method is probably faster:</p> <pre><code>function! HighlightRepeats() range let lineCounts = {} let lineNum = a:firstline while lineNum &lt;= a:lastline let lineText = getline(lineNum) if lineText != "" let lineCounts[lineText] = (has_key(lineCounts, lineText) ? lineCounts[lineText] : 0) + 1 endif let lineNum = lineNum + 1 endwhile exe 'syn clear Repeat' for lineText in keys(lineCounts) if lineCounts[lineText] &gt;= 2 exe 'syn match Repeat "^' . escape(lineText, '".\^$*[]') . '$"' endif endfor endfunction command! -range=% HighlightRepeats &lt;line1&gt;,&lt;line2&gt;call HighlightRepeats() </code></pre>