19

I want to use :vimdiff file1 file2 to diff these files in VIM command mode , but I got a error message E492: Not an editor command: vimdiff . do I forget something ? how to resolve it?

According Vim manual, vimdiff command should be available

1
  • perhaps you could link to your documentation. I'm pretty sure you're wrong about the documentation Commented Mar 2, 2012 at 10:37

2 Answers 2

31

I would do:

:tabe file1
:vert diffsplit file2

if you've already widows with other buffers open in the current tab. Otherwise:

:e file1
:vert diffsplit file2

If you have two or three windows open in your current tab and they display the buffers that you want to diff, you might want to turn on diff mode for each window:

:windo diffthis

or, synonym: windo set diff.

Update - with vim-unimpaired you can use cod to change the diff window setting. So use cod on both windows that you want to diff.

Sign up to request clarification or add additional context in comments.

3 Comments

don't forget about the very useful :diffthis
After you are done issuing :diffoff! which will turn off diff mode for all windows in the current tab page.
well, thank you ! And that's to say :vimdiff won't be available in vim mode . I will use :vert diffsplit file2 instead of that.
9

vimdiff is a command-line command, try it like this from inside vim

:!vimdiff file1 file2

The ! tells vim to execute a regular command.

1 Comment

Could also :diffsplit, which does the same thing but inside the already open Vim. The first file needs to be open already, however.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.