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

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

1486 active golfers, 6033 entries

Solutions by @nTypeRed:
32
#74 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:50PM

33
#>229 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:48PM

34
#>290 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:44PM

35
#>337 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:43PM

37
#>500 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:38PM

38
#>572 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:33PM

39
#>664 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:27PM

43
#>935 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:23PM

44
#>1000 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:22PM

49
#>1221 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:12PM

50
#>1245 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:09PM

51
#>1263 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:04PM

52
#>1288 - Jonathan Potter / @nTypeRed

11/11/2013 at 05:16PM

53
#>1308 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:03PM

54
#>1323 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:00PM

63
#>1408 - Jonathan Potter / @nTypeRed

11/11/2013 at 05:31PM