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

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

1614 active golfers, 6557 entries

Solutions by @racc69:
36
#410 - Jason Then / @racc69

08/08/2011 at 01:28AM

37
#>489 - Jason Then / @racc69

08/08/2011 at 01:26AM

38
#>576 - Jason Then / @racc69

08/08/2011 at 01:25AM

39
#>658 - Jason Then / @racc69

08/08/2011 at 01:20AM

41
#>828 - Jason Then / @racc69

08/08/2011 at 01:15AM

42
#>906 - Jason Then / @racc69

08/08/2011 at 01:06AM

42
#>906 - Jason Then / @racc69

08/08/2011 at 01:10AM

43
#>969 - Jason Then / @racc69

08/08/2011 at 01:02AM

43
#>969 - Jason Then / @racc69

08/08/2011 at 01:24AM

45
#>1081 - Jason Then / @racc69

08/08/2011 at 01:07AM

49
#>1285 - Jason Then / @racc69

08/08/2011 at 12:36AM

49
#>1285 - Jason Then / @racc69

08/08/2011 at 01:00AM

49
#>1285 - Jason Then / @racc69

08/08/2011 at 01:01AM

62
#>1500 - Jason Then / @racc69

08/08/2011 at 12:35AM