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

Cleanining up 80 column concatenated text

1. Put the whole query on one line, remove the concatenation operators 2. Remove the double spaces that appear a few times in the query 3. Use string-interpolated variable statementPid rather than the ugly concatenation

Start file
$atres = sqlStatement("select f.name,f.street,f.city,f.state,f.postal_code from facility f " .
  " left join users u on f.id=u.facility_id " .
  " left join  billing b on b.provider_id=u.id and b.pid = '".$stmt['pid']."' " .
  " where  service_location=1");
$row = sqlFetchArray($atres);
End file
$atres = sqlStatement("select f.name,f.street,f.city,f.state,f.postal_code from facility f left join users u on f.id=u.facility_id left join billing b on b.provider_id=u.id and b.pid = $statementPid where service_location=1");
$row = sqlFetchArray($atres);

View Diff

1,4c1
< $atres = sqlStatement("select f.name,f.street,f.city,f.state,f.postal_code from facility f " .
<   " left join users u on f.id=u.facility_id " .
<   " left join  billing b on b.provider_id=u.id and b.pid = '".$stmt['pid']."' " .
<   " where  service_location=1");
---
> $atres = sqlStatement("select f.name,f.street,f.city,f.state,f.postal_code from facility f left join users u on f.id=u.facility_id left join billing b on b.provider_id=u.id and b.pid = $statementPid where service_location=1");

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 72 remaining solutions by signing in and submitting your own entry
#73 Alberto Alcaraz / @Subastkar - Score: 88 - 06/25/12 @ 21:21
:%s/" \.\n  "<CR>:%s'<BS>/  ' <BS><BS>/  <BS>/g<CR>:%s/'".$\<stmt\>\['\<pid\>'\]."'/$statementPid/g<CR>:q<BS>wq<CR>

0 comments


Created by: @Salshammath

73 active golfers, 184 entries

Leaderboard (lowest score wins):
38
#31 - Ilya Ermolin / @ermolinis

06/26/2012 at 06:34PM

39
#32 - Tibor Claassen / @codebeige

06/23/2012 at 09:34PM

39
#33 - Corentin / @codl

04/13/2013 at 06:21AM

41
#34 - Maksim S. / @waynesayonara

09/02/2012 at 02:16PM

41
#35 - Joonas Pihlajamaa / @jokkebk

03/04/2014 at 07:40AM

42
#36 - Vincent Beffara / @vbeffara

06/24/2012 at 11:51AM

42
#37 - Øystein Walle / @oysteinwalle

06/25/2012 at 08:28PM

42
#38 - Trevor Powell / @DoomedBunnies

07/04/2012 at 06:29AM

42
#39 - James / @Dronak

09/19/2014 at 11:38PM

43
#40 - brett / @brettyukich

09/23/2013 at 10:58AM

44
#41 - Dave / @zzdave13

07/02/2012 at 10:01PM

44
#42 - tmr / @tmr314

09/04/2012 at 10:43PM

44
#43 - Underhill Labs / @underhilllabs

11/02/2012 at 01:30AM

44
#44 - cj / @cj01101

08/27/2013 at 02:31AM

45
#45 - Glen / @Glen_S

08/04/2012 at 09:12AM

45
#46 - Alex Tercete / @alextercete

08/24/2012 at 06:07AM

46
#47 - Ram Tamtam / @ramtamtamtam

07/02/2014 at 02:32PM

47
#48 - mlu / @_mlu

07/27/2012 at 08:06AM

47
#49 - Salvador / @smastermind

08/17/2012 at 02:50PM

47
#50 - Eric Potter / @pottereric

05/31/2013 at 01:56PM

48
#51 - Mahefa Randimbisoa / @DotMG

07/04/2012 at 11:07AM

48
#52 - Chris Brown / @engineercyb

07/12/2012 at 09:10PM

48
#53 - Michael Limiero / @michaellimiero

08/13/2012 at 10:03PM

48
#54 - Stephen Fiorelli / @sfiorell2

08/22/2012 at 07:42PM

48
#55 - n0nick / @n0nick

11/19/2012 at 02:13PM

48
#56 - Oliver Christ / @0liverChrist

10/07/2013 at 09:10PM

49
#57 - captain_morgan / @captain_morgan

06/24/2012 at 01:24AM

49
#58 - Sebastian Korten / @FlashKorten

07/20/2012 at 03:42PM

50
#59 - ltn614 / @ltn614

10/08/2015 at 09:51AM

50
#60 - Turkey Man / @lvturkeyman

01/02/2018 at 06:27AM