Vim and vim

Source: Internet
Author: User

Vim and vim
Vim-common sorting: 1.1 move the cursor

0 or home: Move to the beginning of the line (first line)

$ Or end: Move to the last character (end of line) of this line)

G: Move to the last row of the file.

NG: Row n of the object to be moved.

Gg: Move to the first line of the file, equivalent to 1G

N [Enter]: move the cursor down N rows

1.2 search and replace

/Word: Search down for a string named Word

? Word: search for a string named word

N: repeat the previous query action.

N: Repeat the previous action in the reverse direction.

: N1, n2/word1/word2/g: replace word1 between n1 and n2 with word2

: 1, $ s/word1/word2/g replace all word1 with word2

: % S/word1/word2/g replace all word1 with word2 (commonly used)

: S/word1/word2/g: replace word1 of the current row with word2

1.3 Delete, copy, and paste

Dd: Delete the entire row where the cursor is located.

Ndd: Delete the rows to which the cursor is located

Yy: copy the row where the cursor is located

Nyy: copy the n rows down the cursor

P: paste the copied content from the downstream.

U: reply to the previous operation (rollback)

1.4 Block Selection

V: select a character. The cursor is reversed (used to modify configuration files in batches)

For example, the configuration file copied from other places has an unordered indentation, for example:

First, enter the normal mode. Press "v selected code. The selected area will be reversed.

Then press "=", the format will be automatic

V: Select rows. The rows that the cursor passes are reversed.

[Crtl] + v: block selection. You can select a rectangle.

Y: copy the reverse IP address.

D: Delete the whitelist.

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.