Http://www.ibm.com/developerworks/cn/linux/l-vimdiff/
Http://hi.baidu.com/_jg_/blog/item/ff62e6d5d9ecf315a08bb77c.html
Http://hi.baidu.com/nkhzj/blog/item/e6b5a7017222100a1d958307.html
★Jump to the next DIFF:
Please use] CCommand
★
Jump to the previous DIFF:
Please use[C
Command
If you add a number before the command, you can skip one or more differences to jump farther. For example, if you enter "2] C" in the row at the first difference
Three differences.
★One of the final purposes of file comparison is to merge to eliminate the differences. If you want to copy the content of the current file from one differential point to another, run the following command:
DP
(Diff "put ")
★To copy the content of another file to the current line, run the following command:
Do (diff
"Get", the reason why DG is not used is that DG has been occupied by another command, so diff "obtain" is used ")
★
If you want to manually modify a row, you can use the usual Vim operation. If you want to jump back and forth between two files, you can use the following command sequence: Ctrl-W, W
★
After modifying one or two files, vimdiff tries to automatically recompare the files to reflect the comparison results in real time. But sometimes it will fail to be processed. In this case, you need to refresh it manually.
: Diffupdate
★
If you want to cancel the modification, you can directly <ESC>, u
★Zo (folding
Open) Open foldCode. The reason why I use the Z letter is that it looks like folding paper :)
★ZC (folding
Close.
★Add:
To switch the positions of Upper/lower windows and left/right windows, you can use ctrl-W, R
Command
The details are as follows:
Http://blog.chinaunix.net/u1/34500/article_129477.html
Vimdiff [Options] file1 file2 [file3]
[Function]
Open two or more files at the same time for comparison.
[Description]
Vimdiff will point out the two files in the same position as much as possible, so as to facilitate query and comparison. The command is basically the same as that of vim.
Vimdiff uses Vim to start two or more files. Each file has its own window. Different parts of each file are highlighted. It is convenient to check the changes and move the changes from one version of the file to another version. First, you must ensure that Vim is installed to use vimdiff. Use this command to install it:
# Apt-Get install vim-full
Other similar tools include tkdiff, meld, and xfdiff4.
[Example]
* Enable main. cpp and main2.cpp at the same time, and split the screen vertically:
$ Vimdiff main. cpp main2.cpp
Or $ vim-D main. cpp main2.cpp
In this way, two files are opened vertically in two columns, and more than two files can be opened.
* Enable main. cpp and main2.cpp at the same time, and split the screen horizontally:
$ Vimdiff-O main. cpp main2.cpp
In this way, two files are opened and displayed in the upper and lower columns.
** After opening the file
You can see that different parts are highlighted, and the same parts are collapsed by default. Common Operations are as follows:
* Jump to the next place:
Enter "] C ".
* Jump to a different place:
Enter "[C ".
* Replace the current window with different values:
Enter "do ".
Here, the premise is to use '] C' or' [C' to jump to the corresponding place. After the execution is completed, the content of the current position of the current window is replaced with the content of the current position of another window. Note that there are two files. The current window cannot be executed if there are more than two files.
* First specify the range of 1-rows, and then replace the current one with different parts of another window:
Enter "1,100 diffg ".
Or enter "1,100 diffget ".
Here, it is equivalent that do does not specify a range. If there is a buffer, you can specify the buffer name after diffg.
* First, specify the range of 1-rows, and then replace the current data with the specified buffer 3 (assuming the file file3:
Enter "1,100 diffg 3 ".
Or enter "1,100 diffget 3 ".
Specify the buffer name after diffg.
* Replace the current window with different parts:
Enter "DP ".
Here, the premise is to use '] C' or' [C' to jump to different places. After the execution is complete, the current position of another window is replaced with the current position of the current window. Note that there are two files. The current window cannot be executed if there are more than two files.
* First specify the range of 1-rows, and then replace the current one with different parts of another window:
Enter "1,100 diffpu ".
Or enter "1,100 diffput ".
Here, it is equivalent to DP but the range is specified. If there is a buffer, you can specify the buffer name after diffpu.
* First, specify the range of 1-rows, and then replace the current data with the specified buffer 3 (assuming the file file3:
Enter "1,100 diffpu 3 ".
Or enter "1,100 diffput 3 ".
Specify the buffer name after diffpu.
* A new horizontal window is opened to load the file for comparison:
Enter ": diffsplit File ".
The newly opened windows are horizontally arranged. The command to move between different windows is the same as that of vim.
* A new vertical window is opened to load the file for comparison:
Enter "vert diffsplit File ".
Vert is short for the vertical prefix. The newly opened windows are vertically arranged, and the command to move between different windows is the same as that of vim.
* Force update of different file statuses:
Enter ": diffupdate ".
Here, when we modify a file, VIM tries to keep it updated with the difference between another file, such as inserting and deleting rows. However, a more complex modification or modification in a row may result in different locations (vimdiff) not being updated in a timely manner. In this case, you can run this command (diffupdate) for forced update.
* Modify the default context behavior in three rows:
Enter ": Set diffopt = context: 3 ".
By default, vimdiff displays the texts of 6 rows in the upper and lower lines for your reference. Other text lines are automatically folded. If you want to modify the default number of contextual lines, you can set it as follows.
* Open the collapsed text:
Enter "zo ".
* Collapsed text:
Enter "ZC ".
* Save all files after modification:
Enter "wqa ".
**
[Others]
In fact, vimdiff is vim, which is just a symbolic link. You can view it in file/etc/alternatives/* | grep bin/vim.