Vim Normal mode, insert mode, Command mode switch

Source: Internet
Author: User
Tags lowercase
VIM open, cursor Movement, edit mode, normal mode, command mode toggle command

1. Cursor movement in the screen text can use both the keyboard and the left and right arrow keys, you can also use the HJKL letter key.

H (Shift left) J (downlink) K (upstream) L (shift right)

Use the HJKL letter key must ensure that Vim is in normal mode, if it is input mode, the letter key will not be used. Press the ESC key to return to normal mode.

2. To enter the Vim editor, enter in the terminal: VIM (note that the first colon is not the input, the same as the same) or with VIM to open the existing file, enter: Vim file name < carriage return, such as the use of vim to open the hello.py file,

Then enter in the terminal: Vim hello.py < Enter >

3. In normal mode, start inserting text at the cursor position.

Input I enter the necessary text.

Enter lowercase o to open a new line below the cursor and place the cursor at the beginning of the new opening and into insert mode.

Enter an uppercase O to open a new line above the cursor and place the cursor at the beginning of the new opening and into insert mode.

Enter lowercase A To insert text after the cursor position. Enter uppercase A to insert text after the end of the line in which the cursor is located.

Exit edit mode back to normal mode press <ESC>

4. To exit the Vim editor, go back to Normal mode, enter:: (the second colon is keyboard input) back to command mode, enter the following command at this time:

<ESC>: q! < Enter > here the colon is required to enter, this is not saved modified exit mode

Or, enter the following command to save all changes:

<ESC>: Wq < Enter > or: x, where the colon is required



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.