Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to use vimdiff in VIM command mode?

Tags:

vim

vimdiff

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

like image 930
stackFish Avatar asked Mar 02 '12 08:03

stackFish


2 Answers

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.

like image 128
Benoit Avatar answered Sep 28 '22 21:09

Benoit


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

:!vimdiff file1 file2

The ! tells vim to execute a regular command.

like image 30
darryn.ten Avatar answered Sep 28 '22 21:09

darryn.ten