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

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

1614 active golfers, 6557 entries

Solutions by @cpatuzzo:
32
#40 - Chris Patuzzo / @cpatuzzo

11/03/2012 at 09:17PM

32
#>40 - Chris Patuzzo / @cpatuzzo

11/03/2012 at 09:24PM

33
#>216 - Chris Patuzzo / @cpatuzzo

11/03/2012 at 09:13PM

35
#>338 - Chris Patuzzo / @cpatuzzo

11/03/2012 at 09:11PM

36
#>422 - Chris Patuzzo / @cpatuzzo

11/03/2012 at 09:08PM

37
#>508 - Chris Patuzzo / @cpatuzzo

11/03/2012 at 09:06PM

38
#>589 - Chris Patuzzo / @cpatuzzo

11/03/2012 at 09:02PM

39
#>678 - Chris Patuzzo / @cpatuzzo

11/03/2012 at 08:31PM

40
#>766 - Chris Patuzzo / @cpatuzzo

10/23/2012 at 03:54PM

45
#>1087 - Chris Patuzzo / @cpatuzzo

11/03/2012 at 08:29PM

48
#>1255 - Chris Patuzzo / @cpatuzzo

10/23/2012 at 03:52PM