Vim Editor General operations

Source: Internet
Author: User

Watch video tutorial: Brother even Linux cloud computing Video tutorial 5.1 text editor Vim-5.2

Insert command

A: Insert the word specifier in the cursor position;

A: Insert at the end of the line where the cursor is located;

I: Insert the word match either in the cursor position;

I: Inserted at the beginning of the word lines the cursor;

o: Insert a new line under the cursor;

O: Insert a new line on the cursor;

: Set nu sets the line number;

: Set Nonu cancel line number;

to the specified line

GG: to the first line;

G: to the last line;

NG: to Nth row;

: N to Nth Row;

$: Move to the end of the line;
0: Move to the beginning of the line;

Delete command

X: Delete the character at which the cursor is located;

NX: Delete the n characters after the cursor is located;

DD: Delete the line where the cursor is located;

NDD: delete n rows;

DG: Delete the line at the cursor to the end of the file;

D: Delete the cursor at the end of the line;

: n1,n2d deletes the specified range of rows;

Copy paste Cut

YY: Copy the current line;

Nyy: Copies the following n rows of the current row;

DD: cuts the current line;

NDD: Cuts the current row following n rows;

P,p: Pasted on the line or line of the current cursor;

R: replaces the character at which the cursor is located;

R: The replacement character starts at the cursor location;

U: Cancel the previous operation;

Search and Replace commands

/string: Searching for a specified string; Ignoring case when searching: Set IC

N: Searches for the next occurrence of the specified string;

:%s/old/new/g: Full text replaces the specified string;

: n1,n2s/old/new/g: Replaces the specified string within a certain range, and the subsequent G change to C makes a replacement query confirmation.

Save and Exit commands

: W Save

: W new_fliename Save as specified file

: Wq Save changes and launch

ZZ shortcut key Save changes and exit

: q! Do not save changes launched

: wq! Save Modification Exit (file owner and Root available)

Vim Editor General operations

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.