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

Format the output

Sometimes your standard out is a little hard to read. Take this multilevel hash and make it human readable.

Start file
{Vertex('x'): {Vertex('v'): Edge(Vertex('v'), Vertex('x')), Vertex('z'): Edge(Vertex('z'), Vertex('x')), Vertex('y'): Edge(Vertex('y'), Vertex('x'))}, Vertex('y'): {Vertex('x'): Edge(Vertex('y'), Vertex('x')), Vertex('w'): Edge(Vertex('w'), Vertex('y')), Vertex('z'): Edge(Vertex('z'), Vertex('y'))}, Vertex('z'): {Vertex('x'): Edge(Vertex('z'), Vertex('x')), Vertex('y'): Edge(Vertex('z'), Vertex('y')), Vertex('u'): Edge(Vertex('u'), Vertex('z'))}, Vertex('u'): {Vertex('v'): Edge(Vertex('v'), Vertex('u')), Vertex('w'): Edge(Vertex('w'), Vertex('u')), Vertex('z'): Edge(Vertex('u'), Vertex('z'))}, Vertex('v'): {Vertex('u'): Edge(Vertex('v'), Vertex('u')), Vertex('x'): Edge(Vertex('v'), Vertex('x')), Vertex('w'): Edge(Vertex('w'), Vertex('v'))}, Vertex('w'): {Vertex('u'): Edge(Vertex('w'), Vertex('u')), Vertex('v'): Edge(Vertex('w'), Vertex('v')), Vertex('y'): Edge(Vertex('w'), Vertex('y'))}}
End file
{
  Vertex('x'): {
    Vertex('v'): Edge(Vertex('v'), Vertex('x')), 
    Vertex('z'): Edge(Vertex('z'), Vertex('x')), 
    Vertex('y'): Edge(Vertex('y'), Vertex('x'))
  },
  Vertex('y'): {
    Vertex('x'): Edge(Vertex('y'), Vertex('x')), 
    Vertex('w'): Edge(Vertex('w'), Vertex('y')), 
    Vertex('z'): Edge(Vertex('z'), Vertex('y'))
  },
  Vertex('z'): {
    Vertex('x'): Edge(Vertex('z'), Vertex('x')), 
    Vertex('y'): Edge(Vertex('z'), Vertex('y')), 
    Vertex('u'): Edge(Vertex('u'), Vertex('z'))
  },
  Vertex('u'): {
    Vertex('v'): Edge(Vertex('v'), Vertex('u')), 
    Vertex('w'): Edge(Vertex('w'), Vertex('u')), 
    Vertex('z'): Edge(Vertex('u'), Vertex('z'))
  },
  Vertex('v'): {
    Vertex('u'): Edge(Vertex('v'), Vertex('u')), 
    Vertex('x'): Edge(Vertex('v'), Vertex('x')), 
    Vertex('w'): Edge(Vertex('w'), Vertex('v'))
  },
  Vertex('w'): {
    Vertex('u'): Edge(Vertex('w'), Vertex('u')), 
    Vertex('v'): Edge(Vertex('w'), Vertex('v')), 
    Vertex('y'): Edge(Vertex('w'), Vertex('y'))
  }
}

View Diff

