Linux operation command Summary 1 (Vim command)

Source: Internet
Author: User
1. Vim operation command 1) Vim automatic directory completion

In the vim editing status (that is, the insert status), press Ctrl + X, and then press Ctrl + F to enter the directory auto-completion mode, which will be based on the directory in the text, show all files in this directory, select by the up and down keys, and press enter to confirm.

2) file comparison

Vimdiff file1 file2

CompareCodeDifference or text difference

Vimdiff has several convenient shortcut keys

<1> file redirection

Fast movement between different points

Skip to next

The right brace contains the letter C, that is, "] C"

Reverse jump

The left half is enclosed in brackets with the letter C, that is, "[C"

You can also add a number at the beginning to skip the number of difference points.

For example, "2 [C" indicates skipping the next difference and jumping to the second difference.

<2> file Merging

DP (diff "put") copies the content of the current file to another file

Do (diff "get") copies the content of another file to the current row.

<3> Redirection between two file windows

Use the shortcut key Ctrl + W

 

3) Vim background execution

In terminal, a file is opened with vim, but you want to view the content of another file but do not want to save it and exit. What should you do?

You can use the background execution function of vim.

 

Use Vim to open the file1 file, press Ctrl + Z to run file1 in the background, use Vim to open the file2 file, and run the job command to viewProgram(The first [N] indicates the number of execution in each background.) To return to the previously opened file1, you only need FG + N. For example, if the number of execution in the file1 background is 1, therefore, you only need to run command FG 1 to switch Vim file1 executed in the background to the foreground for execution.

 

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.