Linux Vim basic Operation method _linux

Source: Internet
Author: User
Tags save file

I've recently been using Ubuntu11.04 to learn Unix before, but Ubuntu11.04 X window does not perform well under VMware7.1.4. It doesn't matter, first put the basis of the command line to say.
Ubuntu VI is also not good to use, a vim used to learn, a simple record of its basic operations, spare, to provide you with a book "Unix Practical Course (5th Edition)"
Command mode switch to text input mode:

Key

Function

I

Enter text at the left of the cursor

I

Enter text at the beginning of the current line

A

Enter text on the right side of the cursor

A

Enter text at the end of the current line

O

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

O

Adds a blank row to the top line of the current line, 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 key, only available in command mode

Key

Function

X

Deletes the character specified by the cursor position

Dd

Delete the line where the cursor is located

U

Undo the most recent changes

U

Undo all changes made to the current line

R

Replace one character at the cursor position

R

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

.

Repeat the last modification

The cursor moves the key, 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

$

Moves the cursor to the end of the line at the current line

W

Move the cursor to the right one word to the beginning of the next word

B

Move the cursor one word to the left, to the beginning of the previous word

E

Move the cursor to the end of the word

0

Moves the cursor to the beginning of the current line

[Enter]

Move the cursor to the beginning of the next line

[Space]

Move the cursor to the right one

[Backspace]

Move the cursor to the left one

Exits the command, ending the command line with [Enter], in addition to the ZZ command, starting with ":".

Key

Function

Wq

Save file, Exit editor

W

Save the file without exiting the editor

Q

Exit editor

Q!

Do not save file, Exit editor

Zz

Save file, Exit editor

Search command

Key

Function

/

Searches forward for the specified string, searches for the next, and then presses n

?

Searches backwards for the specified string, searches for the next, and then presses n

A detailed explanation of the commands can be used in vim: Help [command] to query online assistance.

The above command is used in the original teaching materials in VI, has been in the vim 7.3.35 all the tests available.

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.