Diffs

You can use the editor to see a diff between two or more files. For example, to compare foo1.txt with foo2.txt start Vem in your terminal with:

vem -d foo1.txt foo2.txt

The files will be shown side-by-side as in the example:

/static/img/screenshots/diff.png

The diff highlighting in the example is pretty straightforward:

  • The green section means that the code is present in one file but not in the other.

  • The blue section means that the code is present in both files but with modifications.

  • Folds are used to hide large sections of common code so you have a better overview of the differences between the files. You can toggle a fold open and close with b a (for more info about folds, check the Folds section).

The diff will be updated automatically as you change the files: the editor will detect the changes and update the view accordingly. However, you can also force the diff to be updated manually:

:diffupdate

This may be useful if the diff gets out of sync because of a complex operation.

You can also start a diff between two or more windows of a tabpage, by executing:

:diffthis

in each window you want to diff. If you want to start a diff between all the windows of a tabpage you can do:

:windo diffthis

and window will take care of executing diffthis in every window.

To stop the diff, execute:

:windo diffoff