Reputation: 62548
Is there a way to highlight duplicate lines in Vim, in a file, BUT only if they're adjacent to each other, i.e. if there is a line (in line 1) and there is a duplicate of that line (in line 99), do not highlight that.
But if there is a line in (line n), and there is a duplicate of that line in lines (either, n-1 or n+1) highlight those (or just duplicates).
Is it something regex can accomplish?
(this is waaay off my regex skills)
Upvotes: 2
Views: 1894
Reputation: 28964
Try the following custom match pattern.
:match Conceal /^\(.*\)\n\%(\1\n\)\+/
Use
:match none
to disable previously defined highlighting.
Upvotes: 0