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 @1n1n1s3:

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

1486 active golfers, 6033 entries

Solutions by @1n1n1s3:
32
#86 - Michael Morgan / @1n1n1s3

02/03/2014 at 06:08PM

33
#>232 - Michael Morgan / @1n1n1s3

02/03/2014 at 06:07PM

34
#>292 - Michael Morgan / @1n1n1s3

02/03/2014 at 06:05PM

35
#>342 - Michael Morgan / @1n1n1s3

02/03/2014 at 06:04PM

36
#>420 - Michael Morgan / @1n1n1s3

02/03/2014 at 06:03PM

37
#>503 - Michael Morgan / @1n1n1s3

02/03/2014 at 05:57PM

39
#>667 - Michael Morgan / @1n1n1s3

02/03/2014 at 05:54PM

39
#>667 - Michael Morgan / @1n1n1s3

02/03/2014 at 05:55PM

40
#>750 - Michael Morgan / @1n1n1s3

02/03/2014 at 05:52PM

41
#>822 - Michael Morgan / @1n1n1s3

02/03/2014 at 05:51PM

43
#>938 - Michael Morgan / @1n1n1s3

02/03/2014 at 05:49PM

47
#>1144 - Michael Morgan / @1n1n1s3

02/03/2014 at 05:45PM

48
#>1190 - Michael Morgan / @1n1n1s3

02/03/2014 at 05:43PM

49
#>1212 - Michael Morgan / @1n1n1s3

11/28/2011 at 08:35PM

54
#>1322 - Michael Morgan / @1n1n1s3

11/28/2011 at 08:31PM