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

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

1486 active golfers, 6033 entries

Solutions by @benzittlau:
32
#75 - Ben Zittlau / @benzittlau

11/17/2013 at 07:49PM

32
#>106 - Ben Zittlau / @benzittlau

09/06/2014 at 11:49PM

33
#>230 - Ben Zittlau / @benzittlau

11/17/2013 at 07:41PM

34
#>290 - Ben Zittlau / @benzittlau

11/17/2013 at 07:37PM

34
#>290 - Ben Zittlau / @benzittlau

11/17/2013 at 07:38PM

35
#>338 - Ben Zittlau / @benzittlau

11/17/2013 at 07:34PM

36
#>417 - Ben Zittlau / @benzittlau

11/17/2013 at 07:33PM

37
#>500 - Ben Zittlau / @benzittlau

11/17/2013 at 07:30PM

38
#>572 - Ben Zittlau / @benzittlau

11/17/2013 at 07:28PM

39
#>665 - Ben Zittlau / @benzittlau

11/17/2013 at 07:24PM

40
#>745 - Ben Zittlau / @benzittlau

11/17/2013 at 07:18PM

41
#>815 - Ben Zittlau / @benzittlau

11/17/2013 at 07:13PM

42
#>882 - Ben Zittlau / @benzittlau

11/17/2013 at 07:11PM

47
#>1147 - Ben Zittlau / @benzittlau

09/06/2014 at 11:41PM

49
#>1221 - Ben Zittlau / @benzittlau

11/17/2013 at 07:10PM

50
#>1245 - Ben Zittlau / @benzittlau

11/17/2013 at 07:07PM

52
#>1288 - Ben Zittlau / @benzittlau

11/17/2013 at 07:05PM

53
#>1309 - Ben Zittlau / @benzittlau

09/06/2014 at 11:41PM

54
#>1323 - Ben Zittlau / @benzittlau

11/17/2013 at 07:00PM

59
#>1384 - Ben Zittlau / @benzittlau

11/17/2013 at 06:58PM

62
#>1401 - Ben Zittlau / @benzittlau

09/06/2014 at 11:35PM

101
#>1475 - Ben Zittlau / @benzittlau

11/17/2013 at 06:53PM