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 56 remaining solutions by signing in and submitting your own entry
#57 captain_morgan / captain_morgan - Score: 49 - 06/24/12 @ 01:24
:%s/" \.\n  " <CR>:%s/  / /g<CR>/'<CR>c18l$statementPid<Esc>ZZ

0 comments

#58 Sebastian Korten / FlashKorten - Score: 49 - 07/20/12 @ 15:42
4J:s!"[ .]*"!!g<CR>:s!  *! !g<CR>f'c3f'$statementPid<Esc>ZZ

0 comments

#59 ltn614 / ltn614 - Score: 50 - 10/08/15 @ 09:51
qq$Jca"<Esc>q2@qF$dT ftaate<Right>en<Esc>f[dtp~f'dt :s/  / /g<CR>ZZ

0 comments

#60 Stephen Crosby / stevecrozz - Score: 53 - 07/19/12 @ 05:20
j<C-V>tljjxj3f xjF xkf'c3f'$statementPid<Esc>qq$xxxxkq2@q4JZZ

0 comments

#61 Stefan Schmidt / stafue - Score: 53 - 12/06/13 @ 16:33
:%s/" \.\n  " <CR>:%s/  / /g<CR>/'<CR>c18l$sat<BS><BS>tatementPid<Esc>ZZ

0 comments

#62 Reed Riley / ReedRile - Score: 54 - 08/11/12 @ 17:55
4J:s/" .  "//g<CR>:s/  / /g<CR>/stmt<CR>da"ca'$statementPid <Esc>ZZ

0 comments

#63 Adelar S. Queiróz / adelarsq - Score: 54 - 12/04/12 @ 23:21
4J:%s/\( " .  " \)\|\(  \)/ /g<CR>f'i$statementPid<Esc><Right>18xZZ

0 comments

#64 Mateusz Zawisza / mateuszzawisza - Score: 55 - 06/23/12 @ 22:20
f"qqf"DJdwq@q2f"@q:%s/\ \ /\ /g<CR>f'3df'i$statementPid<Esc>ZZ

0 comments

#65 J Paul Daigle / philosodad - Score: 55 - 06/25/12 @ 17:01
j<C-V>tljjx:%s/" .\n//g<CR>:s/\ \ /\ /g<CR>f'ctw$statementPid <Esc>ZZ

0 comments

#66 Juanje Ojeda / juanjeojeda - Score: 58 - 07/05/12 @ 02:30
:<Up>%s/\" .\n  \" //g<CR>:s/  / /g<CR>:s/'.*'/$statementPid/<CR>:<Esc><Esc>ZZ

0 comments

#67 Christopher Garvis / cgarvis - Score: 60 - 09/10/12 @ 15:47
4J:s!"[ .]*"!!g<CR>:s !!<BS>  <BS> *! !g<CR>f'c3f;c3f'$statementPid<Esc>:wq<CR>

0 comments

#68 Pandae / psasqw - Score: 61 - 06/26/12 @ 12:57
j<C-V>2Wh2jxfd;lDjFb;;hxf=;ll3xlllCatementPid<Esc>4Gf x:1,4j<CR>f";dtlZZ

0 comments

#69 Ryan O'Connell / Salshammath - Score: 65 - 06/23/12 @ 21:18
4J:%s/'".*"'/$statementPid/|%s/  \@=//g|%s/"\s\+\.\s\+"\s*//g<CR>ZZZ

0 comments

#70 Sven Koesling / McSvenster - Score: 80 - 08/14/12 @ 15:03
:%s/" \.\n  " // | s/'"\.\$stmt\['pid'\]\."'/\$statementPid/ | s/  \+/ /<CR>u:<Up>g<CR>ZZ

0 comments

#71 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

71 active golfers, 182 entries

Leaderboard (lowest score wins):
31
#1 - Federico Galassi / federicogalassi

06/23/2012 at 10:26PM

31
#2 - Tim Chase / gumnos

06/23/2012 at 11:19PM

31
#3 - Conner McDaniel / connermcd

06/24/2012 at 04:05AM

31
#4 - Joseph J. Piché / jjpiche

08/25/2012 at 11:58PM

31
#5 - agp vim golf / agpvimgolf

09/09/2012 at 03:22AM

31
#6 - Victor Ramirez / virako

10/18/2012 at 12:56AM

31
#7 - Petro Тrouq / zulolosi

07/03/2013 at 10:22PM

31
#8 - John Braxler / braxler

05/20/2014 at 06:07PM

31
#9 - Jon Krause / jkrause314

01/17/2016 at 04:03AM

32
#10 - 無ん垢の叫び / john_ababa

06/23/2012 at 11:28PM

32
#11 - Daniel S / smatter0ne

07/15/2012 at 09:34PM

32
#12 - Urtica dioica / udioica

12/14/2012 at 11:53AM

33
#13 - ☈king / SharpsawDotOrg

06/24/2012 at 05:01AM

33
#14 - Alexey Morozov / alexeysmorozov

06/24/2012 at 09:45AM

33
#15 - Justin Love / wondible

06/24/2012 at 05:09PM

33
#16 - abernardes / abernardes

06/25/2012 at 03:17PM

33
#17 - John Dahlström / dahlstromjohn

06/27/2012 at 10:40PM

33
#18 - Tobias Sjösten / tobiassjosten

06/29/2012 at 06:33AM

33
#19 - Raúl Jara / rauljara

07/08/2012 at 01:16AM

33
#20 - James Davis / tripvg

08/05/2012 at 04:20AM

33
#21 - Слава / slava_and_ipad

08/08/2012 at 12:08PM

33
#22 - Sean Griffin / sgrif

08/13/2012 at 12:41AM

33
#23 - Emile Swarts / EmileSwarts

08/18/2012 at 02:39PM

33
#24 - Édouard M'tou / DouardM

10/09/2012 at 09:01AM

33
#25 - Marcin Sza / coot_

11/02/2012 at 11:29PM

33
#26 - Bradd Szonye / bszonye

07/15/2013 at 08:50AM

34
#27 - Sune Simonsen / sunesimonsen

08/25/2012 at 06:31PM

35
#28 - John Whitley / johnwhitley

06/25/2012 at 05:03PM

35
#29 - William Dunand / wdunand

08/03/2012 at 06:00AM

38
#30 - Kerson Hsiao / KersonHsiao

06/24/2012 at 07:49AM

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

53
#60 - Stephen Crosby / stevecrozz

07/19/2012 at 05:20AM

53
#61 - Stefan Schmidt / stafue

12/06/2013 at 04:33PM

54
#62 - Reed Riley / ReedRile

08/11/2012 at 05:55PM

54
#63 - Adelar S. Queiróz / adelarsq

12/04/2012 at 11:21PM

55
#64 - Mateusz Zawisza / mateuszzawisza

06/23/2012 at 10:20PM

55
#65 - J Paul Daigle / philosodad

06/25/2012 at 05:01PM

58
#66 - Juanje Ojeda / juanjeojeda

07/05/2012 at 02:30AM

60
#67 - Christopher Garvis / cgarvis

09/10/2012 at 03:47PM

61
#68 - Pandae / psasqw

06/26/2012 at 12:57PM

65
#69 - Ryan O'Connell / Salshammath

06/23/2012 at 09:18PM

80
#70 - Sven Koesling / McSvenster

08/14/2012 at 03:03PM

88
#71 - Alberto Alcaraz / Subastkar

06/25/2012 at 09:21PM