1c1,32
< {Vertex('x'): {Vertex('v'): Edge(Vertex('v'), Vertex('x')), Vertex('z'): Edge(Vertex('z'), Vertex('x')), Vertex('y'): Edge(Vertex('y'), Vertex('x'))}, Vertex('y'): {Vertex('x'): Edge(Vertex('y'), Vertex('x')), Vertex('w'): Edge(Vertex('w'), Vertex('y')), Vertex('z'): Edge(Vertex('z'), Vertex('y'))}, Vertex('z'): {Vertex('x'): Edge(Vertex('z'), Vertex('x')), Vertex('y'): Edge(Vertex('z'), Vertex('y')), Vertex('u'): Edge(Vertex('u'), Vertex('z'))}, Vertex('u'): {Vertex('v'): Edge(Vertex('v'), Vertex('u')), Vertex('w'): Edge(Vertex('w'), Vertex('u')), Vertex('z'): Edge(Vertex('u'), Vertex('z'))}, Vertex('v'): {Vertex('u'): Edge(Vertex('v'), Vertex('u')), Vertex('x'): Edge(Vertex('v'), Vertex('x')), Vertex('w'): Edge(Vertex('w'), Vertex('v'))}, Vertex('w'): {Vertex('u'): Edge(Vertex('w'), Vertex('u')), Vertex('v'): Edge(Vertex('w'), Vertex('v')), Vertex('y'): Edge(Vertex('w'), Vertex('y'))}}
---
> {
>   Vertex('x'): {
>     Vertex('v'): Edge(Vertex('v'), Vertex('x')), 
>     Vertex('z'): Edge(Vertex('z'), Vertex('x')), 
>     Vertex('y'): Edge(Vertex('y'), Vertex('x'))
>   },
>   Vertex('y'): {
>     Vertex('x'): Edge(Vertex('y'), Vertex('x')), 
>     Vertex('w'): Edge(Vertex('w'), Vertex('y')), 
>     Vertex('z'): Edge(Vertex('z'), Vertex('y'))
>   },
>   Vertex('z'): {
>     Vertex('x'): Edge(Vertex('z'), Vertex('x')), 
>     Vertex('y'): Edge(Vertex('z'), Vertex('y')), 
>     Vertex('u'): Edge(Vertex('u'), Vertex('z'))
>   },
>   Vertex('u'): {
>     Vertex('v'): Edge(Vertex('v'), Vertex('u')), 
>     Vertex('w'): Edge(Vertex('w'), Vertex('u')), 
>     Vertex('z'): Edge(Vertex('u'), Vertex('z'))
>   },
>   Vertex('v'): {
>     Vertex('u'): Edge(Vertex('v'), Vertex('u')), 
>     Vertex('x'): Edge(Vertex('v'), Vertex('x')), 
>     Vertex('w'): Edge(Vertex('w'), Vertex('v'))
>   },
>   Vertex('w'): {
>     Vertex('u'): Edge(Vertex('w'), Vertex('u')), 
>     Vertex('v'): Edge(Vertex('w'), Vertex('v')), 
>     Vertex('y'): Edge(Vertex('w'), Vertex('y'))
>   }
> }

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 22 remaining solutions by signing in and submitting your own entry
#23 Jacob Vosmaer / @jacobvosmaer - Score: 84 - 06/03/12 @ 06:01
:set et sts=2 sw=2<CR>:s/)), /)), \r/g<CR>:%s/{/{\r/g<CR>:%s/}/\r}/g<CR>:%s/},/},\r<CR>gg=G7G31<<ZZ

0 comments

#24 Dave@Highgroove / @HighgrooveDave - Score: 85 - 05/31/12 @ 09:54
:%s/{/{\r  /g<CR><C-V>5kI  <Esc>:%s/)),/)), \r   /g<CR>:%s/))}, /))\r  },\r  /g<CR>G$$hi<CR><BS><BS><Esc>la<CR><BS><BS><Esc>:wq<CR>

0 comments

#25 Thijs Brobbel / @tiesmaster - Score: 98 - 05/29/12 @ 05:46
:s/{V/{<C-V><CR>    V/g<CR>:%s/)), V/)), <C-V><CR>    V/g<CR>:%s/}, V<BS><BS><BS><BS>))}, V/))<C-V><CR>  },<C-V><CR>  V/g<CR>G$i<CR><Esc>04xk$i<CR><BS><BS><Esc>ggjxxZZ

0 comments

#26 Michaël M. / @asenar - Score: 99 - 06/02/12 @ 13:24
aRT<Esc>:s/}, /},RT/g<CR>:s/))}/))RT}/g<CR>:s/)), \|.{/&RTT/g<CR>:s/}}/}R}/g<CR>:s/{{/{RT{/g<CR>:s/T/  /g<CR>:s/R/\r/g<CR>ZZ

0 comments

#27 Nik Johnson / @JumpandSpinWin - Score: 111 - 06/01/12 @ 11:55
a<CR>  <Esc>qqf{a<CR>  <Esc>]}i<CR><BS><BS><Esc>llls<CR><Esc>q@q@q@q@q@qi<CR><BS><BS><Esc>kkkkkkkkkkkkkkkkkkjqq:s/)), /)), \r/g<BS><BS>  /g<CR>u:<Up><Left><kHome>%<kEnd><Left><Left>  <CR>:q<CR>:wq<Esc><Esc>:wq<CR>

