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

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

1615 active golfers, 6558 entries

Solutions by @GitNick:
32
#34 - Nicholas Clark / @GitNick

09/18/2012 at 10:37PM

33
#>214 - Nicholas Clark / @GitNick

09/18/2012 at 07:00PM

33
#>214 - Nicholas Clark / @GitNick

09/18/2012 at 10:29PM

34
#>284 - Nicholas Clark / @GitNick

09/18/2012 at 06:48PM

34
#>284 - Nicholas Clark / @GitNick

09/18/2012 at 10:42PM

35
#>337 - Nicholas Clark / @GitNick

09/18/2012 at 06:25PM

36
#>421 - Nicholas Clark / @GitNick

09/18/2012 at 06:18PM

39
#>675 - Nicholas Clark / @GitNick

09/18/2012 at 06:10PM

40
#>764 - Nicholas Clark / @GitNick

09/18/2012 at 06:05PM

42
#>919 - Nicholas Clark / @GitNick

09/18/2012 at 06:04PM

43
#>975 - Nicholas Clark / @GitNick

09/18/2012 at 05:57PM

44
#>1043 - Nicholas Clark / @GitNick

09/18/2012 at 05:37PM

46
#>1140 - Nicholas Clark / @GitNick

09/18/2012 at 05:34PM

65
#>1518 - Nicholas Clark / @GitNick

09/18/2012 at 05:25PM