Vim 01 Recorder
Chose Your Dotfile to start the vim
1 |
|
Recorder of Vim
This Chapter mainly introduces the Recorder in vim,Which is used to do some repeated operations.This function is also called a macro.
for more information try :help recording
Registers(related with recording)
This section will introduce related concept/function of recording function. Which help us to understand how this works, and what we should pay attention to it.
register of vim: register is a superset of macro, it contains more function. In this part we should know, register can store some string or operations to help subsequent use.
Status:
Using :registers
or :reg
to check those we have registered, or add the registers’s name behind to show those u’re interested in.
1 |
|
Lifecycle
The information in registers will not disappear with the window closed. But maybe with the system-level’s open-close. we should test this!!! So we can store some snippet,pwd,etc.
Pick
There are many registers like 0~9
,a~z
,unnamed,etc. 0~9
are the default registers for many operations like del,copy,command,etc.
So for recording, we better using a~z
. And It should be noted that the upper version A~Z
means add operations to an existing command.’a~z’ is to overwrite it.
Modified
Besides the A~Z
works like append
in python. There are several way to modify the registers;
Like:
1 |
|
TODO: we should write a indipendent chapter for the registers in vim.
Usage
This section shows the Usage of Recording. And we will continue to collect some good examples. Then put it below.
- Change to Normal mode and pressed “q”
- Chose reg u want (
a~z
normally) to start record a macro - { operations u want to be recorde }
- ->in non-insert mode<- pressed “q” to end recording
- Using “@+reg” to repeat this operations/macro
10@+reg
to repeat this macro 10times
Example1 setting the pwd/useid of server.
Example2 fill up some sheet infomation.
References
recording
- official doc :
:help recording
- registers in vim
- registers in vim2
- how to use recording in vim
Vim 01 Recorder