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

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

1616 active golfers, 6560 entries

Solutions by @trose89:
32
#18 - Taylor Rose / @trose89

07/13/2012 at 04:14AM

33
#>212 - Taylor Rose / @trose89

07/13/2012 at 04:13AM

34
#>284 - Taylor Rose / @trose89

07/13/2012 at 04:09AM

35
#>334 - Taylor Rose / @trose89

07/13/2012 at 04:05AM

36
#>420 - Taylor Rose / @trose89

07/13/2012 at 04:03AM

37
#>502 - Taylor Rose / @trose89

07/13/2012 at 03:55AM

38
#>588 - Taylor Rose / @trose89

07/13/2012 at 03:52AM

39
#>671 - Taylor Rose / @trose89

07/13/2012 at 03:44AM

39
#>671 - Taylor Rose / @trose89

07/13/2012 at 03:52AM

40
#>763 - Taylor Rose / @trose89

07/13/2012 at 03:34AM

40
#>763 - Taylor Rose / @trose89

07/13/2012 at 03:50AM

41
#>836 - Taylor Rose / @trose89

07/12/2012 at 10:32PM

47
#>1190 - Taylor Rose / @trose89

07/12/2012 at 10:28PM

50
#>1321 - Taylor Rose / @trose89

07/12/2012 at 10:02PM

55
#>1428 - Taylor Rose / @trose89

07/12/2012 at 09:59PM

75
#>1560 - Taylor Rose / @trose89

07/12/2012 at 09:41PM