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

PHP Array Syntax -> MailChimp Merge Syntax

I recently needed to send an e-mail to our marketing department listing allowed merge tags for our MailChimp campaigns. The allowed merge tags were determined from a PHP array in one of our PHP classes. I transformed the PHP class to MailChimp's syntax and sent the e-mail. It was, however, a long, laborious process. I'm still fairly new to Vim and would love to see how an expert Vim user would tackle one of my own, real-world problems. Thanks and have fun!

Start file
$allowed = array("PIN", "Prefix", "LastName", "FirstName", "MiddleName", 
  "Address1", "Address2", "City", "State", "Zip", "Country", "phone", "mobile",
  "Email", "MothersMaiden", "security1_id", "security1_answer", 
  "security2_id", "security2_answer", "BirthDate", 
  "flag1", "DriversLicense", "gender");
End file
*|PIN|*
*|Prefix|*
*|LastName|*
*|FirstName|*
*|MiddleName|*
*|Address1|*
*|Address2|*
*|City|*
*|State|*
*|Zip|*
*|Country|*
*|phone|*
*|mobile|*
*|Email|*
*|MothersMaiden|*
*|security1_id|*
*|security1_answer|*
*|security2_id|*
*|security2_answer|*
*|BirthDate|*
*|flag1|*
*|DriversLicense|*
*|gender|*

View Diff

1,5c1,23
< $allowed = array("PIN", "Prefix", "LastName", "FirstName", "MiddleName", 
<   "Address1", "Address2", "City", "State", "Zip", "Country", "phone", "mobile",
<   "Email", "MothersMaiden", "security1_id", "security1_answer", 
<   "security2_id", "security2_answer", "BirthDate", 
<   "flag1", "DriversLicense", "gender");
---
> *|PIN|*
> *|Prefix|*
> *|LastName|*
> *|FirstName|*
> *|MiddleName|*
> *|Address1|*
> *|Address2|*
> *|City|*
> *|State|*
> *|Zip|*
> *|Country|*
> *|phone|*
> *|mobile|*
> *|Email|*
> *|MothersMaiden|*
> *|security1_id|*
> *|security1_answer|*
> *|security2_id|*
> *|security2_answer|*
> *|BirthDate|*
> *|flag1|*
> *|DriversLicense|*
> *|gender|*

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 136 remaining solutions by signing in and submitting your own entry
#137 Zee Spencer / @zspencer - Score: 168 - 01/18/12 @ 00:51
f(d0:s/\n<BS><BS>, /\n<CR>u<Up><Up><Up><Up>:<Up><Left><Left> <CR>u:<Up><Left><Left><BS><Right><Right>\<BS>/g<CR>u:<Up><Left><Left><Right><Right><Left><Left><Left><Left><Left><Left><Left><Left><Left>%<Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><CR>u<Up>:<Up><Left><Left><Left><Right>\r<Left><Left><CR>u<Up>:<Up><Left><Left><Left><Left><BS><BS><CR>ggx:%s/\r\r/\r/g<CR>:6d<CR>d0%<Esc>:%s/  //g<CR><BS><Down>i<BS><Esc>:18<CR>dd:%s/"<BS>^"/*|/g<CR>:%s/".*/|*/g<CR>ZZ

0 comments


Created by: @meekish

137 active golfers, 440 entries

Leaderboard (lowest score wins):
28
#61 - Mauro Persano / @fzort

11/22/2014 at 03:42PM

29
#62 - Jose Gutierrez / @Jogusa

09/20/2014 at 07:01PM

29
#63 - Daniel / @Daniel00288663

04/04/2017 at 09:34AM

30
#64 - Federico Bond / @federicobond

07/18/2012 at 06:13AM

30
#65 - Marcin Szamotulski / @me_coot

11/28/2012 at 08:16PM

30
#66 - Gurukandhamoorthi / @Gurukandhamoor1

08/04/2017 at 06:05PM

30
#67 - tp971 / @tp971

01/30/2019 at 08:31PM

31
#68 - brett / @brettyukich

09/22/2013 at 08:52PM

31
#69 - CJ Avilla / @wizemanip

11/18/2014 at 05:17PM

32
#70 - Scott Wehrenberg / @swehren

05/18/2012 at 02:35PM

32
#71 - RobertT / @techrt2050

07/16/2013 at 05:24AM

32
#72 - cj / @cj01101

08/20/2013 at 10:09PM

32
#73 - James / @Dronak

09/21/2014 at 02:05AM

33
#74 - Jer Wilson / @superjercom

10/28/2011 at 07:00AM

33
#75 - Pavlo Klets / @p01nt

10/28/2011 at 09:12AM

33
#76 - Daniel Hjerth / @danielhjerth

11/09/2011 at 06:02PM

33
#77 - Conrad Indiono / @indygemma

12/12/2011 at 10:48AM

33
#78 - Peter Anselmo / @peter_anselmo

03/02/2012 at 06:02PM

33
#79 - ぷりケツにるぽ / @nillpo

01/08/2015 at 02:26AM

33
#80 - TheProgrammer971 / @tp971

03/14/2015 at 02:39AM

34
#81 - Neal Lindsay / @neall

11/12/2011 at 05:50PM

34
#82 - Matt Woelk / @MattWoelk

11/13/2011 at 04:30AM

34
#83 - not so punk :] / @notsopunk

03/31/2012 at 07:48AM

34
#84 - Dave@Highgroove / @HighgrooveDave

05/23/2012 at 03:07AM

34
#85 - Tyler / @tylerbindon

04/03/2013 at 08:28PM

34
#86 - Xelrifos / @Xelrifos

02/23/2014 at 12:38PM

35
#87 - Camac / @gregorbyte

12/12/2011 at 06:21AM

35
#88 - sebtyp / @sebtyp

12/15/2011 at 07:41PM

35
#89 - Dj Vimgolf / @dj_vimgolf

12/31/2011 at 02:30AM

36
#90 - Nolen Royalty / @NolenRoyalty

04/21/2012 at 03:41AM