Use of diff in vim

Source: Internet
Author: User
Tags diff

1. Start diff

There are many ways to turn on diff in Vim, and here are a few common scenarios.

1.1 External directly open two files

# Direct use of Vimdiff instructions
Vimdiff file_1 file_2
-D file_1 file_2

1.2 File comparison after opening a file

-on File_1 file_2:diffthis # to enter in two windows

2. Change the file location

You can change the display location of the comparison file according to your personal habits and file format.

Ctrl-w K # Move the current window to the top ctrl-w H # Move the current window to the leftmost ctrl-w J # Move the current window to the bottom ctrl-w L # Move the current window to the far right

3. Locking and unlocking

When comparing files, the default is to lock the scroll bar of two files.

: Set Noscrollbind # Unlocked: Set Scrollbind # Locked (will be re-aligned)

4. Move the cursor

You need to move the cursor position when you modify the file, you can move it under vim, but there is a shortcut key that jumps to the difference row.

Use of diff in vim

Related Article

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.