Linux Vim basic commands

Source: Internet
Author: User

Vi filename (File Name) --- enter Command Line Mode
If you enter Esc in the insert mode, the current mode is transferred to the command line mode.
 
Vi command line mode function key:
I --- switch to insert mode. The cursor is at the beginning of the input file.
A --- switch to the insert mode and enter text from the next position where the cursor is currently located
O --- switch to the insert mode and Insert a new row from the beginning of the row
Ctrl + B --- turn the screen back to a page
Ctrl + l --- move the screen one page forward
Ctrl + u --- half page flip
Ctrl + d --- half page flip
0 --- move the cursor to the beginning of the line
G --- move the cursor to the end of the article
NG --- move the cursor to line n
$ --- Move to the end of the row where the cursor is located
N <Enter> --- move the cursor down n rows
/Name --- Search for a string named name after the cursor
? Name --- Search for a string named name before the cursor
X --- delete a character behind the cursor position
X --- delete a character before the cursor position
Dd --- Delete the row where the cursor is located
Ndd --- Delete n rows from the row where the cursor is located
Yy --- copy the row where the cursor is located
Nyy --- copy down n rows starting from the row where the cursor is located
P --- paste the characters in the buffer to the cursor position
U --- restore the previous action
 
Function keys in bottom-line mode of Vi:
: W --- save the edited file to the disk
: Q --- exit Vi (the system will prompt the files that have been modified)
: Q! --- Force exit Vi (do not save modified files)
: Wq --- log out after saving the disk
: W [filename] --- save another file named filename
: Set nu --- display the row number
: Set nonu --- cancel row number display

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.