Linux under VI Copy, Paste, delete, Undo, jump and other commands

Source: Internet
Author: User

PrefaceIn embedded Linux development, the need to modify the configuration file, and so on, must use VI, so familiar with the VI of some basic operations, to help improve work efficiency.

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, enter yy
b, copy a word
Command mode, the cursor is in the first letter of the current word to be copied, enter yw

Three, paste
Command mode, enter P

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

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

Five, Undo
Command mode, enter u

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, enter 150gg

Linux under VI Copy, Paste, delete, Undo, jump and other commands

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.