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 4d665abd7d73e02a55000009

Java Array2List

Convert an java array initializer into a list.

Start file
double[] c = 
{
	112.2, 102, 12, 954, 39.43,
	49.4, 2224.6, 94, 123,
	4929.55, 12, 98, 91.22
};
End file
List<Double> c = new ArrayList<Double>();
c.add(112.2);
c.add(102d);
c.add(12d);
c.add(954d);
c.add(39.43);
c.add(49.4);
c.add(2224.6);
c.add(94d);
c.add(123d);
c.add(4929.55);
c.add(12d);
c.add(98d);
c.add(91.22);

View Diff

1,6c1,14
< double[] c = 
< {
< 	112.2, 102, 12, 954, 39.43,
< 	49.4, 2224.6, 94, 123,
< 	4929.55, 12, 98, 91.22
< };
---
> List<Double> c = new ArrayList<Double>();
> c.add(112.2);
> c.add(102d);
> c.add(12d);
> c.add(954d);
> c.add(39.43);
> c.add(49.4);
> c.add(2224.6);
> c.add(94d);
> c.add(123d);
> c.add(4929.55);
> c.add(12d);
> c.add(98d);
> c.add(91.22);

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 62 remaining solutions by signing in and submitting your own entry
#63 akhilravidas / akhilravidas - Score: 121 - 08/19/11 @ 06:08
:%s/,/\r/g<CR>:g/^$/d<CR>Gddqq^c0c.add(<Esc>$a);<Esc>kq13@qccList<Double> c = new ArrayList<Double>():<BS>;<Esc>jddqaj/)<CR>id<Esc><Esc>0q2@a2jj2@aj2@aZZ

0 comments

#64 Tomasz Zurkowski / doriath88 - Score: 122 - 04/07/11 @ 08:45
CList<Double> c = new ArrayList<D<C-X><C-P>>();<Esc>jddJJjddV:s/\s//g<CR>:%s/\([0-9.]\+\),*/c.add(\1);\r/g<CR>dd:%s/(\([0-9]\+\))/(\1d)/g<CR>ZZ

0 comments

#65 Matthieu Honel / ocus - Score: 123 - 02/24/11 @ 13:52
~IList<<Esc>2wc$> c = new ArrayList<D<C-N>>();<Esc>:2d|5d<CR>:2,4s/\n//g|%s/\s*\([0-9.]\+\),*\r*/c.add(\1);\r/g|%s/(\(\d\+\))/(\1d)<CR>GGddZZ

0 comments

#66 michael caviness / michaelmichael - Score: 126 - 05/02/11 @ 16:23
3Gd0VjjJ:%s/, /\r/g<CR>3G<C-V>15GIc.add(<Esc>j$<C-V>jjAd<Esc>10G$<C-V>j$Ad<Esc>13G$<C-V>jAd<Esc>15G$<C-V>3G$A);<Esc>1GIList<<Esc>l~fea><Esc>ldeAnew ArrayList<Double>();<Esc>jddGddZZ

0 comments

#67 Piotr Śniegowski / PiotrSniegowski - Score: 126 - 06/06/13 @ 13:25
jddGdd2<gg:%s/,/\n/g<CR><Esc>u:<Up><Left><Left><BS>r<CR><gg6jdd4j.jAd<Esc>j.3k.k.4k.k.k.k0qaic.add(<Esc>A);<Esc>0jq12@aggi<<Esc> ~ea><Del><Del><Esc>v0yiList<Esc>Anew ArrayList<Esc>pa();<Esc>ZZ

0 comments

