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

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

1486 active golfers, 6033 entries

Solutions by @StreamBag:
32
#72 - Robert Andersson / @StreamBag

10/23/2013 at 04:57AM

33
#>226 - Robert Andersson / @StreamBag

10/23/2013 at 04:55AM

34
#>289 - Robert Andersson / @StreamBag

10/23/2013 at 04:48AM

35
#>337 - Robert Andersson / @StreamBag

10/22/2013 at 07:54PM

36
#>417 - Robert Andersson / @StreamBag

10/22/2013 at 07:51PM

39
#>661 - Robert Andersson / @StreamBag

10/22/2013 at 07:47PM

41
#>814 - Robert Andersson / @StreamBag

10/22/2013 at 07:42PM

42
#>881 - Robert Andersson / @StreamBag

10/22/2013 at 07:38PM

44
#>1000 - Robert Andersson / @StreamBag

10/22/2013 at 07:35PM

47
#>1138 - Robert Andersson / @StreamBag

10/22/2013 at 05:45PM

48
#>1189 - Robert Andersson / @StreamBag

10/22/2013 at 05:29PM

50
#>1245 - Robert Andersson / @StreamBag

10/22/2013 at 05:25PM