Linux VIM common commands

Source: Internet
Author: User

One, Mode
There are 3 modes of the VI Editor:Command modeInput Modelast-line mode。 It is important to master these three models:

Command mode: VI starts after the default entry is the command mode, from this mode use the command can switch to the other two modes, while in any mode just click [ESC] Key to return to command mode.

Input mode: Enter subtitles in command mode"I"You can edit the file into the input mode of VI. In this mode we can edit, modify, input and other editing work, in the last line of the editor to display a "--insert--" Mark VI entered the input mode. We need to save the file when we have finished modifying the input, then we need to return to the command mode and save it in the last line mode.

Last-line mode: Input in command mode":"To enter this mode, there are many useful commands in the last line mode.

Two, copy
A, copy the entire row
Command mode, the cursor is in the current row to be copied, enteryy
b, copy a word
Command mode, the cursor is in the first letter of the current word to be copied, enteryw

Three, paste
Command mode, enterP

Four, delete
A, delete the entire row
Command mode, the cursor is in the row you want to delete, enterDD

B, delete a word
Command mode, the cursor is in the first letter of the word to be deleted, enterDW

Five, Undo
Command mode, enteru

Six, Jump
Command mode,Enter the number of rows to jump, and then enter GG
such as: To jump to the 150th line of the current file, enter150gg

Linux VIM common commands

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.