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 51a115429bada1000200001b

paste indent correction - JS

You copy some javascript code from a website and paste it into vim, it does not look good!

Start file
function AlbumCtrl($scope, $http) {
      $scope.url = 'http://onehungrymind.com/angular-album/images.json';
          $scope.images = [];
              $scope.imageCategories = [];
                  $scope.currentImage = {};

                      function handleImagesLoaded(data, status) {
                                $scope.images = data;
                                        $scope.currentImage = _.first($scope.images);
                                                $scope.imageCategories = _.uniq(_.pluck($scope.images, 'category'));
                                                    }

                          $scope.fetch = function () {
                                    $http.get($scope.url).success($scope.handleImagesLoaded);
                                        }

                              $scope.setCurrentImage = function (image) {
                                        $scope.currentImage = image;
                                            };

                                  $scope.fetch();
}

End file
function AlbumCtrl($scope, $http) {
    $scope.url = 'http://onehungrymind.com/angular-album/images.json';
    $scope.images = [];
    $scope.imageCategories = [];
    $scope.currentImage = {};

    function handleImagesLoaded(data, status) {
        $scope.images = data;
        $scope.currentImage = _.first($scope.images);
        $scope.imageCategories = _.uniq(_.pluck($scope.images, 'category'));
    }

    $scope.fetch = function () {
        $http.get($scope.url).success($scope.handleImagesLoaded);
    }

    $scope.setCurrentImage = function (image) {
        $scope.currentImage = image;
    };

    $scope.fetch();
}

View Diff

2,5c2,5
<       $scope.url = 'http://onehungrymind.com/angular-album/images.json';
<           $scope.images = [];
<               $scope.imageCategories = [];
<                   $scope.currentImage = {};
---
>     $scope.url = 'http://onehungrymind.com/angular-album/images.json';
>     $scope.images = [];
>     $scope.imageCategories = [];
>     $scope.currentImage = {};
7,11c7,11
<                       function handleImagesLoaded(data, status) {
<                                 $scope.images = data;
<                                         $scope.currentImage = _.first($scope.images);
<                                                 $scope.imageCategories = _.uniq(_.pluck($scope.images, 'category'));
<                                                     }
---
>     function handleImagesLoaded(data, status) {
>         $scope.images = data;
>         $scope.currentImage = _.first($scope.images);
>         $scope.imageCategories = _.uniq(_.pluck($scope.images, 'category'));
>     }
13,15c13,15
<                           $scope.fetch = function () {
<                                     $http.get($scope.url).success($scope.handleImagesLoaded);
<                                         }
---
>     $scope.fetch = function () {
>         $http.get($scope.url).success($scope.handleImagesLoaded);
>     }
17,19c17,19
<                               $scope.setCurrentImage = function (image) {
<                                         $scope.currentImage = image;
<                                             };
---
>     $scope.setCurrentImage = function (image) {
>         $scope.currentImage = image;
>     };
21c21
<                                   $scope.fetch();
---
>     $scope.fetch();

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 38 remaining solutions by signing in and submitting your own entry
#39 RR Arnold III / rra3 - Score: 18 - 05/26/13 @ 17:53
=G:%s/<C-V><Tab>/    /g<CR>ZZ

0 comments

#40 Vinicius Souza / vsouzas - Score: 18 - 05/30/13 @ 16:45
=G:%s/<C-V><Tab>/    /g<CR>ZZ

0 comments

#41 Nathan / NathanHarperoni - Score: 18 - 05/31/13 @ 16:31
=G:%s/\t/    /g|x<CR>

0 comments

#42 brett / brettyukich - Score: 18 - 09/22/13 @ 21:56
=G:%s/\t/    <CR>@:ZZ

0 comments

#43 Ricardo M. Vilchis / ajkaanbal - Score: 18 - 07/18/14 @ 16:14
=G:%s/\t/    /g<CR>ZZ

0 comments

#44 Carlos A Henríquez Q / lagunex - Score: 18 - 01/19/15 @ 11:15
=G:%s/\t/    /g<CR>ZZ

0 comments

#45 curist / curist - Score: 21 - 07/09/13 @ 04:53
=G:set ts=4 et|ret<CR>ZZ

0 comments

#46 Oliver Christ / 0liverChrist - Score: 23 - 10/15/13 @ 21:27
:set et<CR>:set sw=4<CR>VG=ZZ

0 comments

#47 Matt Ryan / mrevd - Score: 24 - 12/04/14 @ 00:53
:set et sw=5<BS>4<CR>ggVG=:wq<CR>

0 comments

