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 14 remaining solutions by signing in and submitting your own entry
#15 RockerZZY / @rocker_zzy - Score: 51 - 06/16/20 @ 06:35
O{<Esc>jqq"ayi""byi'cc\  "<C-R>b"   <Esc>9|C: '<C-R>a',<Esc><CR>q7@qo\}<Esc>ZZ

0 comments


Created by: @xged90

15 active golfers, 53 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

39
#4 - Jon Krause / @jkrause314

12/11/2020 at 07:38AM

39
#5 - Peppa Pig / @PeppaPigSg

07/03/2024 at 02:51AM

39
#6 - nickGPT / @nickandbro

08/28/2024 at 04:41AM

40
#7 - Petro Тrouq / @zulolosi

01/10/2015 at 02:34PM

42
#8 - Jake Eskel / @JakeEskel

01/06/2015 at 11:13PM

42
#9 - Carlos A Henríquez Q / @lagunex

01/16/2015 at 03:52PM

42
#10 - pftb12345 / @pftb12345

04/12/2015 at 11:44AM

45
#11 - mnx / @mnxx

01/05/2015 at 08:58AM

45
#12 - Maximiliano Padulo / @mpadulo

01/05/2015 at 04:45PM

46
#13 - Matt / @mcr05

01/04/2015 at 07:03PM

46
#14 - Martin LOUAZEL / @Zbrahark

03/03/2021 at 08:36AM

51
#15 - RockerZZY / @rocker_zzy

06/16/2020 at 06:35AM