Writing text blocks using nested iteration in Vim -
let's i'd write 5x5 text block, such as
aaaaa aaaaa aaaaa aaaaa aaaaa
and want using nested iteration. in pseudocode like
do 5 times ((do 5 times (type 'a')) change line)
so first guess convert as
5 ((5 (i esc)) enter)
but can't that, because vim doesn't support use of parentheses specifying execution order. , typing
5 5 esc enter
will of course not work, since produce single line 55 'a's , newline.
so question is: there way write text blocks using nested iteration in vim? know there other ways write text blocks, want know if possible, out of curiosity.
you cannot directly, need use register, expression, or macro:
qq5aa<esc>a<cr><esc>q4@q
qq
- record macro5aa<esc>
- insert 5a
'sa<cr><esc>
- insert line breakq4@q
- stop recording, repeat 4 more times
Comments
Post a Comment