How to compare two files?

There are two files opened in Neovim like file1 and file2 which have similar code but subtle differences.

Just what I want to do is to compare those two files to find out where the deferences are.

In that case, what is the best way that I am able to do?

If in vscode, there are “compare” commands:

Tell me your informations, thanks.

If the two files are in two splits, try :windo diffthis.
Otherwise, try :diffsplit.


Wow, It’s so amazing!!!
I did it in perfect!

Thanks a lot, @zeertzjq :smiling_face_with_three_hearts:

@zeertzjq @kay-adamof how do you turn off the diff after using :windo diffthis?

also ask how to quick close windo diffthis

To turn off diff mode, you can use :windo diffo or :windo diffoff