Use Vim to compare the content of the two files

Source: Internet
Author: User
Use Vim to compare the content of the two files. open two files in vim compare mode: vim-dfile1file2 or vimdifffile1file22. if the file file1 has been opened, open another file file2 for comparison: vertdiffsplitfile2 if not used... use Vim to compare the content of the two files. use vim's comparison mode to open two files: vim-d file1 file2 or vimdiff file1 file2. if the file file1 has been opened, open another file file2 for comparison: vert diffsplit file2 if the vert command is not used, diffsplit will be divided into two windows. 3. if you have opened two files, file1 and file2, in split mode, and want to compare the differences between the two files. Enter the following command in two windows: diffthis 4. if the content of a window is changed and vim does not automatically update the diff check, run the following command to update: diffupdate 5. locate the difference: [c jump to the previous difference] c jump to the next difference 6. jump between Windows: ctrl-w jump to the next window ctrl-w h jump to the left window ctrl-w l jump to the right window ctrl-w j jump to the bottom window ctrl-w k jump to the top of the window 7. merge document: dp applies the current document content of the difference point to another document (diff put) do to copy the content of another document of the difference point to the current document (diff get) personal note: space is not allowed: diffput, diffget. 8. when you expand and view the context and compare and merge files, you often need to combine the context to determine the final action to take. By default, Vimdiff displays the texts of 6 rows in the upper and lower directions for your reference. Other text lines are automatically folded. If you want to change the default number of rows in the context to three, you can set: set diffopt = context: 3 9. the simple folding command can be used to temporarily expand the same collapsed text line: zo (the lower-case letter 'L' can also be opened) (folding open, the letter z looks like a folding paper) and then you can use the following command to fold again: zc (folding close) zf create fold (use a number to show the number of rows from the current row to the bottom, for example, 3 J creates a fold that includes four rows) zm close all folding zr open all folding zE delete all folding zd delete current folding za if it is currently on close, if the current feature is disabled, zk is opened from zj to the start of the next fold to the end of the previous fold.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.