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

1614 active golfers, 6557 entries

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

10/23/2012 at 06:43AM

32
#>52 - Kate / @Arohanui

04/29/2013 at 03:34AM

33
#>216 - Kate / @Arohanui

10/23/2012 at 06:35AM

33
#>221 - Kate / @Arohanui

04/29/2013 at 03:19AM

35
#>338 - Kate / @Arohanui

10/23/2012 at 06:26AM

35
#>341 - Kate / @Arohanui

04/27/2013 at 03:09AM

36
#>428 - Kate / @Arohanui

04/27/2013 at 02:45AM

37
#>508 - Kate / @Arohanui

10/23/2012 at 06:01AM

37
#>512 - Kate / @Arohanui

04/27/2013 at 02:38AM

42
#>922 - Kate / @Arohanui

04/27/2013 at 02:32AM

43
#>976 - Kate / @Arohanui

04/27/2013 at 02:29AM

44
#>1044 - Kate / @Arohanui

10/23/2012 at 05:01AM

45
#>1090 - Kate / @Arohanui

04/27/2013 at 02:25AM