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

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

1825 active golfers, 7415 entries

Solutions by @Arohanui:
32
#42 - Kate / @Arohanui

10/23/2012 at 06:43AM

32
#>55 - Kate / @Arohanui

04/29/2013 at 03:34AM

33
#>226 - Kate / @Arohanui

10/23/2012 at 06:35AM

33
#>231 - Kate / @Arohanui

04/29/2013 at 03:19AM

35
#>357 - Kate / @Arohanui

10/23/2012 at 06:26AM

35
#>360 - Kate / @Arohanui

04/27/2013 at 03:09AM

36
#>456 - Kate / @Arohanui

04/27/2013 at 02:45AM

37
#>543 - Kate / @Arohanui

10/23/2012 at 06:01AM

37
#>547 - Kate / @Arohanui

04/27/2013 at 02:38AM

42
#>997 - Kate / @Arohanui

04/27/2013 at 02:32AM

43
#>1057 - Kate / @Arohanui

04/27/2013 at 02:29AM

44
#>1133 - Kate / @Arohanui

10/23/2012 at 05:01AM

45
#>1184 - Kate / @Arohanui

04/27/2013 at 02:25AM