Vim Learning Record (RPM)

Source: Internet
Author: User

Basic

There are three modes of vim:

    1. Navigation (navigation) mode. At this time, the letter is the next key around.
    2. Input mode. This is when you press the letter key to enter the letter.
    3. Command mode. You need to enter a ":" Colon before you enter. For example, you type: LS, which is equivalent to running a ls command.

Three modes of switching

The default is navigation mode. In other modes, press "ESC" to return to the navigation mode.

In navigation mode, input, and so on, a i o You can enter into the input mode.

In navigation mode, the input : can be entered into the command mode.

So, in the use of vim, we use the ESC will be used very much.

(Incidentally, when using Vim, blind play is the basis, so,, j f , around ctrl , are your eyes in the hands.) Be sure to familiarize yourself with their location. )

Up or down

    • hLeft
    • jUnder
    • kOn
    • lRight

The reason for using these four keys is that everyone's right index finger should be placed on J. J and F are the easiest two keys to touch. So, JHKL is taken for granted to be up and down.

The next word, the last word

    • w: The next word. (word)
    • b: the previous word. (Backword)

So, let's remember, click on the w equivalent of press more l .

One screen down, one screen up.

ctrl + f: Down one screen (f = forward)
ctrl + b: Up one screen (b = backward)

Select multiple lines

shift + v, and then move up and down.


Search

Search some_thing:/some_thing
Continue searching for the next:n
Search the previous one:shift + n

In the current entire file, replace (also called global substitution)

:%s/原来的字符串/新字符串/

(If a string appears multiple times in a row and wants to replace all occurrences of it, add one at the end g , like this: :%s/原来的字符串/新字符串/g )

Partial substitution

    1. shift + vSelect several rows first
    2. :s/原来的/新的字符串


Code completion

    • ctrl + n: Next candidate
    • ctrl + p: Previous candidate

Turn

Shen thought
Links: http://www.imooc.com/article/13269
Source: MU-Class Network
This article original published in Mu class network, reproduced please indicate the source, thank you for your cooperation!

Vim Learning Record (RPM)

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.