Vim Recall繁體中文

Remove adjacent duplicate lines

:uniq

Example

Normal 0 / 2
one
one
two
two
three
Cursor on line 1, column 1

Remove adjacent duplicate lines.

Before & after
Before
one
one
two
two
three
Cursor on line 1, column 1
After
one
two
three
Cursor on line 1, column 1

Start in Normal mode.

Details & Vim help

Example replayed in Vim

Run :uniq to remove adjacent duplicate lines in the range. Sort first if duplicate lines are scattered.