A concise tutorial on vim

Source: Internet
Author: User

Create a new file in the shell

# Vim A.txt

VIM has three modes: General mode, insert mode, bottom line mode

Three modes of operation


1. Command mode


Move cursor
Hjkl
YY copy
NYY copy n rows from cursor down

0 move the cursor to the beginning of the line
$ move cursor to end of line

Move the cursor quickly
GG to the beginning of the file column
NG moves to nth row
G to end of file header column

P Paste
NP pastes the current line down n times

DD Delete/Cut cursor in the row
NDD Remove/Cut n rows from current

W cursor moves to the first character of the next word
e cursor moves to the last character of the next word
The B cursor moves to the first word in the previous

CTRL + F Turn one screen forward
CTRL + B turn back one screen

R replaces Cursor current character
R continuous replacement cursor, ESC end
U undo
Ctrl + R Recovery

Enter insert mode
I insert before the cursor
I Line Header Insertion
o Create a new row on the next line
O Create a new row on the previous line
A after the cursor is appended
A append at the end of a row
s deletes the character of the cursor and inserts
S deletes the current line and inserts


/search for string n down one, n up one
? Search for string n down one, n up one


2. Insert mode (edit)

Write the content, Note: All character commands in the general mode are invalidated.

3. Bottom-line mode


: Set Nu[mber] Displays line numbers
: Set Nonu[mber] does not display line numbers
: W Save
: Q exit
: Wq Save exit ZZ Shortcut key
: q! Force exit
: N Moves the cursor to the nth row

A concise tutorial on 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.