Real Vim ninjas count every keystroke - do you?

Pick a challenge, fire up Vim, and show us what you got.

Leaderboard, 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 46 remaining solutions by signing in and submitting your own entry
#47 Sebastian Korten / @FlashKorten - Score: 49 - 07/20/12 @ 08:42
4J:s!"[ .]*"!!g<CR>:s!  *! !g<CR>f'c3f'$statementPid<Esc>ZZ

0 comments

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

0 comments

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

0 comments

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

0 comments

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

0 comments

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

0 comments

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

0 comments

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

0 comments

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

0 comments

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

0 comments

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

0 comments

#58 Alberto Alcaraz / @Subastkar - Score: 88 - 06/25/12 @ 14: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

58 active golfers, 160 entries

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

06/23/2012 at 03:26PM

T_e_normal
31
#2 - Tim Chase / @gumnos

06/23/2012 at 04:19PM

40051_789281885907_29616532_44170636_2091417_n_normal
31
#3 - Conner McDaniel / @connermcd

06/23/2012 at 09:05PM

149526_1475690574073_1287977447_31109480_3104807_n_normal
31
#4 - Joseph J. Piché / @jjpiche

08/25/2012 at 04:58PM

Default_profile_2_normal
31
#5 - agp vim golf / @agpvimgolf

09/08/2012 at 08:22PM

Dsc_0096_2_normal
31
#6 - Victor Ramirez / @virako

10/17/2012 at 05:56PM

Bc879469f279ee24b7fbdfad7c2216d9_normal
32
#7 - 無ん垢の叫び / @john_ababa

06/23/2012 at 04:28PM

Ich_normal
32
#8 - Daniel S / @smatter0ne

07/15/2012 at 02:34PM

Q6hrg93p4r3hn56thmd0_normal
32
#9 - Urtica dioica / @udioica

12/14/2012 at 03:53AM

Sy18fa3i4y5qmtvzg7qu_normal
33
#10 - ☈king / @SharpsawDotOrg

06/23/2012 at 10:01PM

Av-31_normal
33
#11 - Rekky / @lightrekky

06/24/2012 at 02:45AM

Jlove201003sq_normal
33
#12 - Justin Love / @wondible

06/24/2012 at 10:09AM

P1000725_normal
33
#13 - abernardes / @abernardes

06/25/2012 at 08:17AM

Dsc00226_normal
33
#14 - John Dahlström / @dahlstromjohn

06/27/2012 at 03:40PM

Tobias_normal
33
#15 - Tobias Sjösten / @tobiassjosten

06/28/2012 at 11:33PM

Image_normal
33
#16 - Raúl Jara / @rauljara

07/07/2012 at 06:16PM

Default_profile_3_normal
33
#17 - James Davis / @tripvg

08/04/2012 at 09:20PM

Image_normal
33
#18 - Слава / @slava_and_ipad

08/08/2012 at 05:08AM

312189_10150481221796258_700041257_11172966_434509532_n_normal
33
#19 - Sean Griffin / @sgrif

08/12/2012 at 05:41PM

06j7gfcv1iecx0y418xh_normal
33
#20 - Emile Swarts / @EmileSwarts

08/18/2012 at 07:39AM

Default_profile_3_normal
33
#21 - Édouard M'tou / @DouardM

10/09/2012 at 02:01AM

3ubh7kcfj18s5m9erc6p_normal
33
#22 - Marcin Sza / @coot_

11/02/2012 at 04:29PM

Me_normal
34
#23 - Sune Simonsen / @sunesimonsen

08/25/2012 at 11:31AM

Self-avatar-2009_normal
35
#24 - John Whitley / @johnwhitley

06/25/2012 at 10:03AM

Default_profile_6_normal
35
#25 - William Dunand / @wdunand

08/02/2012 at 11:00PM

4654945923_eb2c60ee5f_normal
38
#26 - Kerson Hsiao / @KersonHsiao

