Vim Common commands

Source: Internet
Author: User

Reference links---------------------http://www.linuxidc.com/Linux/2015-12/126458.htm

Only normal mode can be toggled with edit mode, command line mode, edit mode and command line mode.

One: General mode

Move cursor

Left h←

Right l→

On k↑

Lower j↓30j: Move down 30 rows

0 or home move to the beginning of the line

$ or end moves to a row bit

N "Enter" cursor moves down n rows

Ctrl+f Move Down one page

Ctrl+b Move up one page

G move to last line of file

GG moves to the first line of the file

Find

/word looking down

? Word looks up

N (repeats the previous find operation) next

N Previous

Replace

: N1,n2s/word1/word2/g looks for word1 string between N1 line and N2 row and replaces it with WORD2

Delete

X backward Remove NX Backward continuously delete n

X forward Delete

DD Delete the line where the cursor is located

NDD Delete the down n rows where the cursor is located

Copy

YY the line where the cursor is copied

Nyy the next n rows where the cursor is copied

Paste

P The copied content is pasted on the next line of the cursor

P paste on one line of the cursor

Restoration

U Restore previous action

Ctrl+r Redo Previous Action

 

Two: Edit mode

Enter insert mode

I insert the first non-empty Gerian inserted at the cursor at the same line

A cursor at the next character at the last character of the line where the cursor is located

o The line next to the cursor is inserted into the new row

O Insert a new row on the previous line

Enter replacement mode

R replaces the character of the cursor once

R until ESC is pressed

Exit edit mode

[ESC]

Three: command-line mode

Save and leave

: W Write Data: w! Force write

: Q Leave VI

: q! Leave not save

: Wq left after saving

Changes to the VIM environment

: Set NU Displays line number

: Set Nonu Cancel line number

  

Vim Common commands

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.