Vim often forgets commands

Source: Internet
Author: User

1. Copy the specified line to the next line of the current cursor.

#假设当前光标在10行, want to copy line 5th to line 11th: 5copy. #copy命令有2种简写 ' Co ' and 't', so you can also write the following format: 5co.:5t.

Reference: http://liuzhijun.iteye.com/category/270228

2. Enter the same word multiple times

#例如: Enter 10 times "look" 1 after moving to the desired place 2 Press ESE to ensure that you are in edit mode 3 ) Enter the required number of times 4 Press I to enter the desired word 5 According to ese# principle is: Enter the number of times in normal mode, and then enter the insertion mode, input text, in the ECS into the normal mode, complete. 

3, want to copy all the lines containing a keyword to another file, how to do it?

For example:
<1>this is Abook;
<2>this is Adog;
<3>this is aenglish book;

Copy all lines containing the book.

  method:   "  Clear Register A : let @a= "   Append all lines which matchs book to register A : G/book/y a
      "  Open a new buffer : new  "   Paste content of register A Into the new buffer  :p ut a explanation:: Let @a  =  Use the Let command to empty the contents of register a: G /book/y A Add all the rows containing the book to register A. Note: Here is a instead of a,a means that the line that meets the requirements is appended to register a, while a means that the line that meets the requirements overrides the contents of the register, and if A is used, it causes the last register to have only the last line that meets the requirement. At this point, all the rows containing the book are in register a. :p ut A to paste the contents of register a can also be directly written to the file:: G /book/. W >> filename 

4. What if I make multiple lines of comments and uncomment them?

notes: 1) Ctrl +v Enter column edit mode 2) move the cursor down or up, mark the beginning of the line that needs comment 3) and then press the uppercase I4 and then insert an annotation, such as "#"5) and press ESC again, and all comments are commented out:1) Ctrl +v Enter column edit mode, 2) move the cursor down or up, select the Notes section, 3) and then press D to delete the comment symbol (#).

Vim often forgets commands

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.