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

1614 active golfers, 6557 entries

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

02/03/2014 at 06:08PM

33
#>235 - Michael Morgan / @1n1n1s3

02/03/2014 at 06:07PM

34
#>298 - Michael Morgan / @1n1n1s3

02/03/2014 at 06:05PM

35
#>354 - Michael Morgan / @1n1n1s3

02/03/2014 at 06:04PM

36
#>435 - Michael Morgan / @1n1n1s3

02/03/2014 at 06:03PM

37
#>522 - Michael Morgan / @1n1n1s3

02/03/2014 at 05:57PM

39
#>696 - Michael Morgan / @1n1n1s3

02/03/2014 at 05:54PM

39
#>696 - Michael Morgan / @1n1n1s3

02/03/2014 at 05:55PM

40
#>783 - Michael Morgan / @1n1n1s3

02/03/2014 at 05:52PM

41
#>861 - Michael Morgan / @1n1n1s3

02/03/2014 at 05:51PM

43
#>986 - Michael Morgan / @1n1n1s3

02/03/2014 at 05:49PM

47
#>1208 - Michael Morgan / @1n1n1s3

02/03/2014 at 05:45PM

48
#>1260 - Michael Morgan / @1n1n1s3

02/03/2014 at 05:43PM

49
#>1286 - Michael Morgan / @1n1n1s3

11/28/2011 at 08:35PM

54
#>1411 - Michael Morgan / @1n1n1s3

11/28/2011 at 08:31PM