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

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

1615 active golfers, 6558 entries

Solutions by @tanguyantoine:
42
#918 - Tanguy Antoine / @tanguyantoine

07/19/2012 at 01:11AM

42
#>918 - Tanguy Antoine / @tanguyantoine

07/19/2012 at 01:18AM

43
#>974 - Tanguy Antoine / @tanguyantoine

07/19/2012 at 01:04AM

48
#>1253 - Tanguy Antoine / @tanguyantoine

07/19/2012 at 12:55AM

49
#>1288 - Tanguy Antoine / @tanguyantoine

07/19/2012 at 12:48AM

53
#>1395 - Tanguy Antoine / @tanguyantoine

07/19/2012 at 12:31AM

53
#>1395 - Tanguy Antoine / @tanguyantoine

07/19/2012 at 12:45AM

54
#>1412 - Tanguy Antoine / @tanguyantoine

07/19/2012 at 12:03AM

55
#>1428 - Tanguy Antoine / @tanguyantoine

07/19/2012 at 12:26AM

55
#>1428 - Tanguy Antoine / @tanguyantoine

07/19/2012 at 12:27AM

57
#>1457 - Tanguy Antoine / @tanguyantoine

07/18/2012 at 11:36PM

59
#>1479 - Tanguy Antoine / @tanguyantoine

07/18/2012 at 11:49PM

129
#>1606 - Tanguy Antoine / @tanguyantoine

12/28/2010 at 10:52PM