Real Vim ninjas count every keystroke - do you?

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

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

Your VimGolf key: please sign in

$ gem install vimgolf
$ vimgolf setup
$ vimgolf put 51459ef6b94aa50002000002

It's a factor

Flaunt your macro prowess by factoring some numbers. Too hard? It takes less than 30 strokes, I promise.

Start file
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
End file
1
1 2
1 3
1 2 4
1 5
1 2 3 6
1 7
1 2 4 8
1 3 9
1 2 5 10
1 11
1 2 3 4 6 12
1 13
1 2 7 14
1 3 5 15
1 2 4 8 16
1 17
1 2 3 6 9 18
1 19
1 2 4 5 10 20

View Diff

2,20c2,20
< 2
< 3
< 4
< 5
< 6
< 7
< 8
< 9
< 10
< 11
< 12
< 13
< 14
< 15
< 16
< 17
< 18
< 19
< 20
---
> 1 2
> 1 3
> 1 2 4
> 1 5
> 1 2 3 6
> 1 7
> 1 2 4 8
> 1 3 9
> 1 2 5 10
> 1 11
> 1 2 3 4 6 12
> 1 13
> 1 2 7 14
> 1 3 5 15
> 1 2 4 8 16
> 1 17
> 1 2 3 6 9 18
> 1 19
> 1 2 4 5 10 20

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 23 remaining solutions by signing in and submitting your own entry
#24 Dmitriy / @_dpy_ - Score: 115 - 08/21/14 @ 13:08
dG:for i in range(1,20)|let l=[]|for j in range(1,i)|if i%j==0|call add(l,j)|endif|endfor|put=join(l)|endfor<CR>1GddZZ

0 comments

#25 george.li / @goblin_george - Score: 116 - 04/27/14 @ 19:47
dG:for i in range(1,20)|let l=[]|for j in range(1,i)|if i%j==0|call add(l,j)|endif|endfor|put=join(l)|endfor<CR>:1<CR>ddZZ

0 comments

#26 Daniel Fleischman / @vimgolfdaniel - Score: 122 - 03/25/13 @ 04:29
<Up>dG:for i in range(1,20)|let l=[]|for j in range(1,i)|if i%j==0|call add(l,j)|endif|endfor|put=join(l)|endof<BS><BS>for<CR>1Gdd:wq<CR>

0 comments

#27 RobertT / @techrt2050 - Score: 124 - 09/22/13 @ 05:00
qq+I1 <Esc>q19@q2Gqq2+a 2<Esc>q8@q3Gqq3+$F a3 <Esc>q4@q4Gqq4+$F a4 <Esc>q3@q5Gqq5+$F a5 <Esc>q2@q2-qq$F a6 <Esc>q6-@q++2f a7 <Esc>jja8 <Esc>jja9 <Esc>jjhi10 <Esc>ZZ

0 comments

#28 kiyofumi.kmt / @kumack55 - Score: 127 - 04/10/13 @ 05:26
dG:redi @a|let i=1|whi i<21<CR>let j=2<CR>ec "1"<CR>whi j<=i<CR>if i%j==0<CR>echon " ".j<CR>endi<CR>let j+=1<CR>endw<CR>let i+=1<CR>endw<CR>::redi END<CR>"ap<CR>kdkZZ

0 comments

#29 Matt Adelman / @Xavierstein - Score: 150 - 03/21/13 @ 16:20
VGxi1<CR>1 2<CR>1 3<CR>1 2 4<CR>1 5<CR>1 2 3 6<CR>1 7<CR>1 2 4 8<CR>1 3 9<CR>1 2 5 10<CR>1 11<CR>1 2 3 4 6 12<CR>1 13<CR>1 2 7 14<CR>1 3 5 15<CR>1 2 4 8 16<CR>1 17<CR>1 2 3 6 9 18<CR>1 19<CR>1 2 4 5 10 20<Esc>ZZ

0 comments

Created by: @udioica

29 active golfers, 69 entries

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

11/15/2013 at 02:31AM

25
#2 - John Braxler / @braxler

08/19/2014 at 05:34PM

26
#3 - Petro Тrouq / @zulolosi

03/26/2013 at 10:32PM

26
#4 - James Davis / @tripvg

06/28/2013 at 10:48PM

26
#5 - Chaitanya Desu / @ChaituNu

05/11/2014 at 04:02AM

28
#6 - Kerson Hsiao / @KersonHsiao

03/22/2013 at 02:16AM

28
#7 - Bradd Szonye / @bszonye

07/15/2013 at 07:39AM

29
#8 - László Bácsi / @icanscale

05/06/2013 at 01:14PM

39
#9 - Tyler / @tylerbindon

04/08/2013 at 03:21AM

41
#10 - Ingo / @ist3fani

07/28/2013 at 05:03PM

42
#11 - Evan Shrubsole / @evanshrubsole

03/31/2013 at 08:15PM

50
#12 - sweet.mike.vg / @SweetMikeVg

05/01/2013 at 10:54PM

58
#13 - Tim Chase / @gumnos

03/17/2013 at 11:05PM

63
#14 - oliver mueller / @marcontwit

05/21/2013 at 03:11PM

65
#15 - Trevor Powell / @DoomedBunnies

03/19/2013 at 03:07AM

88
#16 - wushexu / @wushexu

05/20/2013 at 08:04AM

88
#17 - Piotr Śniegowski / @PiotrSniegowski

06/05/2013 at 11:45PM

89
#18 - Marcin Katulski / @marcink79

03/24/2013 at 01:37PM

92
#19 - Joel Elkins / @dice_tea

03/18/2013 at 05:34AM

92
#20 - brett / @brettyukich

10/01/2013 at 09:14AM

101
#21 - cj / @cj01101

10/18/2013 at 11:00PM

104
#22 - Claes Mogren / @claesmogren

03/22/2013 at 12:04AM

115
#23 - Aaron Josephs / @aaronjosephs1

05/03/2013 at 12:00AM

115
#24 - Dmitriy / @_dpy_

08/21/2014 at 01:08PM

116
#25 - george.li / @goblin_george

04/27/2014 at 07:47PM

122
#26 - Daniel Fleischman / @vimgolfdaniel

03/25/2013 at 04:29AM

124
#27 - RobertT / @techrt2050

09/22/2013 at 05:00AM

127
#28 - kiyofumi.kmt / @kumack55

04/10/2013 at 05:26AM

150
#29 - Matt Adelman / @Xavierstein

03/21/2013 at 04:20PM