Vim program editor

Source: Internet
Author: User
Vim program editor

1. first introduce the VI Editor

VI is divided into three modes: general mode, edit mode, and command line mode.

Open the file and enter the normal mode.

When you press any letter of "I, I, O, O, a, a, R, R, press [ESC ].

In normal mode, enter ":,/,?". You can enter the command line mode.

2. Vim key description

Summary of Common commands:

Move cursor: 0: Move to the front character of this line

$: Move to the end of the line

NG: Row N of the file to be moved.

1G: Move to the first line of the file

Search:/word: Search down for a string named word ,? Word: search up for a string named Word

N: Repeat the previous search action N: Reverse Lookup

Replace: N1, N2s/word1/word2/g to find word1 between line N1 and line N2 and replace it with word2

: N1, N2s/word1/word2/GC searches for word1 between line N1 and line N2, replaces it with word2, and asks whether to replace

Delete: DD: Delete the entire row where the cursor is located.

NDD: delete n rows down the cursor

Copy YY: copy the row where the cursor is located

Nyy: copy the N rows down the cursor

Paste P: paste the copied data to the next row of the cursor P: paste the previous row of the copied data cursor

Other J: Combine the row where the cursor is located with the next row into the same row

U: Restore the previous operation

[CTRL] + R: Repeat the previous operation

      

 

 

 

 

 

 

Save the file of VIM, restore and enable warning information

At present, the main editing software will have the "recovery" function. Even if it causes similar crashes for some reason, you can use a special mechanism to save the previously unsaved data.

When we edit vim, VIM creates a file named. filename. SWP in the directory of the edited file. Therefore, the edited unsaved file content will be saved in this

File.

Vim Block Selection Function

V character selection

Select row v

[CTRL] + V Block Selection

Y copies the anti-whitelist.

D. Delete the whitelist.

 

At the same time, VIM also provides multi-file editing functions. Of course, you can switch between multiple windows in a cool way.

About Vim environment setting parameters

 

Important Review

 

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.