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

1706 active golfers, 6982 entries

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

11/17/2013 at 07:49PM

32
#>107 - Ben Zittlau / @benzittlau

09/06/2014 at 11:49PM

33
#>237 - Ben Zittlau / @benzittlau

11/17/2013 at 07:41PM

34
#>300 - Ben Zittlau / @benzittlau

11/17/2013 at 07:37PM

34
#>300 - Ben Zittlau / @benzittlau

11/17/2013 at 07:38PM

35
#>358 - Ben Zittlau / @benzittlau

11/17/2013 at 07:34PM

36
#>445 - Ben Zittlau / @benzittlau

11/17/2013 at 07:33PM

37
#>536 - Ben Zittlau / @benzittlau

11/17/2013 at 07:30PM

38
#>620 - Ben Zittlau / @benzittlau

11/17/2013 at 07:28PM

39
#>719 - Ben Zittlau / @benzittlau

11/17/2013 at 07:24PM

40
#>808 - Ben Zittlau / @benzittlau

11/17/2013 at 07:18PM

41
#>887 - Ben Zittlau / @benzittlau

11/17/2013 at 07:13PM

42
#>963 - Ben Zittlau / @benzittlau

11/17/2013 at 07:11PM

47
#>1263 - Ben Zittlau / @benzittlau

09/06/2014 at 11:41PM

49
#>1350 - Ben Zittlau / @benzittlau

11/17/2013 at 07:10PM

50
#>1384 - Ben Zittlau / @benzittlau

11/17/2013 at 07:07PM

52
#>1434 - Ben Zittlau / @benzittlau

11/17/2013 at 07:05PM

53
#>1459 - Ben Zittlau / @benzittlau

09/06/2014 at 11:41PM

54
#>1477 - Ben Zittlau / @benzittlau

11/17/2013 at 07:00PM

59
#>1554 - Ben Zittlau / @benzittlau

11/17/2013 at 06:58PM

62
#>1579 - Ben Zittlau / @benzittlau

09/06/2014 at 11:35PM

101
#>1688 - Ben Zittlau / @benzittlau

11/17/2013 at 06:53PM