#48 RobertT / techrt2050 - Score: 45 - 09/06/13 @ 04:41
:%<<<<<<<<CR>:set sw=4<CR>:2,21><CR>?;<CR>n4I <Esc>n.n.n.n.ZZ

0 comments

Created by: alimoeeny

48 active golfers, 75 entries

Leaderboard (lowest score wins):
16
#1 - Urtica dioica / udioica

05/25/2013 at 08:10PM

16
#2 - mnx / mnxx

05/25/2013 at 08:24PM

16
#3 - Kai Yuan / kentyuan

05/25/2013 at 08:53PM

16
#4 - r00tine / r00tine

05/25/2013 at 09:03PM

16
#5 - Marco Hinz / _mhinz_

05/25/2013 at 09:06PM

16
#6 - Joshua Draper / JoshuaBDraper

05/25/2013 at 09:32PM

16
#7 - Nathan Bouscal / nbouscal

05/26/2013 at 04:45AM

16
#8 - Sebastian Kusnier / skusnier

05/26/2013 at 03:07PM

16
#9 - Petro Тrouq / zulolosi

05/26/2013 at 07:13PM

16
#10 - Frank Dinoff / FDinoff

05/28/2013 at 02:42AM

16
#11 - Richard John Soni / richsoni

05/30/2013 at 05:42PM

16
#12 - Booberius / booberius

05/31/2013 at 02:34PM

16
#13 - Nikita Leshenko / nikita_l

06/01/2013 at 11:35AM

16
#14 - Aaron Bieber / aaronbieber

06/02/2013 at 01:42PM

16
#15 - Al / 96258

06/06/2013 at 04:01AM

16
#16 - Jim / BLSJim

06/10/2013 at 12:07AM

16
#17 - Spikes / SpikesDivZero

06/10/2013 at 02:36PM

16
#18 - Javier Blanco / jbgutierrez

06/20/2013 at 11:24PM

16
#19 - Norm Fasey / DeathRay1977

06/21/2013 at 03:57PM

16
#20 - powertomato / powertomato

06/27/2013 at 09:37PM

16
#21 - moo goo / m00g000

07/02/2013 at 01:26PM

16
#22 - Woojung Kim 김우중 / _kimwz

07/13/2013 at 12:30AM

16
#23 - Bradd Szonye / bszonye

07/13/2013 at 08:43AM

16
#24 - Ingo / ist3fani

07/29/2013 at 04:09PM

16
#25 - ———đίxίє—flαтlίиє——— / _dixie_flatline

07/31/2013 at 03:44AM

16
#26 - cj / cj01101

08/17/2013 at 07:38PM

16
#27 - James / Dronak

09/12/2013 at 08:11PM

16
#28 - Joonas Pihlajamaa / jokkebk

03/27/2014 at 09:41AM

16
#29 - Nolen Royalty / NolenRoyalty

05/08/2014 at 03:05AM

16
#30 - Caek / Caek_

07/15/2014 at 01:43AM

16
#31 - John Braxler / braxler

08/04/2014 at 07:38PM

16
#32 - Kristof Vannotten / kristofv

09/08/2014 at 08:55PM

16
#33 - Felix / DoubleFelix_

02/24/2015 at 10:19AM

16
#34 - Jon Krause / jkrause314

01/15/2016 at 05:58PM

16
#35 - Yahyalexandre33 / yahyalexandre33

03/14/2016 at 10:58PM

16
#36 - Clay Ratliff / MulitfariousGuy

05/08/2016 at 06:20PM

17
#37 - Nathan Wallace / nathanmwallace

11/27/2013 at 03:16PM

17
#38 - kemar / le_kemar

08/29/2014 at 04:57PM

18
#39 - RR Arnold III / rra3

05/26/2013 at 05:53PM

18
#40 - Vinicius Souza / vsouzas

05/30/2013 at 04:45PM

18
#41 - Nathan / NathanHarperoni

05/31/2013 at 04:31PM

18
#42 - brett / brettyukich

09/22/2013 at 09:56PM

18
#43 - Ricardo M. Vilchis / ajkaanbal

07/18/2014 at 04:14PM

18
#44 - Carlos A Henríquez Q / lagunex

01/19/2015 at 11:15AM

21
#45 - curist / curist

07/09/2013 at 04:53AM

23
#46 - Oliver Christ / 0liverChrist

10/15/2013 at 09:27PM

24
#47 - Matt Ryan / mrevd

12/04/2014 at 12:53AM

45
#48 - RobertT / techrt2050

09/06/2013 at 04:41AM