Text editor Vim

Source: Internet
Author: User

1.Vim Introduction

Vim is a powerful full-screen text editor, the largest text editor on the Linux/unix, which is created, edited, and displayed as text files.

Vim has no menu, only commands.

2.

3. Insert command
Command Role
A Insert in the word specifier the cursor
A Insert at the end of the line where the cursor is
I Insert in the word match either the cursor
I Insert at the beginning of the line where the cursor is
O Insert a new line under the cursor
O Insert a new line on the cursor
4. Positioning commands
Command Role
: Set Nu Set line number
: Set Nonu Cancel line number
Gg To the first line
G To the last line
NG to Nth row
: N to Nth row
$ Move to end of line
0 Move to the beginning of the line
5. Delete command
Command Role
X Delete the character at the cursor location
Nx Delete the following n characters of the cursor
Dd Delete Row of cursor, NDD delete n rows
Dg Delete the line of the cursor to the end of the file line
D Delete the cursor at the end of the line
: n1,n2d Delete a specified range of rows
6. Copy and cut commands
Command Role
Yy Copy when moving forward
Nyy Copy the following n rows of the current row
Dd Cut when moving forward
Ndd Cut the following n rows of the current row
P, p Paste at the current cursor row or line
7. Replace and Cancel commands
Command Role
R Replaces the character at which the cursor is located
R To replace a character from where the cursor is, press ESC to end
U Cancel the previous action
8. Save and Exit commands
Command Role
: W Save changes
: w filename Save as specified file
: Wq Save changes and exit
Zz Shortcut keys, save changes and exit
: q! Do not save changes to exit
: wq! Save changes and exit (file owner and root can be used)
9. Tips

1) Import command execution result: r! command

2) Define shortcut key: Map Shortcut Trigger command

Example: Map ^p i#<esc>

Map ^b 0x

3) Continuous line comment: n1,n2s/^/#/g

: n1,n2s/^/#//g

: n1,n2s/^/\/\//g

4) Replace

: AB MyMail 123456@qq.com

Text editor Vim

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.