Vim three modes and commands for Linux

Source: Internet
Author: User

General Mode : Enter the "vim file name" in the Linux terminal to enter the general mode , but cannot enter the text.
edit Mode : Press I in general mode will enter the editing mode , you can write the program, press ESC to return to the general mode .

command mode : Press in normal mode : Will enter command mode , there will be a colon in the lower left corner, at this point, you can type the command and execute.

Command mode :

I Enter in front of the cursor I Enter at the beginning of the line
A Enter after the cursor A Enter at the end of a row
O Enter at the beginning of the next line in the row where the cursor is O Enters the line at the beginning of the row where the cursor is located
cw Modify a Word Dw Delete a word
Dd Delete a row U Undo Last Action
Ctrl+r Restart last action Gg Cursor quickly back to the bottom of the file
Gg Quick cursor back to file header 4dd Delete 4 lines at the beginning of the line where the cursor is located
P Paste at the next line of the cursor Yy Copy a row
d$ Delete the character after the cursor is the end of the line

Last-line mode :

Q Exit Q! Force exit
W Save Wq Save and exit
wq! Force Save and exit Set Nonu Do not display the number of rows
Set Autoindent Auto Align Set Noautoindent To cancel automatic alignment
1,5s/mail/gmail/g Global substitution (1-5 rows) 1, $s/mail/gmail/g Global substitution

Vim three modes and commands for Linux

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.