Real Vim ninjas count every keystroke - do you?

Pick a challenge, fire up Vim, and show us what you got.

Changelog, Rules & FAQ, updates: @vimgolf, RSS.

Your VimGolf key: please sign in

$ gem install vimgolf
$ vimgolf setup
$ vimgolf put 510b1c61e48b7e0002000028

Chinese Multiplication Table

Print a Chinese multiplication table in Vim. In China, every kid is asked to memorize this table. And thanks to the mono-syllabism of Chinese characters, it is not that hard. Printing the multiplication table is also a good exercise for programming beginners. For-loop, escaped characters, etc... There should be some special ways to print it in Vim.

Start file
1*1=1
End file
1*1=1
1*2=2 2*2=4
1*3=3 2*3=6  3*3=9
1*4=4 2*4=8  3*4=12 4*4=16
1*5=5 2*5=10 3*5=15 4*5=20 5*5=25
1*6=6 2*6=12 3*6=18 4*6=24 5*6=30 6*6=36
1*7=7 2*7=14 3*7=21 4*7=28 5*7=35 6*7=42 7*7=49
1*8=8 2*8=16 3*8=24 4*8=32 5*8=40 6*8=48 7*8=56 8*8=64
1*9=9 2*9=18 3*9=27 4*9=36 5*9=45 6*9=54 7*9=63 8*9=72 9*9=81

View Diff

1a2,9
> 1*2=2 2*2=4
> 1*3=3 2*3=6  3*3=9
> 1*4=4 2*4=8  3*4=12 4*4=16
> 1*5=5 2*5=10 3*5=15 4*5=20 5*5=25
> 1*6=6 2*6=12 3*6=18 4*6=24 5*6=30 6*6=36
> 1*7=7 2*7=14 3*7=21 4*7=28 5*7=35 6*7=42 7*7=49
> 1*8=8 2*8=16 3*8=24 4*8=32 5*8=40 6*8=48 7*8=56 8*8=64
> 1*9=9 2*9=18 3*9=27 4*9=36 5*9=45 6*9=54 7*9=63 8*9=72 9*9=81

Solutions

The best way to learn is to practice. Below, you will find some of the solutions other golfers have entered. To unlock higher ranked solutions, submit your own entry which does as well or better than the solutions you can currently see - climb the ladder!

Check out these helpful resources to improve your Vim skills... Game on.

Unlock 16 remaining solutions by signing in and submitting your own entry
#17 Jason Wolf / zephyr_wolf - Score: 122 - 02/04/13 @ 14:26
qqmao<C-R>=range(1,line('.'))<CR><Esc>'ajVGJ:s/\w/&*<C-R>=line('.')<CR>=/g<CR>q7@qqqyt=f i<C-R>=<C-R>"<CR><Esc>llq8@qxqwk0:normal <C-R>=line('.')<CR>@q<CR>xq6@wja <Esc>j.ZZ

0 comments

#18 전영식 / garam111 - Score: 138 - 02/28/13 @ 11:38
f=Dqqyyp<C-A>q7@qVHJqqyyp:s/\*\zs\d/\=submatch(0)+1/g<CR>q7@q:%s/\v(\d).(\d)/\=submatch(0)."=".submatch(1)*submatch(2)/g<CR>Hqqf Djf=q8@q/ 3<CR>i <Esc>j.ZZ

0 comments

#19 Pradeep Kumar / pradeep6kumar - Score: 255 - 02/03/13 @ 04:24
qaYA <Esc>pll<C-A>ll.q8@a2GA2*2=4 <Esc>qaByiWjp2<C-A>T*<C-A>A <Esc>q7@a3GA 3*3=9 <Esc>"apF2r3B"a2dW7@a4Gf3i <Esc>A4*4=16 <Esc>"apF3r4B"adWu"adaWu"a2dW6@a5GA5*5=25 <Esc>"apF45r5ur5B"a2dW5@a6GA6*6=36 <Esc>"apF5r6B"a2dW4@a7GA7*7=49 <Esc>"apF6r7B"a2dW3@a8GA8*8=64 <Esc>"apF7r8B"a2dW2@a9GA9*9=81<Esc>Gdd<Esc>:%s/ $//g<CR>ZZ

0 comments

#20 Trevor Powell / DoomedBunnies - Score: 301 - 02/05/13 @ 06:01
o1*2=2 2*2=4<CR>1*3=3 2*3=6  3*3=9<CR>1*4=4 2*4=8  3*4=12 4*4=16<CR>1*5=5 2*5=10 3*5=15 4*5=20 5*5=25<CR>1*6=6 2*6=12 3*6=18 4*6=24 5*6=30 6*6=36<CR>1*7=7 2*7=14 3*7=21 4*7=28 5*7=35 6*7=42 7*7=49<CR>1*8=8 2*8=16 3*8=24 4*8=32 5*8=40 6*8=48 7*8=56 8*8=64<CR>1*9=9 2*9=18 3*9=27 4*9=36 5*9=45 6*9=54 7*9=63 8*9=72 9*9=81<Esc>ZZ

