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

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

1615 active golfers, 6558 entries

Solutions by @ctford:
38
#598 - Chris Ford / @ctford

10/20/2013 at 09:31AM

38
#>598 - Chris Ford / @ctford

10/20/2013 at 09:41AM

41
#>853 - Chris Ford / @ctford

10/20/2013 at 09:38AM

41
#>853 - Chris Ford / @ctford

10/20/2013 at 09:39AM

42
#>924 - Chris Ford / @ctford

10/20/2013 at 09:28AM

42
#>924 - Chris Ford / @ctford

10/20/2013 at 09:29AM

42
#>924 - Chris Ford / @ctford

10/20/2013 at 09:39AM

44
#>1051 - Chris Ford / @ctford

10/20/2013 at 09:25AM

45
#>1095 - Chris Ford / @ctford

10/20/2013 at 09:19AM

45
#>1095 - Chris Ford / @ctford

10/20/2013 at 09:21AM

46
#>1150 - Chris Ford / @ctford

10/20/2013 at 09:13AM

46
#>1150 - Chris Ford / @ctford

10/20/2013 at 09:24AM

47
#>1202 - Chris Ford / @ctford

10/20/2013 at 09:14AM

47
#>1202 - Chris Ford / @ctford

10/20/2013 at 09:15AM

48
#>1259 - Chris Ford / @ctford

10/20/2013 at 09:11AM

49
#>1295 - Chris Ford / @ctford

10/20/2013 at 09:09AM

49
#>1295 - Chris Ford / @ctford

10/20/2013 at 09:23AM

50
#>1325 - Chris Ford / @ctford

10/20/2013 at 09:07AM

51
#>1344 - Chris Ford / @ctford

10/20/2013 at 09:08AM

51
#>1344 - Chris Ford / @ctford

10/20/2013 at 09:12AM

52
#>1374 - Chris Ford / @ctford

10/20/2013 at 09:04AM

52
#>1374 - Chris Ford / @ctford

10/20/2013 at 09:13AM

56
#>1444 - Chris Ford / @ctford

10/20/2013 at 09:03AM

67
#>1530 - Chris Ford / @ctford

10/20/2013 at 09:01AM