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 macro
  • 5aa<esc> - insert 5 a's
  • a<cr><esc> - insert line break
  • q4@q - stop recording, repeat 4 more times

Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -