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 @42__kevin:

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

1615 active golfers, 6558 entries

Solutions by @42__kevin:
43
#981 - Kevin Etienne / @42__kevin

08/18/2013 at 06:45PM

44
#>1050 - Kevin Etienne / @42__kevin

08/18/2013 at 06:43PM

51
#>1344 - Kevin Etienne / @42__kevin

08/18/2013 at 06:40PM

52
#>1368 - Kevin Etienne / @42__kevin

07/10/2012 at 09:52PM

53
#>1395 - Kevin Etienne / @42__kevin

07/10/2012 at 09:48PM

54
#>1412 - Kevin Etienne / @42__kevin

07/05/2012 at 10:15PM

55
#>1430 - Kevin Etienne / @42__kevin

08/18/2013 at 06:37PM

57
#>1457 - Kevin Etienne / @42__kevin

07/02/2012 at 11:12PM