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 54a94976f4048c00026d8ed6

C to VimDict

Convert a C data structure to a Vimscript dictionary.

Start file
{ "Return", '\n', },
{ "ampersand", '&', },
{ "apostrophe", '\'', },
{ "asciicircum", '^', },
{ "asciitilde", '~', },
{ "asterisk", '*', },
{ "at", '@', },
{ "backslash", '\\', },
End file
{
\  "\n" : 'Return',
\  "&"  : 'ampersand',
\  "\'" : 'apostrophe',
\  "^"  : 'asciicircum',
\  "~"  : 'asciitilde',
\  "*"  : 'asterisk',
\  "@"  : 'at',
\  "\\" : 'backslash',
\}

View Diff

1,8c1,10
< { "Return", '\n', },
< { "ampersand", '&', },
< { "apostrophe", '\'', },
< { "asciicircum", '^', },
< { "asciitilde", '~', },
< { "asterisk", '*', },
< { "at", '@', },
< { "backslash", '\\', },
---
> {
> \  "\n" : 'Return',
> \  "&"  : 'ampersand',
> \  "\'" : 'apostrophe',
> \  "^"  : 'asciicircum',
> \  "~"  : 'asciitilde',
> \  "*"  : 'asterisk',
> \  "@"  : 'at',
> \  "\\" : 'backslash',
> \}

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 8 remaining solutions by signing in and submitting your own entry
#9 Maximiliano Padulo / mpadulo - Score: 45 - 01/05/15 @ 16:45
O{<Esc>qq+r\t'DBPBBr"t,.l5r 9|cw: '<Esc>;r'q7@qo\}<Esc>ZZ

0 comments

#10 Matthieu Crapet / mcr05 - Score: 46 - 01/04/15 @ 19:03
O{<Esc>qq+r\wx"adE r"t,.3a <Esc>9|C: '<C-R>a<Esc>hr'q7@qo\}<Esc>ZZ

0 comments

Created by: xged90

10 active golfers, 38 entries

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

01/10/2015 at 07:05AM

39
#2 - John Braxler / braxler

01/12/2015 at 02:43PM

39
#3 - kimber gonzalez / kimberlycreates

01/12/2015 at 03:44PM

40
#4 - Petro Тrouq / zulolosi

01/10/2015 at 02:34PM

42
#5 - Jake Eskel / JakeEskel

01/06/2015 at 11:13PM

42
#6 - Carlos A Henríquez Q / lagunex

01/16/2015 at 03:52PM

42
#7 - pftb12345 / pftb12345

04/12/2015 at 11:44AM

45
#8 - mnx / mnxx

01/05/2015 at 08:58AM

45
#9 - Maximiliano Padulo / mpadulo

01/05/2015 at 04:45PM

46
#10 - Matthieu Crapet / mcr05

01/04/2015 at 07:03PM