with q
command we could simplify a lot of tedious work in vim.
example 1. generate array sequence (1 to 20).
STEP 1.
press i
to enter insert mode, input 1
1
STEP 2. Record following action: "append the last number to the next line, and increment the number"
esc
to exit input modeqa
to enter record mode, using buffer a
yy
and p
to copy current line and paste it as the next linectrl
+ a
to increment numberq
again to finish record1
2
STEP 3. Replay action 18 times.
type 18@a
to replay action 3 and action 4 in step 2.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20