Use vim to compare files

Source: Internet
Author: User
Use vim compare file 1 open two files in vim compare mode: vim-dfile1file2 or vimdifffile1file22 if the file file1 has been opened and then open another file file2 for comparison: vertdiffsplitfile2 if vert command is not used, d. use vim to compare files 1. 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 command: diffthis4. if the content of a window is changed, and vim does not automatically update the diff check, run the following command to update: diffupdate5. 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 content of the current document 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) 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 lines in the context to three, you can set: set diffopt = context: 3. you can use the simple collapse command to temporarily expand the same collapsed text lines: zo (folding open, z The letter looks more like folding paper) then you can use the following command to fold again: zc (folding close)

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.