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

1603 active golfers, 6512 entries

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

11/11/2013 at 06:50PM

33
#>232 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:48PM

34
#>295 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:44PM

35
#>347 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:43PM

37
#>516 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:38PM

38
#>595 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:33PM

39
#>690 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:27PM

43
#>980 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:23PM

44
#>1048 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:22PM

49
#>1288 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:12PM

50
#>1319 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:09PM

51
#>1338 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:04PM

52
#>1366 - Jonathan Potter / @nTypeRed

11/11/2013 at 05:16PM

53
#>1388 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:03PM

54
#>1404 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:00PM

63
#>1503 - Jonathan Potter / @nTypeRed

11/11/2013 at 05:31PM