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

1708 active golfers, 6984 entries

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

11/11/2013 at 06:50PM

33
#>236 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:48PM

34
#>300 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:44PM

35
#>357 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:43PM

37
#>536 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:38PM

38
#>620 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:33PM

39
#>718 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:27PM

43
#>1026 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:23PM

44
#>1101 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:22PM

49
#>1350 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:12PM

50
#>1385 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:09PM

51
#>1404 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:04PM

52
#>1435 - Jonathan Potter / @nTypeRed

11/11/2013 at 05:16PM

53
#>1459 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:03PM

54
#>1479 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:00PM

63
#>1592 - Jonathan Potter / @nTypeRed

11/11/2013 at 05:31PM