VIM's recording function--useful when repeating actions

Source: Internet
Author: User

Knock the database column code today, change really hard,

vim is found in the back of the command record function, ready, 1 minutes can be done.

must be recorded.


ext: http://blog.163.com/tunzao@126/blog/static/137115484201122601749849

record and playback of VIM commands


If the file has the following contents

Stdio.h

Fcntl.h

Unistd.h

Stdlib.h

Want to change it into

#include "stdio.h"

#include "fcntl.h"

#include "Unistd.h"

#include "Stdlib.h"

Move the cursor to the first line, and then perform the following:

QA begins to record subsequent commands in register a

^ Move the cursor to the beginning of the line

I#include "<Esc> Insert #include before this line"

$ move to end of line

A "<Esc> at end of Line plus" character

J move to the next line

Q Stop Recording

Then press @a to automatically complete the 2,3,4 line change.

Explain:

1. Use the "Q{register}" command to begin, subsequent actions will be recorded in the name of the {register}

Registers. The given register name must be a letter between A and Z

2 Perform the action you want to perform.

3. Press Q to end the record of the command (note that only Q is a character, do not type more

Remaining characters).

Now you can use the "@{recording}" command to perform the record macro just recorded

Out.

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.