Notes on playing vim-

Source: Internet
Author: User

Notes on playing vim-

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 is not the blank character (so-called blank character is a space, tab, line, enter, etc.) 3 $→ to the end of the line 4/pattern→ search pattern string (if more than one match, you can press the N key to the next)

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 current line 4 u→ undo last Action 5 <c-r>→ return 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 exit 3:x→ ditto 4:q→ No changes, just view the words available 5:q! → Make changes but do not want to save changes, Force quit 6: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 137th rows) 2 gg→ to the first row. (Chenhao Note: equivalent to 1G, or: 1) 3 g→ 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 <start position><command><end 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-

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.