Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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!

share|improve this question

1 Answer 1

With the code pasted into your buffers, go to each buffer and execute

:diffthis

If those two are the only buffers in your vim session, you can execute this one command instead:

:windo diffthis
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.