0 comments

#28 Jason Felice / @eraserhd - Score: 128 - 06/19/12 @ 16:39
:%s/\({\|)), \|))\)<BS>\<BS>|}, \|}\)/\1<C-V><CR>/g<CR>:33d<CR>:%s/}, /},<CR>:3,5><CR>u:set sw=2<CR>:3,5><CR>:8,10><CR>:13,15><CR>:18,20><CR>:23,25><CR>:28,30><CR>:2,31><CR>:wq<CR>

0 comments

Created by: @jpauldaigle

28 active golfers, 76 entries

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

05/26/2012 at 04:35PM

T_e_normal
35
#2 - Tim Chase / @gumnos

05/27/2012 at 11:51AM

40051_789281885907_29616532_44170636_2091417_n_normal
35
#3 - Conner McDaniel / @connermcd

06/18/2012 at 07:47AM

Dsc_0096_2_normal
35
#4 - Victor Ramirez / @virako

10/19/2012 at 05:35PM

4654945923_eb2c60ee5f_normal
40
#5 - Kerson Hsiao / @KersonHsiao

06/24/2012 at 11:04PM

Mobile_photo_mar_15__2010_12_39_49_normal
42
#6 - Rod Knowlton / @codelahoma

05/25/2012 at 04:55PM

Default_profile_2_normal
42
#7 - quintin / @quintinjeannoel

05/30/2012 at 01:37PM

Jlove201003sq_normal
42
#8 - Justin Love / @wondible

06/02/2012 at 07:58AM

Bc879469f279ee24b7fbdfad7c2216d9_normal
43
#9 - 無ん垢の叫び / @john_ababa

05/25/2012 at 08:49AM

P1000007_normal
43
#10 - h_east (DDD ready) / @h_east

05/25/2012 at 09:40AM

Default_profile_3_normal
43
#11 - Édouard M'tou / @DouardM

10/09/2012 at 12:42PM

Default_profile_0_normal
46
#12 - Benoit Mortgat / @Benoit_Mortgat

06/05/2012 at 12:16PM

Emblemofroto_normal
47
#13 - Glen / @Glen_S

07/21/2012 at 09:36PM

Default_profile_0_normal
48
#14 - shutl_test / @shutl_test

06/06/2012 at 05:02AM

Image_normal
50
#15 - Слава / @slava_and_ipad

08/08/2012 at 07:35AM

Default_profile_1_normal
53
#16 - Benson Kim / @BensonRLA

06/05/2012 at 10:52AM

Y1p4714jfgqbxwbk3xwedazq_2xf63nvvd0ebkioosczy777c2b3wruhnx0ipmlbxcuuhba2em5yik01eowh6yexq_normal
55
#17 - ise0615 / @ise0615

05/25/2012 at 10:45AM

Jbgutierrez_normal
60
#18 - Javier Blanco / @jbgutierrez

05/28/2012 at 02:49PM

Self-avatar-2009_normal
69
#19 - John Whitley / @johnwhitley

05/28/2012 at 10:57AM

Default_profile_5_normal
75
#20 - Scott Nielsen / @smniel

05/25/2012 at 03:34PM

Twitterprofile_normal
75
#21 - Daniel Erlandsson / @danneerlandsson

05/28/2012 at 02:19AM

Dan_in_white_shirt_normal
77
#22 - Dan Dorman / @dandorman

05/25/2012 at 09:32AM

Default_profile_4_normal
84
#23 - Jacob Vosmaer / @jacobvosmaer

06/03/2012 at 06:01AM

2b2760e92e36c38ca61fe53782b336a0_normal
85
#24 - Dave@Highgroove / @HighgrooveDave

05/31/2012 at 09:54AM

Default_profile_4_normal
98
#25 - Thijs Brobbel / @tiesmaster

05/29/2012 at 05:46AM

Moi-parano_normal
99
#26 - Michaël M. / @asenar

06/02/2012 at 01:24PM

Pikacat_normal
111
#27 - Nik Johnson / @JumpandSpinWin

06/01/2012 at 11:55AM

Profile_normal
128
#28 - Jason Felice / @eraserhd

06/19/2012 at 04:39PM