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 @ebonhand09:

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

1415 active golfers, 5752 entries

Solutions by @ebonhand09:
32
#15 - David / @ebonhand09

06/11/2012 at 11:59AM

32
#>15 - David / @ebonhand09

06/11/2012 at 12:07PM

33
#>203 - David / @ebonhand09

06/11/2012 at 11:52AM

33
#>203 - David / @ebonhand09

06/11/2012 at 11:55AM

34
#>272 - David / @ebonhand09

06/11/2012 at 11:50AM

35
#>315 - David / @ebonhand09

06/11/2012 at 11:43AM

37
#>474 - David / @ebonhand09

06/11/2012 at 11:38AM

39
#>626 - David / @ebonhand09

06/11/2012 at 11:34AM

41
#>768 - David / @ebonhand09

06/11/2012 at 11:29AM

42
#>842 - David / @ebonhand09

06/11/2012 at 10:57AM

42
#>842 - David / @ebonhand09

06/11/2012 at 11:03AM

43
#>893 - David / @ebonhand09

06/11/2012 at 11:10AM

45
#>994 - David / @ebonhand09

06/11/2012 at 11:26AM

53
#>1254 - David / @ebonhand09

06/11/2012 at 10:50AM

58
#>1319 - David / @ebonhand09

06/11/2012 at 10:47AM