Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: Vimdiff Utility  (Read 2584 times)

0 Members and 1 Guest are viewing this topic.

Vinil

  • Guest
Vimdiff Utility
« on: November 22, 2013, 09:17:17 pm »
Vimdiff is a tool that comes bundled with Vim and its a wonderful tool for comparing code and merging changes. Vimdiff starts Vim on two (or three) files. Each file gets its own window. The differences between the files are highlighted. This is a nice way to inspect changes and to move changes from one version to another version of the same file.

vimdiff syntax:-

Quote
vimdiff [options] file1 file2


If you want to open files use the following command

Code: [Select]
vimdiff file1 file2

or

vim -d file1 file2


If you want to open vertical splits for your files use the following command

Quote
vimdiff -O file1 file2

If you want to open horizontal splits for your files use the following command

Quote
vimdiff -o file1 file2


If you want to open files in particular directory, use the following command. Vim first append the file name of the first argument to the directory name to find the file.


vimdiff file1 file2 [file3 [file4]]



Remote editing using vim

Quote
$ vimdiff scp://example.com//path/to/remote/file /path/to/local/file
« Last Edit: November 22, 2013, 09:20:07 pm by Vinil »