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

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

1510 active golfers, 6121 entries

Solutions by @armandhalbert:
35
#335 - Armand Halbert / @armandhalbert

08/16/2013 at 08:46PM

36
#>418 - Armand Halbert / @armandhalbert

08/16/2013 at 08:31PM

37
#>498 - Armand Halbert / @armandhalbert

08/16/2013 at 09:08PM

38
#>570 - Armand Halbert / @armandhalbert

08/14/2013 at 05:44PM

40
#>745 - Armand Halbert / @armandhalbert

08/13/2013 at 04:57PM

41
#>820 - Armand Halbert / @armandhalbert

08/13/2013 at 04:54PM

41
#>820 - Armand Halbert / @armandhalbert

08/13/2013 at 04:56PM

43
#>941 - Armand Halbert / @armandhalbert

08/08/2013 at 08:59PM

46
#>1104 - Armand Halbert / @armandhalbert

08/13/2013 at 04:51PM

54
#>1341 - Armand Halbert / @armandhalbert

08/13/2013 at 04:50PM

70
#>1453 - Armand Halbert / @armandhalbert

08/08/2013 at 08:55PM