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

Reformat/Refactor a Golfer Class

A simple case of removing unneeded code and fixing broken indentation.

Start file
class Golfer
     def initialize; end # initialize
  def useless; end;
  
     def self.hello(a,b,c,d)
      puts "Hello #{a}, #{b}, #{c}, #{d}"
   end
end
End file
class Golfer
  def self.hello(*a)
    puts "Hello #{a.join(',')}"
  end
end

View Diff

2,7c2,4
<      def initialize; end # initialize
<   def useless; end;
<   
<      def self.hello(a,b,c,d)
<       puts "Hello #{a}, #{b}, #{c}, #{d}"
<    end
---
>   def self.hello(*a)
>     puts "Hello #{a.join(',')}"
>   end

Solutions by @ArtStandAlone:

Unlock 13 remaining solutions by signing in and submitting your own entry
Created by: @igrigorik

1603 active golfers, 6512 entries

Solutions by @ArtStandAlone:
32
#99 - kiho choi / @ArtStandAlone

04/24/2014 at 11:07AM

33
#>240 - kiho choi / @ArtStandAlone

04/24/2014 at 10:27AM

34
#>299 - kiho choi / @ArtStandAlone

04/24/2014 at 10:07AM

34
#>299 - kiho choi / @ArtStandAlone

04/24/2014 at 10:14AM

35
#>356 - kiho choi / @ArtStandAlone

04/24/2014 at 09:58AM

36
#>439 - kiho choi / @ArtStandAlone

04/24/2014 at 05:08AM

37
#>526 - kiho choi / @ArtStandAlone

04/24/2014 at 03:03AM

38
#>606 - kiho choi / @ArtStandAlone

04/24/2014 at 02:53AM

40
#>784 - kiho choi / @ArtStandAlone

04/24/2014 at 02:41AM

41
#>859 - kiho choi / @ArtStandAlone

04/24/2014 at 02:37AM

42
#>929 - kiho choi / @ArtStandAlone

04/23/2014 at 01:00PM

44
#>1054 - kiho choi / @ArtStandAlone

04/23/2014 at 12:51PM

62
#>1493 - kiho choi / @ArtStandAlone

04/23/2014 at 12:45PM