Vim - Delete duplicated lines
Today I learned new thing. If you want to delete duplicated lines, we can use
this function: :sort u
For example:
Duplicated line
Duplicated line
Single line
Duplicated line
Duplicated line
Duplicated line
We can use vap
to change to Visual mode, and use :sort u
to delete
duplicated lines.
Or we can use alternatives:
g/^\(.*\)\n\1$/d
g/\%(^\1\n\)\@<=\(.*\)$/d
g/\v%(^\1\n)@<=(.*)$/d