06/24/2012 at 12:49AM

Default_profile_0_normal
38
#27 - Ilya Ermolin / @ermolinis

06/26/2012 at 11:34AM

Ich_neu_normal
39
#28 - Tibor Claassen / @codebeige

06/23/2012 at 02:34PM

Carton_normal
39
#29 - Corentin / @codl

04/12/2013 at 11:21PM

Jj3_normal
41
#30 - Maksim S. / @waynesayonara

09/02/2012 at 07:16AM

Default_profile_2_normal
42
#31 - Vincent Beffara / @vbeffara

06/24/2012 at 04:51AM

Avatar_normal
42
#32 - Øystein Walle / @oysteinwalle

06/25/2012 at 01:28PM

Bunnies_normal
42
#33 - Trevor Powell / @DoomedBunnies

07/03/2012 at 11:29PM

Uwe_horns_by_joao_normal
44
#34 - Dave / @zzdave13

07/02/2012 at 03:01PM

Default_profile_1_normal
44
#35 - tmr / @tmr314

09/04/2012 at 03:43PM

Knittingstash_240dpi_72x72_normal
44
#36 - Underhill Labs / @underhilllabs

11/01/2012 at 06:30PM

Emblemofroto_normal
45
#37 - Glen / @Glen_S

08/04/2012 at 02:12AM

Alex_normal
45
#38 - Alex Tercete / @alextercete

08/23/2012 at 11:07PM

T5vyktm_rage-face-fuck-that2u42_normal
47
#39 - mlu / @_mlu

07/27/2012 at 01:06AM

Old-tv-set-thumb206925-751667_normal
47
#40 - Salvador / @smastermind

08/17/2012 at 07:50AM

Avatar-aa-96_normal
48
#41 - Mahefa Randimbisoa / @DotMG

07/04/2012 at 04:07AM

Default_profile_1_normal
48
#42 - Chris Brown / @engineercyb

07/12/2012 at 02:10PM

3hrkqpt87oaselzo9qiu_normal
48
#43 - Michael Limiero / @michaellimiero

08/13/2012 at 03:03PM

Default_profile_3_normal
48
#44 - Stephen Fiorelli / @sfiorell2

08/22/2012 at 12:42PM

9aaede1a87631c292fd5e27c5df320be_normal
48
#45 - n0nick / @n0nick

11/19/2012 at 06:13AM

Cognbones_normal
49
#46 - captain_morgan / @captain_morgan

06/23/2012 at 06:24PM

Hnc_normal
49
#47 - Sebastian Korten / @FlashKorten

07/20/2012 at 08:42AM

Img_0574_normal
53
#48 - Stephen Crosby / @stevecrozz

07/18/2012 at 10:20PM

Fxjqeo1fxqhkf2i965qh_normal
54
#49 - Reed Riley / @ReedRile

08/11/2012 at 10:55AM

I3_normal
54
#50 - Adelar S. Queiróz / @adelarsq

12/04/2012 at 03:21PM

Mateuszzawisza.original-1326882069_normal
55
#51 - Mateusz Zawisza / @mateuszzawisza

06/23/2012 at 03:20PM

Image005_normal
55
#52 - J Paul Daigle / @jpauldaigle

06/25/2012 at 10:01AM

Juanje_normal
58
#53 - Juanje Ojeda / @juanjeojeda

07/04/2012 at 07:30PM

Twitter-profile_normal
60
#54 - Christopher Garvis / @cgarvis

09/10/2012 at 08:47AM

Default_profile_0_normal
61
#55 - Pandae / @psasqw

06/26/2012 at 05:57AM

Wideeyes_normal
65
#56 - Ryan O'Connell / @Salshammath

06/23/2012 at 02:18PM

Avatar_normal
80
#57 - Sven Koesling / @McSvenster

08/14/2012 at 08:03AM

Headband_normal
88
#58 - Alberto Alcaraz / @Subastkar

06/25/2012 at 02:21PM