Notes on playing vim-(II.)

Source: Internet
Author: User

Notes on playing vim-(II.)

  It's been more than a week since the last blog post, and I've been working on the origins of the editor's Vim, installing and introducing two modes and some simple operations. The use of VIM will continue to be introduced in this session.

Presenting illegal weapons

First of all, move it:

1 0→ Digit Zero, to the wardrobe 2 ^→ to the first position of the bank that is not the blank character (the so-called blank character is a space, tab, line break, carriage return, etc.) 3 $→ to the end of our line 4 /pattern→ search for pattern strings (press N to next if more than one match is found)

The following are some general editing commands that you will be able to perform basic operations such as copy-and-paste, cancel, etc.:

1 yy→ Copy Current line 2 p→ Paste 3 dd→ Delete the current row 4 u→ undo Last Action 5 < C-r > → return to undo previous step (undo more available)

What do you do when you want to do something about the file after you've finished editing it? Don't worry, look down:

1 : w→ Save (but I usually use the following command)2 : wq→ Save and exit3 : x→ Ibid .4 : q→ does not make any changes, just check the words available5 : q!→ changes but does not want to save changes, forced to quit6: SaveAs<Path/to/file>→ Save As<Path/to/file>7: E<Path/to/file>→ Do not exit the current file open another file (PS: The TAB key can be used to complete the path, if the current file has changed, available: e!<Path/to/file>→ Open a file)

After you have mastered the above instructions, you have already practiced the presenting illegal weapons. If you want to reach the pinnacle, then please look down.

Peak

Come here, explain your curiosity or some, and still have a bit of self-motivated, good, first we learn how to do a faster cursor movement, how, feel the cursor movement is very boring, very simple? If you don't want to spend most of your time on the cursor, then I suggest you keep looking down:

1 ng→ to Nth line (Chenhao Note: Note that the G in the command is uppercase, and I generally use: N to nth rows, such as: 137 to line 137th) 2 gg→ to the first line. (Chenhao Note: equivalent to 1G, or: 1)3g→ to the last row.  4 move by word:5    w→ to the beginning of the next word.  6     e→ to the end of the next word.

So it's gone? Of course not, maybe you know /pattern→ search for pattern strings (if you search for multiple matches, you can press N to next), but there's a directive that doesn't bother you. Oh, look at the following:

1 * and #:  matches the current word of the cursor, moves the cursor to the next (or previous) match word (* is next, #是上一个)

So let's talk about how to repeat an instruction:

1 . → (decimal point) You can repeat the last command 2 N<command> → repeat a command n times

how, have not felt the powerful vim, in fact, far more than these, in fact, the various instructions of VIM can be combined oh, that is, the following:

1 <  position><command>< position  >

give some chestnuts:

DG: Deletes the line of the cursor until the end of the text.

Ye: Copy from the current position until the last character of the word.

Well, today is the end of the content, please look forward to the next content.

PS: This blog Welcome to forward, but please specify the blog address and author, because I level limited, if there is wrong, welcome point, Thank you ~

Blog Address: http://www.cnblogs.com/voidy/

Blog: http://voidy.net

<. ))) ≦

Notes on playing vim-(II.)

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.