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

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

1482 active golfers, 6015 entries

Solutions by @igrigorik:
68
#1421 - Ilya Grigorik / @igrigorik

12/31/2010 at 08:07PM

76
#>1442 - Ilya Grigorik / @igrigorik

01/06/2011 at 05:16AM

78
#>1449 - Ilya Grigorik / @igrigorik

03/17/2012 at 07:12PM

83
#>1458 - Ilya Grigorik / @igrigorik

09/19/2012 at 05:52AM

85
#>1458 - Ilya Grigorik / @igrigorik

05/08/2011 at 06:25PM

97
#>1469 - Ilya Grigorik / @igrigorik

10/11/2014 at 05:10PM

106
#>1472 - Ilya Grigorik / @igrigorik

03/17/2011 at 07:45PM

129
#>1476 - Ilya Grigorik / @igrigorik

12/11/2011 at 05:56PM

131
#>1476 - Ilya Grigorik / @igrigorik

01/11/2013 at 06:30AM

161
#>1480 - Ilya Grigorik / @igrigorik

12/29/2010 at 04:28AM

166
#>1480 - Ilya Grigorik / @igrigorik

12/28/2010 at 06:55PM

172
#>1481 - Ilya Grigorik / @igrigorik

12/28/2010 at 10:24PM

174
#>1481 - Ilya Grigorik / @igrigorik

12/30/2010 at 05:08AM

259
#>1482 - Ilya Grigorik / @igrigorik

12/28/2010 at 06:59PM

281
#>1482 - Ilya Grigorik / @igrigorik

12/28/2010 at 10:25PM