Common commands of vi-general Linux technology-Linux technology and application information. For details, refer to the following section. Insert:
I insert from the current position of the cursor
A is inserted starting from the next character at the current position of the cursor.
O insert an empty row in the downlink of the cursor and then insert it.
O insert an empty row in the previous line at the cursor position before inserting
I insert the body from the beginning of the row where the cursor is located
A. Insert the body from the end of the row where the cursor is located.
Save and exit the file:
: W save the file
: W! Force save file
: Q exit
: Q! Force exit
: X =: wq
File writing and opening:
: W filename: Save the file as the given file name
: W! Filename forcibly saves the file as the given file name
: F filename: Rename the current file to filename
: R filename insert file content to the position specified by the cursor
: E filename edit new file (open another file for editing)
Copy and paste:
[N] x deletes n consecutive characters starting from the cursor
[N] dd deletes n rows developed from the cursor
[N] yy: Copy n rows starting from the cursor
P Paste
Cursor jump:
H, j, k, l left, bottom, top, right
H, M, L the top of the screen, the center of the screen, the bottom of the screen
[N] G jump to line n
: N jump to line n (same as [n] G)
W move the cursor to the right
B. Move a word to the left.
In edit mode, press v to enter the visible state for Content Selection
[N] shift +> move a tab to the right of the selected content
[N] shift + <Move the selected content to the left
Search replacement:
/String to search for strings, used with n (next)
: S/str1/str2 replace str1 with str2
: S/str1/str2/g replace all strings in str1 with str2
: G/str1/s // str2/g replace all strings str1 In the full text with str2
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