Vim basic commands (reproduced from the network)

Source: Internet
Author: User

From the Unix Beginner's Tutorial (fourth edition).

Command mode switch to text input mode:

Key

Function

I

Enter text to the left of the cursor

I

Enter text at the beginning of the current line

A

Enter text to the right of the cursor

A

Enter text at the end of the line at the current line

O

Adds a blank line to the next line in the current row, with the cursor at the beginning of the new line

O

Adds a blank line to the top row of the current row, with the cursor at the beginning of the new line

Regardless of which shortcut key is used to enter this mode, in insert mode, it is inserted before the cursor.

Text modifier keys, only available in command mode

Key

Function

X

Deletes the specified character at the cursor position

Dd

Delete the line where the cursor is located

U

Undo Recent Changes

R

Replaces one character at the cursor position

R

Replaces characters starting at the cursor position, while changing vim to text input mode

.

Repeat the last modification

The cursor moves the key, and the command mode controls the cursor movement.

Key

Function

h or [←]

Move the cursor to the left one

J or [↓]

Move the cursor down one line

K or [↑]

Move the cursor up one line

I or [→]

Move the cursor to the right one

NG

Transfer to Nth row

G

Skip to Tail line

Dg

Delete all

The Exit command, in addition to the ZZ command, starts with ":" and ends the command line with [Enter].

Key

Function

Wq

Save the file, exit the editor

W

Save the file, but do not exit the editor

Q

Exit editor

Q!

Do not save the file, exit the editor

Zz

Save the file, exit the editor

Search command

Key

Function

/

Search forward to the specified string, and then press N to search for the next

?

Search backwards for the specified string, search to press N to find the next

Vim basic commands (reproduced from the network)

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.