如果您不想对行进行排序:
:g/^\(.*\)$\n\1/d
Run Code Online (Sandbox Code Playgroud)
解释:
:g/^\(.*\)$\n\1/d
g/ /d # Delete the lines matching the regexp
^\(.*\)$ # Match a whole line and put it in substitution register 1
\n\1 # Match substitution register 1 preceded by new line
Run Code Online (Sandbox Code Playgroud)