#68 Neal Lewis / neal_lewis - Score: 133 - 04/02/11 @ 19:20
rDiList<<Esc>lywwr>l$p<Esc>4blx<Esc>wwwinew ArrayList<<Esc>ea>();<Esc>jddVjj:s/\s*\(\d*.<BS>\.*\d*\),*/c.add(\1);\r/g<CR>d2d{dd{ddkkkkkV}:s/(\(\d*\))/(\1d)/<CR>ZZ

0 comments

#69 Christian Oudard / ChristianOudard - Score: 133 - 04/15/11 @ 15:18
iList<Double> c = new ArrayList<Double>();<Esc>lDjdd:%s/,/<C-K><CR><CR>/g<CR>jddGggjhhjAh<BS>d<Esc>j.j.jjjjj.j.jddjAd<Esc>j.ggjqq^d0I.<BS>c.add(<Esc>A);<Esc>jq12@q@q:7<CR>ddZZ

0 comments

#70 funkattack / funkattack - Score: 136 - 02/09/12 @ 17:44
iList<<Esc>klrD<Esc>f[xr>y0$pA>();<Esc>F i new Array<Del><Esc>jddGddVkk<:%s/, */\rc.add(/g<CR>:%s/(\(\d\+\)$/(\1d);<CR>:12<CR>Jx:8<CR>kJx:%s/\(\d\)$/\1);/<CR>:2<CR>ic.add(<Esc>ZZ

0 comments

#71 Fitz / Fitzface - Score: 137 - 01/16/12 @ 22:54
iList<<Del>D<Esc>f[xr>y0$pA)<BS>>();<Esc>F i new Array<Del><Esc>jddGddVkk<:%s/, */\rc.add(/g<CR>:%s/(\(\d\+\)$/(\1d);<CR>:12<CR>Jx:8<CR>kJx:%s/\(\d\)$/\1);/<CR>:2<CR>ic.add(<Esc>:wq<CR>

0 comments

#72 Pratap Koritala / pratap_koritala - Score: 142 - 02/20/16 @ 20:28
ddddd:%s:<BS><Esc>/<BS><Esc>:%s/,/\r/g<CR>jddk$Ad<Esc>k.kkk.k.4kk.k.k.k<Esc>15<<:6<CR>dd:10<CR>dd:1<CR><C-V>jjjj13jic.Ic.add(<Esc>$<C-V>13jA);<Esc>OList<Double> c = new ArrayList<Double>();<Esc>ZZ

0 comments

#73 ise0615 / ise0615 - Score: 184 - 05/03/12 @ 07:24
ffddiList<Double> c = new ArrayList<Double>();<Right><CR><BS><BS><Esc>Gddi<Up><Up><BS><Down><Right><BS><Down><Right><BS><Esc>2wkk0:%s/,/\r/g<CR>:<Up><Left><Left><BS><BS><Left><BS>^ <CR>:<Up><Left><Left><Left><Left><Right><BS>\r<CR>:<Up><Left><Left><Left><BS><BS>$<CR>kjdd(kddggj<C-V>GIc.add(<Esc>:<Up><Up><Left><Left>);<Left><Left><Left><BS><BS><BS>$<CR>gg$xxjjhid<Esc>vyjhPjlPjjjjhPjlPjjhPjPZZ

0 comments

#74 Jeffrey Klein / jeffwklein - Score: 185 - 08/02/13 @ 08:58
rDf[xr>IList<<Esc>0yWAnew Array<Esc>ps();<Esc>:%s/, /\r/g<CR>jddkkkld0kf,xjkkkkld0kf,x:3<CR>d0kddqqIc.add(<Esc>Ad);j<BS><Esc>jq12@q:%s/.*d/.*/g<CR>ujfkkjqqf)hxqjjjj@qj@@@q@@@@kkkjjjqqf)hxjq@qjj@@jj@@@@Q<BS><CR>visual<CR>hhx:x<CR>

0 comments

#75 Timo / timoreinhold - Score: 205 - 12/20/11 @ 10:43
S<Esc><Esc><Esc><Esc><Left><Left><Right><Left>u<Down><Down><Up><Up><Esc>wcw<Esc>wcwwww<Esc><Esc><Esc><Esc>ccwcwcw<Esc><Esc><Esc><Esc>uuuuuu<Down><Up><Down><Right><Down><Right><Up><Up><Up><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left>:%s/,/\r/g<CR>:g/^$/d<CR>Gddqq^c0c.add(<Esc>$a);<Esc>kq13@qccList<Double> c = new ArrayList<double<BS><BS><BS><BS><BS><BS>So<BS><BS>Double>():<BS>;<Esc>jddqaj/)<CR>id<Esc>0q2@a2jj2@aj2@aj2@aZZ

0 comments

#76 Ajay Somani / ajay_somani - Score: 223 - 08/19/11 @ 06:07
6ddiList<Double> c = new ArrayList<Double>();<CR>c.add(112.2);<CR>c.add(102d);<CR>c.add(12d);<CR>c.add(954d);<CR>c.add(39.43);<CR>c.add(49.4);<CR>c.add(2224.6);<CR>c.add(94d);<CR>c.add(123d);<CR>c.add(4929.55);<CR>c.add(12d);<CR>c.add(98d);<CR>c.add(91.22);<Esc>:wq<CR>

0 comments

#77 iCross / iCrossOfficial - Score: 253 - 04/11/11 @ 08:07
<Esc>jj<Esc>:%s/,/\r/<CR><Esc>u<Esc>:<Up>g<CR><Esc>ggjj^<Esc><C-V>jjjjjjjjjjjjjjjkhhhhhhIc.add(<Esc>j<Esc>kVGk:s/);/<BS><BS><BS>$/);<CR>jk<Esc>Vggjj:s/ */g<CR><Esc>u<Esc>:<Up><Left><Left><Left><Right><BS>\+<Right>/<CR><Esc>ggOList<Double> c = new ArrayList<Double>();<CR><Esc>dd<Esc><Esc>dd<Esc>dd<Esc>Gdd<Esc>ggjwwlllldw<Esc>jjkwid<Esc>jhid<Esc>jlid<Esc>jjjhbldw<Esc>kdd<Esc>jj$hhlid<Esc>jlid<Esc>jdd<Esc>jekwlwlx<Esc>jllid<Esc>jid<Esc><Esc>ZZ

0 comments

#78 basyura / basyura - Score: 269 - 04/24/11 @ 07:49
ddddddddddddddddddddddddddddddddddList<Double> c = new ArrayList<Double>();<CR>c.add(112.2);<CR>c.add(102d);<CR>c.add(12d);<CR>c.add(954d);<CR>c.add(39.43);<CR>c.add(49.4);<CR>c.add(2224.6);<CR>c.add(94d);<CR>c.add(123d);<CR>c.add(4929.55);<CR>c.add(12d);<CR>c.add(98d);<CR>c.add(91.22);<CR>dd<NL>k<Esc>ddddgggiLi<Esc>:wq<CR>

0 comments

Created by: robrob12

78 active golfers, 210 entries

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

01/07/2013 at 03:48AM

67
#2 - Petro Тrouq / zulolosi

07/11/2013 at 02:19AM

67
#3 - John Braxler / braxler

07/23/2014 at 02:21PM

73
#4 - You-Siang Lin / yslinnctu

11/29/2011 at 10:09AM

74
#5 - Justin Love / wondible

09/09/2011 at 02:59PM

76
#6 - Kerson Hsiao / KersonHsiao

08/04/2012 at 07:28AM

77
#7 - Andrew Dorman / andydorman

03/23/2011 at 04:10PM

77
#8 - Wei Dai / clvv42

05/07/2011 at 11:59PM

78
#9 - Tim Chase / gumnos

02/24/2011 at 03:07PM

78
#10 - h_east (トロッコ6個) / h_east

02/25/2011 at 10:57AM

79
#11 - Nolen Royalty / NolenRoyalty

04/20/2012 at 01:25PM

80
#12 - Super Garbage / SuperGarbage0

08/25/2013 at 02:22PM

81
#13 - Johan Sveholm / rymdtjuren

06/22/2011 at 08:38AM

81
#14 - Partial SHA1 hash / 25fcag9e

06/02/2014 at 11:34AM

83
#15 - Roy Marco Aruta / royaruta

02/24/2011 at 04:27PM

83
#16 - Stephen Morrow / yawmark

03/01/2011 at 01:58PM

83
#17 - Kevin Hamer / khamer

03/08/2011 at 11:13PM

83
#18 - Ash Searle / hexmen

03/09/2011 at 06:22PM

83
#19 - woodythrower / woodythrower

03/10/2011 at 08:13AM

84
#20 - Pavlo Klets / p01nt

02/24/2011 at 08:54PM

84
#21 - Arthur Hinh / arthur_hinh

03/20/2011 at 10:27AM

85
#22 - xhtmlforum / xhtmlforum

02/24/2011 at 07:57PM

85
#23 - vg / vimgolfer

02/25/2011 at 02:56AM

85
#24 - William Dunand / wdunand

02/29/2012 at 06:49AM

85
#25 - Joonas Pihlajamaa / jokkebk

02/26/2014 at 01:24PM

86
#26 - pftb12345 / pftb12345

04/07/2015 at 09:21AM

87
#27 - Dave / zzdave13

07/17/2011 at 02:47PM

88
#28 - Kurt Gaastra / KGaastra

02/13/2012 at 04:27AM

89
#29 - Eivind Jahren / HaskellElephant

02/24/2011 at 02:14PM

89
#30 - vimja / vimja666

10/29/2011 at 08:55AM

92
#31 - Asmund / herrasbe

02/04/2013 at 06:28PM

93
#32 - Oleg Pestov / opestov

03/09/2011 at 05:56PM

94
#33 - xaizek / xaizek

02/26/2011 at 02:50PM

94
#34 - Hu Junfeng / junfeng

08/02/2011 at 11:54AM

94
#35 - Renat Aksitov / Korvin79

01/29/2012 at 08:44PM

94
#36 - Justin / justinjaffray

05/04/2013 at 08:20PM

95
#37 - 無ん垢の叫び / john_ababa

02/27/2012 at 11:43AM

97
#38 - Pete Johns / johnsyweb

03/14/2011 at 04:31AM

99
#39 - Aaron Miller / apage43

08/14/2012 at 08:37AM

100
#40 - Øystein Walle / oysteinwalle

07/06/2011 at 02:39PM

101
#41 - Jason Axelson / bostonvaulter

05/10/2011 at 06:13PM

103
#42 - icdark / icdark

05/30/2011 at 10:48AM

103
#43 - Mohammed / mbadran

09/04/2011 at 09:34AM

105
#44 - Peter Anselmo / peter_anselmo

06/23/2011 at 08:31PM

105
#45 - Tesnorth / Tesnorth

01/31/2012 at 03:40PM

105
#46 - blamitter / blamitter

02/18/2012 at 08:38PM

105
#47 - James / Dronak

09/20/2014 at 06:59PM

107
#48 - timhoa / timhoa

02/26/2011 at 11:58AM

107
#49 - Trevor Powell / DoomedBunnies

03/20/2013 at 01:09AM

110
#50 - Bailey Ling / blingcoder

01/26/2013 at 08:07PM

111
#51 - Joost / vlabakje

03/02/2011 at 08:28PM

111
#52 - Dimitar Dimitrov / kurkale6ka

09/16/2016 at 04:38PM

112
#53 - Chun Yang / cccyang

07/27/2012 at 09:13AM

112
#54 - Yann Moisan / YannMoisan

01/13/2013 at 08:26PM

115
#55 - Simon's Calf / simonscarfe

09/06/2011 at 12:32PM

117
#56 - Thom Hughes / thom_hughes_1

03/26/2011 at 12:24AM

118
#57 - Dmitry Teslenko / krab_mozga

02/25/2011 at 12:08PM

118
#58 - Dmitry Bashkatov / dbashkatov

10/31/2011 at 11:05AM

119
#59 - Dezső Zoltán / zakiazigazi

02/24/2011 at 02:21PM

119
#60 - Alex Allahverdiev / alexallah

03/18/2011 at 09:57PM

120
#61 - Jesús Espino / jespinog

09/05/2011 at 03:09PM

121
#62 - Steve J at RF / rfsteve

04/11/2011 at 02:03AM

121
#63 - akhilravidas / akhilravidas

08/19/2011 at 06:08AM

122
#64 - Tomasz Zurkowski / doriath88

04/07/2011 at 08:45AM

123
#65 - Matthieu Honel / ocus

02/24/2011 at 01:52PM

126
#66 - michael caviness / michaelmichael

05/02/2011 at 04:23PM

126
#67 - Piotr Śniegowski / PiotrSniegowski

06/06/2013 at 01:25PM

133
#68 - Neal Lewis / neal_lewis

04/02/2011 at 07:20PM

133
#69 - Christian Oudard / ChristianOudard

04/15/2011 at 03:18PM

136
#70 - funkattack / funkattack

02/09/2012 at 05:44PM

137
#71 - Fitz / Fitzface

01/16/2012 at 10:54PM

142
#72 - Pratap Koritala / pratap_koritala

02/20/2016 at 08:28PM

184
#73 - ise0615 / ise0615

05/03/2012 at 07:24AM

185
#74 - Jeffrey Klein / jeffwklein

08/02/2013 at 08:58AM

205
#75 - Timo / timoreinhold

12/20/2011 at 10:43AM

223
#76 - Ajay Somani / ajay_somani

08/19/2011 at 06:07AM

253
#77 - iCross / iCrossOfficial

04/11/2011 at 08:07AM

269
#78 - basyura / basyura

04/24/2011 at 07:49AM