- Vim - Conclusion
- Vim - Personalization
- Vim - Tips & Tricks
- Vim - Remote File Editing
- Vim - Using Vim as IDE
- Vim - Plug-ins
- Vim - Diff
- Vim - Folding
- Vim - Registers
- Vim - Macros
- Vim - Markers
- Vim - Working With Multiple Things
- Vim - Searching
- Vim - Revisiting Editing
- Vim - Navigating
- Vim - Editing
- Vim - Getting help
- Vim - Getting familiar
- Vim - It’s friends
- Vim - Installation & Configuration
- Vim - Introduction
- Vim - Home
Vim Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Vim - Macros
Macro is record and play feature. When this is combined with Vim commands it becomes really powerful combination. In this section, we will discuss following items −
Start recording
Perform Vim actions
Stop recording
Play recording
Start recording
To start recording press q followed by any lower case letter as a macro name. For instance in below example I have used “a” as a macro name
Perform Vim actions
In this step you can perform any Vim actions pke: cut, copy, delete, replace and so on.You can see these actions by executing following command −
:registers
For instance, below command shows that yank and delete actions were performed −
Stop recording
Once you are done with actions, press q again to stop recording. Now recording mode will disappear as shown below −
Play
To play execute below command −
@{macro-name}
For instance to execute macro “a”, execute below command −
@a
To play same macro multiple times use numbers with it. For instance, to execute same macro 10 times execute following command −
10@aAdvertisements