Use of the Vi/vim editor

Source: Internet
Author: User

Operation in command mode
Replacement characters:
%s/str1/str2/g
Delete all content:
%d
Do not save exit:
Q!
Save exit:
wq!

Execute shell command:
!command such as!ls-l

Insert the shell command execution result on the next line:
R!command such as R!date

Specify the line to be inserted after the shell operation:
69,72!command
69!command the 69th Line as command input
.! command to enter the line where the cursor is located

Specifies that the line is edited with the shell but not inserted:
69,72 W!command
W!command 69 lines as command input
. W!command the line where the cursor is in the input


H//Left move
J//Down Move (bottom)
K//Move up (top)
L//Move Right

CTRL + F//Move down one page
CTRL + B//Move up one page

0//move to Wardrobe
$//move to end of line
w//Jump backwards a word

G//Move to last line of file (common)
NG//Move to the first few lines of the file
GG//Move to the first line of this file.

:%s/word1/word2/g//indicates word1 all replaced with Word2
/word//Find woed characters.
Down (N)
Up (N)

X//Delete one character at cursor
DW//Delete the word
DD//delete cursor in the row
NDD//Delete the row below the line n
D1G//Delete all data from the row of the cursor to the first row.
DG//Delete all data from the line to the last row of the cursor.
YW//Copy the word
yy//Copy all data from the line where the cursor is located
nyy//the next n rows where the cursor is copied, n is the number
Y1G//Copy the cursor line to the first row of all data.
YG//Copy the cursor line to the last row of all data.
P//Paste the copied data to the following line
P//Paste the copied data to the top
J//combines the row of the cursor with the next line into a row.

U//Restore Last Action

Use of the Vi/vim editor

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.