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 78 remaining solutions by signing in and submitting your own entry
#79 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

79 active golfers, 203 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

31
#10 - Peppa Pig / @PeppaPi95550250

07/03/2024 at 07:03AM

32
#11 - じょんあば / @john_ababa

06/23/2012 at 11:28PM

32
#12 - Daniel S / @smatter0ne

07/15/2012 at 09:34PM

32
#13 - Urtica dioica / @udioica

12/14/2012 at 11:53AM

32
#14 - Jean George / @JeanGeo20504212

10/27/2023 at 10:51PM

33
#15 - ☈king / @SharpsawDotOrg

06/24/2012 at 05:01AM

33
#16 - Alexey Morozov / @alexeysmorozov

06/24/2012 at 09:45AM

33
#17 - Justin Love / @wondible

06/24/2012 at 05:09PM

33
#18 - abernardes / @abernardes

06/25/2012 at 03:17PM

33
#19 - John Dahlström / @dahlstromjohn

06/27/2012 at 10:40PM

33
#20 - Tobias Sjösten / @tobiassjosten

06/29/2012 at 06:33AM

33
#21 - Raúl Jara / @rauljara

07/08/2012 at 01:16AM

33
#22 - James Davis / @tripvg

08/05/2012 at 04:20AM

33
#23 - Слава / @slava_and_ipad

08/08/2012 at 12:08PM

33
#24 - Sean Griffin / @sgrif

08/13/2012 at 12:41AM

33
#25 - Emile Swarts / @EmileSwarts

08/18/2012 at 02:39PM

33
#26 - Édouard M'tou / @DouardM

10/09/2012 at 09:01AM

33
#27 - Marcin Szamotulski / @me_coot

11/02/2012 at 11:29PM

33
#28 - Bradd Szonye / @bszonye

07/15/2013 at 08:50AM

34
#29 - Sune Simonsen / @sunesimonsen

08/25/2012 at 06:31PM

35
#30 - John Whitley / @johnwhitley

06/25/2012 at 05:03PM