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

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

1720 active golfers, 7023 entries

Solutions by @lopossumi:
36
#436 - Mikko Loponen / @lopossumi

11/02/2012 at 02:32PM

37
#>527 - Mikko Loponen / @lopossumi

11/02/2012 at 02:28PM

38
#>614 - Mikko Loponen / @lopossumi

11/02/2012 at 02:25PM

40
#>800 - Mikko Loponen / @lopossumi

11/02/2012 at 02:13PM

42
#>961 - Mikko Loponen / @lopossumi

10/22/2012 at 04:39PM

44
#>1098 - Mikko Loponen / @lopossumi

10/22/2012 at 04:35PM

45
#>1141 - Mikko Loponen / @lopossumi

10/22/2012 at 04:32PM

46
#>1195 - Mikko Loponen / @lopossumi

10/22/2012 at 04:26PM

146
#>1714 - Mikko Loponen / @lopossumi

10/22/2012 at 04:19PM