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

CSV to JSON

A search for shortest vimissh way to convert CSV to JSON.

Start file
Year,Make,Model,Length
1997,Ford,E350,2.34
2000,Mercury,Cougar,2.38
End file
[
	{
		"Year": "1997",
		"Make": "Ford",
		"Model": "E350",
		"Length": "2.34"
	},
	{
		"Year": "2000",
		"Make": "Mercury",
		"Model": "Cougar",
		"Length": "2.38"
	}
]

View Diff

1,3c1,14
< Year,Make,Model,Length
< 1997,Ford,E350,2.34
< 2000,Mercury,Cougar,2.38
---
> [
> 	{
> 		"Year": "1997",
> 		"Make": "Ford",
> 		"Model": "E350",
> 		"Length": "2.34"
> 	},
> 	{
> 		"Year": "2000",
> 		"Make": "Mercury",
> 		"Model": "Cougar",
> 		"Length": "2.38"
> 	}
> ]

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 40 remaining solutions by signing in and submitting your own entry
#41 Franco Lazzarino / @flazz - Score: 157 - 01/04/11 @ 12:19
:%s/,/<C-V><CR>/g<CR>:%norm I"<CR>:%norm A"<CR>:1,4norm A: <CR>:5,7norm A,<CR>:<Up><Left><Left><Left><Left><Left><Left><Left><BS><BS><BS>9,11<CR>:<Esc><Esc>gg<C-V>jjj$x5ggP9ggP:s<BS>%s/:\s*/: /<CR>8ggo},<CR>{<Esc>Go}<CR>]<Esc>5ggO{<Esc>O[<Esc>kdgg:2,13><CR>:3,6><CR>:9,12><CR>ZZ

0 comments

#42 Christopher Brew / @Seph1rothVII - Score: 158 - 01/13/12 @ 10:51
i[<CR><Esc>Yjpjo]<Esc>:%s/\v^(\a+),(\a+),(\a+),(\a+)\n(\d+),(\a+),([^,]+),(w\<BS><BS>.+)$/\t{\r\t\t"\1": "\5",\r\t\t"\2": "\6",\r\t\t"\3": "\7",\r\t\t"\4": "\8"\r\t}/g<CR>7Ga,<Esc>ZZ

0 comments

#43 drio / @drio - Score: 161 - 01/16/11 @ 07:48
:%s/,/<C-V><CR>/g<CR><C-V>ggI"<Esc>qqA": <Esc>0jq3@qqqA",<Esc>0jq7@q$D:8<CR>$Dgg"ayWj"byWj"cyWj"dyWj"aPj0"bPj0"cPj0"dPj0"aPj0"bPj0"cPj0"dPgg4ddO[<CR><Tab>{<Esc>j0v3j$>.:7<CR>O<Tab>},<CR>{<Esc>j0v3j$>.:12<CR>o<BS>}<CR>\<BS><BS>]<Esc>ZZ

0 comments

#44 Lajos Koszti / @Ajnasz - Score: 166 - 01/06/11 @ 05:48
yyjpggqa:s/,/: /g<CR>df jPk^df jf,pk^df j2f,pk^Dj3f,pa: <Esc><Esc>^C{<CR><0xe2><0x87><0xa7>}<Esc>kkjo<Esc>pj^xk:s/,/,\r/g<CR>qjj@a:%s/\([a-z0-90<BS>.]\+\)/|\<BS><BS>:<BS>"\1"/g<CR>ggi[<Esc>Go]<Esc>kVjh%j>jVk%k>jj/{<CR>j.kkddka,<Esc><Esc>:x<CR>

0 comments

#45 Adrian Silva / @scyldinga - Score: 176 - 01/10/12 @ 02:29
i[<CR><Tab>{<CR><Tab>"<Esc>wwi": "1997"<Esc>lli<CR>"<Esc>ww"i:<Esc><Esc>i": "Ford",<Esc>lxi<CR>"<Esc>wwi": "E35[<BS>0"<Esc>lli<CR>"<Esc>wwb$a": "3<BS>2.34"<CR>}<Esc><<o}<BS>]<Esc><<<Esc>:2,7y<CR>kpka,<Esc>jjf1ct"2000<Esc>jxcTF<Esc>xiMecr<BS><BS>rcury<Esc>jhcT"Cougar<Esc>jcT"2.38<Esc>3j2dd:x<CR>

0 comments

#46 Karl Eklund / @keklund - Score: 191 - 01/03/11 @ 18:47
yyjpkkqqdwjPa,<Esc>t,lr<CR>kddpkkxq@q@qJr,0jjjj@q@q@qJr,0<C-A>0VG!tac<CR>kVkkk!tac<CR>O[<CR><Tab>{<Down><Down><Down><Down><CR><BS><Right><Right><Right><CR><Tab>},<CR>{<Down><Down><Down><Down><Down><Right><Right><CR><Tab>}<CR><BS>]<Esc>ggjj:%s/(.*),(.*)/"\1<BS><BS><BS>\t\t"\1": "\2",/<CR>qqi<Tab><Tab>"<fd-56>": <Del>"<End>",<Esc>0j0q@q@q@q<Up><End>x<Down><Down><Down>04@q<Up><End>x<Left><Left><Left><Left>r2ZZ

0 comments

#47 Christopher Sexton / @fuzzymonk - Score: 204 - 01/01/11 @ 12:08
:<Up>%s/\(\w\+\)/"\1"/g<CR>qq0f.dhlxq:2<CR>@qk0df,jPr:a <Esc>j0.uhPr: i <Esc>ggdf,jf,a<CR>P<BS><Esc>Pr:<Esc>jf,a<CR><Esc>Pr: i <Esc>ggdf,2j2f,F,a<CR><Esc>Pr:a <Esc>jjf,a<CR><Esc>Pr:a <Esc>ggDi[<CR><Tab>{<Esc>:5<CR>f,a<CR><Esc>Pa: <Esc>o},<CR>{<Esc>:11<CR>f,a<CR><Esc>Pa: <Esc>o}<CR>]<Esc>Vgg=j<C-V>jI<Tab><Esc>:7<CR><C-V>jjjjjjI<Tab><Esc>:4<CR>f:a <Esc>ZZ

0 comments

#48 Ilya Ermolin / @ermolinis - Score: 210 - 01/01/11 @ 11:25
:let l = map(getline(1,3),'split(v:val,",")')<CR>:for i in range(4)<CR>let t = 1<CR>let l[t][i] = "\t\t\"".l[o]<BS><BS>0][i].'": '<BS>"'.l[t][i].'",'<CR><Up><Up><BS>2<CR><Up><Up><CR>endfor<CR>3dd:s/^/\=l[1]+l[2]<CR>gg0i<CR><Up>i<BS>[<CR><Tab>{<CR><Del><Tab><Down><Down><Down><Down><Up><End><Left><CR><BS>}<Right><CR>{<Down><Down><Down><Down><End><BS><CR><BS>}<CR><BS>]<Esc>ZZ

0 comments

#49 Dan Williams / @deft_of_center - Score: 272 - 04/02/13 @ 21:02
:%s/^\|$/"/g<CR>:%s/,/",#"/g<CR>:s$<BS>/$/\r\t}\r]/<CR>:s,1<BS><BS><BS>,1s/^/[\r\t{\r/<CR>n<CR><Up><Up><Up><Up>:s/^/[\r\t{\r/<CR>:s/,/: /g<CR>A:<Esc>:%s/#/\r<CR>:<Up>/g<CR>qauuY<Down>p:%s/#/\r/g<CR>qadd<BS><BS><Esc>dd3kPkJjjjqa^DDdduuqqadd3j3k3kqjjjudd3kOuu<BS><BS><BS><Esc>uuuuuqadd3kPkJ3jq3@a4k4@a:s/&<BS>$/\r\t}.\<BS><BS>,\r{\r/<CR><Left><Down><Up><Up><Tab><Down><Up>i<Tab><Down><BS>:%s^<BS><BS><BS><BS><Esc>:s<BS>%s/^"/\t\t"/<CR>ZZ

0 comments

#50 ise0615 / @ise0615 - Score: 395 - 05/13/12 @ 00:35
i"<Esc>wwi"<Right><CR>"<Esc>ww.ui"<Right><CR><Esc>.ui"<Esc>wwi"<Right><CR><Esc>.ui"<Esc>wwkwwblllllla"<CR><Esc>jkkkkkkkk$a<BS>:<Down><BS>:<Down><Right><BS>:<Down><Right>:<Esc>jkkkkkk0i[<CR>{<CR><Esc>jjjji},<CR><Esc>kkkkkkvjjjjjlljkhhyjjjjjpi,<CR><Esc>jjjjjlxji]<Esc>jv$dkkkkkkkkkkkk$pi <Esc>wwlv$djla <Esc>plllllv$djla <Esc>pllllv<Esc>lDjja<Esc>phhhi <Esc>kddjjjjjjjjjjjddkkkkk$pi<BS> <Esc>llllllDjla <Esc>pbbbbbv$duv$hdjla <Esc>pbhbv$duv$hdjla <Esc>pa"<Esc>hhhh.ub.u<Left><Left>.<Up><Left><Left>.<Up><Left><Left>.<Up><Left>.<Right><Right><Right><Right>.<Down><Right><Right>.<Down><Left>.<Up><Up><Up><Up><Up>.<Up><Left>.<Up><Left>.<Up><Left>.<Left><Left><Left><Left><Left>.<Down><Left>.<Down><Left><Right>.<Down><Right><Left>.<Esc>0kkkk<C-V>jjjjj>jl<C-V>jjjjk>jjjjj<C-V>jjjjj>jl<C-V>jjj>ZZ

0 comments

Created by: @Ujjwol

50 active golfers, 120 entries

Leaderboard (lowest score wins):
40051_789281885907_29616532_44170636_2091417_n_normal
56
#1 - Conner McDaniel / @connermcd

09/24/2012 at 05:38PM

Q6hrg93p4r3hn56thmd0_normal
56
#2 - Urtica dioica / @udioica

01/02/2013 at 09:42AM

Shiraseon3_normal
60
#3 - Douglas Stockwell / @dstockwell

01/01/2011 at 04:21PM

Me-small_normal
60
#4 - Wei Dai / @clvv42

01/01/2011 at 04:36PM

Gintoki_normal
60
#5 - You-Siang Lin / @yslinnctu

12/07/2011 at 04:35AM

Proshot_square_normal
60
#6 - Benjamin Sullivan / @benjaminsull

12/11/2011 at 05:09AM

Jlove201003sq_normal
68
#7 - Justin Love / @wondible

08/08/2011 at 08:38AM

T_e_normal
76
#8 - Tim Chase / @gumnos

01/01/2011 at 05:06AM

Twitter_normal
76
#9 - Drew Neil / @nelstrom

01/02/2011 at 05:42AM

Avatar-small_normal
77
#10 - Hu Junfeng / @hujunfeng

07/26/2011 at 02:00AM

Ja_u_central_parku-mala_normal
79
#11 - Dragan Cvetinovic / @kawkafi

05/22/2011 at 07:00AM

Default_profile_6_normal
81
#12 - William Dunand / @wdunand

11/21/2011 at 12:41AM

Ruby_normal
83
#13 - Nándor Komzák / @rubymood

01/02/2011 at 02:10PM

122_normal
84
#14 - not so punk :] / @notsopunk

06/19/2011 at 09:12AM

Rp_logo_plain_normal
85
#15 - Kevin Webster / @rabidpraxis

01/02/2011 at 02:20PM

P1000007_normal
88
#16 - h_east (DDD ready) / @h_east

01/01/2011 at 01:51AM

Default_profile_5_normal
93
#17 - Karel Vervaeke / @karel1980

01/03/2011 at 02:20AM

Hrleft_normal
93
#18 - Glenn / @spamcow_moo

01/03/2011 at 03:35PM

Twitter_normal
94
#19 - Austin Taylor / @austintaylor

01/01/2011 at 08:18PM

89861495_n00_normal
97
#20 - Clément Nodet / @clementnodet

01/03/2011 at 02:09PM

Face_icon_normal
97
#21 - Akira Matsuda / @a_matsuda

01/05/2011 at 07:46AM

2010-05-13t17-56-23__1__normal
100
#22 - Marian Schubert / @MarianSchubert

01/01/2011 at 03:03PM

Image_normal
101
#23 - Pete Johns / @johnsyweb

01/10/2011 at 09:59AM

Default_profile_4_normal
104
#24 - Aurélien Delahaye / @alkove

01/01/2011 at 07:52AM

Default_profile_5_normal
105
#25 - Matti Hänninen / @mjhanninen

01/30/2011 at 06:32AM

Gravatar_normal
106
#26 - Asmund Liseth / @Asmund_L

01/01/2011 at 12:32PM

Temp1346150024strip20120828-29550-y91s9z_normal
107
#27 - Aaron Miller / @apage43

08/12/2012 at 07:11PM

Avatar_normal
114
#28 - Øystein Walle / @oysteinwalle

07/06/2011 at 02:24AM

Eek_normal
115
#29 - Clive Evans / @swish_bob

01/01/2011 at 02:49PM

3d3c391e6138cd35b9f45402fb5b08a1_normal
116
#30 - Behnam Esfahbod / @zwnj

01/01/2011 at 06:57AM

Dscf0013_flipped_300_300_twitter_normal
120
#31 - Christoph Stock / @christophstock

01/01/2011 at 08:15AM

Untitled_2_normal
121
#32 -  Ikhsan Maulana / @ixandidu

01/15/2011 at 01:02AM

Default_profile_2_normal
127
#33 - Renat Aksitov / @Korvin79

02/06/2012 at 11:19AM

Default_profile_6_normal
129
#34 - Francisco Dibar / @frandibar

01/12/2011 at 02:28PM

1309650785306_normal
145
#35 - Rob Ciaccio / @RobertoCalavera

02/01/2011 at 09:28AM

6240_139454607906_723872906_3271730_5845230_n_normal
150
#36 - Alain Gilbert / @alain_gilbert

01/01/2011 at 12:44PM

David_normal
152
#37 - davidnorth / @davidnorth

01/01/2011 at 04:51PM

Default_profile_2_normal
153
#38 - Justin Cullen / @zenguine

02/28/2012 at 10:34PM

Bc879469f279ee24b7fbdfad7c2216d9_normal
155
#39 - 無ん垢の叫び / @john_ababa

02/24/2012 at 12:10AM

Default_profile_3_normal
156
#40 - Przemysław Pawełczyk / @przemoc86

01/15/2011 at 02:29PM

Tektek_avatar_closeup_normal
157
#41 - Franco Lazzarino / @flazz

01/04/2011 at 12:19PM

Image1326661166_normal
158
#42 - Christopher Brew / @Seph1rothVII

01/13/2012 at 10:51AM

29ed1f20888463b3b72bd9fed88a79b8_normal
161
#43 - drio / @drio

01/16/2011 at 07:48AM

En-face_normal
166
#44 - Lajos Koszti / @Ajnasz

01/06/2011 at 05:48AM

Retratoadrianmanifestowww_normal
176
#45 - Adrian Silva / @scyldinga

01/10/2012 at 02:29AM

Kalle_normal
191
#46 - Karl Eklund / @keklund

01/03/2011 at 06:47PM

5894583d12c7295243c4648d71f39daf_normal
204
#47 - Christopher Sexton / @fuzzymonk

01/01/2011 at 12:08PM

Default_profile_0_normal
210
#48 - Ilya Ermolin / @ermolinis

01/01/2011 at 11:25AM

7c384fc5069a8c34ee73fbf160aecc8f_normal
272
#49 - Dan Williams / @deft_of_center

04/02/2013 at 09:02PM

Y1p4714jfgqbxwbk3xwedazq_2xf63nvvd0ebkioosczy777c2b3wruhnx0ipmlbxcuuhba2em5yik01eowh6yexq_normal
395
#50 - ise0615 / @ise0615

05/13/2012 at 12:35AM