vim recording and execution macro 2019-06-16 12:27
Using macros to perform repetitive operations is a very efficient way. In this page I will show you how to use it.
Recently I am translating some English articles into Chinese. I need to enter two Chinese spaces at the beginning before I translate a paragraph. I plan to use macros to do this boring thing.
recording
- press qain normal mode. "recording" will show in the bottom. This means you are recording macro and save it in "a" register
- press oto move cursor to next line.
- press Ctrl+v and uto prepare input unicode character.
- the number of chinese space is 3000in unicode. then press 3000.
- press escto return normal mode, pressqto save current macro
execution
After recording the macro successfully you can use @<your_macro_name> in my case is @a to execute the macro.
EOF