As an ex one-liner: :syn clear Repeat | g/^\(.*\)\n\ze\%(.*\n\)*\1$/exe 'syn match Repeat "^' . escape(getline('.'), '".\^$*[]') . '$"' | nohlsearch This uses the Repeat group to highlight the repeated lines. Breaking it down: syn clear Repeat :: remove any previously found repeats g/^\(.*\)\n\ze\%(.*\n\)*\1$/ :: for any line that is repeated later in the file the regex ^\(.*\)\n :: a full line \z