DoomedBunnies: This is the benchmark. :)

1 comment

#21 David Wales / selawdivad - Score: 687 - 02/04/13 @ 04:09
ylll<Esc>uuhhyljo<Esc>p<Esc>uuuy2lp<Esc>uPujo<Esc>pa2=2 <Esc>o<Esc>p<Esc>yypppppp<Esc>:2<CR>$h#y3ljlpj.j.j.j.j.j.<Esc>:3<CR>2l:s/2/3/g<CR>j:<Up><Left><Left><BS>4<CR>j:<Up><Left><Left><BS>5<CR>j:<Up><Left><Left><BS>6<CR>:<Esc>j:<Up><Left><Left><BS>7<CR>j:<Up><Left><Left><BS>8<CR>j:<Up><Left><Left><BS>9<CR>:2<CR>$a2*2=4<Esc>hhhhy2l<Esc>j<Esc>khy3ljlpjpjpjpjpjpjp<Esc>:3<CR>$hhhhh<C-V>jjjjjjyllllllphhhhh<C-V>jjjjjjy$pa6<Esc>ja8<Esc>ja10<Esc>ja12<Esc>ja14<Esc>ja16<Esc>ja18<Esc>:3<CR>#<Esc>:3<CR>$a  3*3=9<Esc>5blll<C-V>lyja  <Esc>5p<Esc>up<Esc>j<Esc>kh3y<Esc>ja<Esc>p<Esc>ukl3yljpjpjpjpjp<Esc>:3<CR>jll<C-V>:9<CR><Esc>k:4<CR>ll<C-V>jjjjjy<C-V>ljjjjjy$pla12<Esc>ja15<Esc>ja18<Esc>ja21<Esc>ja24<Esc>ja27<Esc>:4<CR>$a 4*4=16<Esc>4hhh3yljpjpjpjpjp<Esc>:5<CR>3lh<C-V>ljjjjy$pla20<Esc>ja24<Esc>ja28<Esc>ja32<Esc>ja36<Esc>:5<CR>$a 5*5=25<Esc>4hhy2l<Esc>j<Esc>khy3ljpjpjpjp<Esc>kkk^ll<C-V>ljjjy$pla30<Esc>ja35<Esc>ja40<Esc>ja45<Esc>:6<CR>$a 6*6=36<Esc>5hh3yljpjpjp<Esc>:7<CR>ll<C-V>ljjy$p$a42<Esc>ja48<Esc>ja54<Esc>:8<CR>$a 7*<BS><BS><BS><Esc>ka &<BS>7*7 <BS>=49<Esc>5hh3yljpjp<Esc>:8<CR>ll<0xe2><0x88><0x9a>ljkh<C-V>ljy$p$a56<Esc>ja63<Esc>ka 8*8=64<Esc>ja *<BS>8*9 <BS>=72 (*(<BS><BS><BS>9*(<BS>9=81<Esc>:w<CR>:wq<CR>

selawdivad: This is what happens if you don't know any fancy commands... =P

1 comment

Created by: zealotrush

21 active golfers, 46 entries

Leaderboard (lowest score wins):
39
#1 - Urtica dioica / udioica

10/12/2016 at 07:09PM

49
#2 - Petro Тrouq / zulolosi

03/17/2013 at 04:00PM

49
#3 - Kerson Hsiao / KersonHsiao

03/31/2013 at 04:51PM

49
#4 - John Braxler / braxler

10/01/2014 at 05:54PM

63
#5 - I / ForgetIt17

11/23/2013 at 02:57PM

66
#6 - wushexu / wushexu

05/24/2013 at 02:59PM

67
#7 - Joonas Pihlajamaa / jokkebk

04/04/2014 at 12:28PM

69
#8 - Asmund Liseth / Asmund_L

02/04/2013 at 05:01PM

71
#9 - Tyler / tylerbindon

04/02/2013 at 09:50PM

81
#10 - Zach Kelling / zeekay

02/25/2013 at 02:29AM

84
#11 - Victor Ramirez / virako

02/02/2013 at 03:27PM

99
#12 - Oliver Christ / 0liverChrist

11/01/2013 at 04:43PM

107
#13 - Ker / alin_ker

04/19/2013 at 12:43PM

116
#14 - Christopher Harrison / Xophmeister

02/01/2013 at 10:50AM

117
#15 - Joel Elkins / dice_tea

03/02/2013 at 12:18AM

119
#16 - Jim / BLSJim

05/19/2013 at 02:23AM

122
#17 - Jason Wolf / zephyr_wolf

02/04/2013 at 02:26PM

138
#18 - 전영식 / garam111

02/28/2013 at 11:38AM

255
#19 - Pradeep Kumar / pradeep6kumar

02/03/2013 at 04:24AM

301
#20 - Trevor Powell / DoomedBunnies

02/05/2013 at 06:01AM

687
#21 - David Wales / selawdivad

02/04/2013 at 04:09AM