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

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

1486 active golfers, 6033 entries

Solutions by @maraisf:
32
#73 - François Marais / @maraisf

11/06/2013 at 01:01PM

33
#>229 - François Marais / @maraisf

11/06/2013 at 01:00PM

34
#>289 - François Marais / @maraisf

11/06/2013 at 12:58PM

35
#>337 - François Marais / @maraisf

11/02/2013 at 01:24PM

36
#>417 - François Marais / @maraisf

11/02/2013 at 01:21PM

37
#>500 - François Marais / @maraisf

11/02/2013 at 01:19PM

38
#>572 - François Marais / @maraisf

11/02/2013 at 01:17PM

39
#>662 - François Marais / @maraisf

11/02/2013 at 01:16PM

40
#>744 - François Marais / @maraisf

11/02/2013 at 01:14PM

41
#>814 - François Marais / @maraisf

11/02/2013 at 01:13PM

43
#>935 - François Marais / @maraisf

11/02/2013 at 01:11PM

45
#>1042 - François Marais / @maraisf

11/02/2013 at 01:09PM

46
#>1092 - François Marais / @maraisf

11/02/2013 at 01:06PM

47
#>1138 - François Marais / @maraisf

11/01/2013 at 02:18AM