How to compare two unsaved pieces of texts in Vim?

What I want to do is: (1) Copy a piece of code and paste into a buffer in Vim; (2) Copy another piece of code and paste into another buffer in Vim; (3) Compare these two buffers directly without saving them into files.

I know this can be done easily with Notepad++. I need to do this quite often, and I want to know if Vim can do this. Thanks!

Upvotes: 3

Views: 592

Answers (1)

romainl
romainl

Reputation: 196781

You can do :diffthis on each window you want to compare.

See :help diff.

Upvotes: 4

Related Questions