How do I remove duplicate lines from a buffer?

You can use the following user-defined command to remove all the duplicate lines from a buffer: :command -range=% Uniq <line1>,<line2>g/^\%<<line2>l\(.*\)\n\1$/d Add the above command to your .vimrc file and invoke “:Uniq” to remove all the duplicate lines.

Comments (1)


Pepsh Pepshinsky

Let’s see you to :help viminfo-file-name (option -i) :set viminfofile=NONE


Speak Your Mind