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 @ 06: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 @ 12: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/24/13 @ 21: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/21/13 @ 22: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/09/13 @ 22: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 @ 09: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):
Q6hrg93p4r3hn56thmd0_normal
25
#1 - Urtica dioica / @udioica

11/14/2013 at 06:31PM

Johnjohn_normal
25
#2 - John Braxler / @braxler

08/19/2014 at 10:34AM

0e620322b2c292d069fe93e27c081f9c_normal
26
#3 - Petro Тrouq / @zulolosi

03/26/2013 at 03:32PM

Default_profile_3_normal
26
#4 - James Davis / @tripvg

06/28/2013 at 03:48PM

Default_profile_6_normal
26
#5 - Chaitanya Desu / @ChaituNu

05/10/2014 at 09:02PM

4654945923_eb2c60ee5f_normal
28
#6 - Kerson Hsiao / @KersonHsiao

03/21/2013 at 07:16PM

C4065e7d8164bafa96796ecc4b8ca2d7_normal
28
#7 - Bradd Szonye / @bszonye

07/15/2013 at 12:39AM

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

05/06/2013 at 06:14AM

7bbc92500a24e0892967c51a50f1ff8e_normal
39
#9 - Tyler / @tylerbindon

04/07/2013 at 08:21PM

Default_profile_2_normal
41
#10 - Ingo / @ist3fani

07/28/2013 at 10:03AM

F2ecdbb7682f84af70412e869af91dce_normal
42
#11 - Evan Shrubsole / @evanshrubsole

03/31/2013 at 01:15PM

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

05/01/2013 at 03:54PM

Ewbdmdtg_normal
58
#13 - Tim Chase / @gumnos

03/17/2013 at 04:05PM

Oliver_normal
63
#14 - oliver mueller / @marcontwit

05/21/2013 at 08:11AM

Bunnies_normal
65
#15 - Trevor Powell / @DoomedBunnies

03/18/2013 at 08:07PM

3af28abaa88d5ed2b7b5e41e6f5d94f4_normal
88
#16 - wushexu / @wushexu

05/20/2013 at 01:04AM

Default_profile_2_normal
88
#17 - Piotr Śniegowski / @PiotrSniegowski

06/05/2013 at 04:45PM

Default_profile_3_normal
89
#18 - Marcin Katulski / @marcink79

03/24/2013 at 06:37AM

F5f224e65543f062e08c3e1dd095ba9d_normal
92
#19 - Joel Elkins / @dice_tea

03/17/2013 at 10:34PM

Default_profile_6_normal
92
#20 - brett / @brettyukich

10/01/2013 at 02:14AM

Default_profile_5_normal
101
#21 - cj / @cj01101

10/18/2013 at 04:00PM

At_normal
104
#22 - Claes Mogren / @claesmogren

03/21/2013 at 05:04PM

Default_profile_3_normal
115
#23 - Aaron Josephs / @aaronjosephs1

05/02/2013 at 05:00PM

Btajjt8p_normal
115
#24 - Dmitriy / @_dpy_

08/21/2014 at 06:08AM

Default_profile_2_normal
116
#25 - george.li / @goblin_george

04/27/2014 at 12:47PM

Default_profile_4_normal
122
#26 - Daniel Fleischman / @vimgolfdaniel

03/24/2013 at 09:29PM

Default_profile_3_normal
124
#27 - RobertT / @techrt2050

09/21/2013 at 10:00PM

447cd88376c4ae42a27b963e559b6cb2_normal
127
#28 - kiyofumi.kmt / @kumack55

04/09/2013 at 10:26PM

Twitter_normal
150
#29 - Matt Adelman / @Xavierstein

03/21/2013 at 09:20AM