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

1762 active golfers, 7178 entries

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

10/20/2013 at 09:31AM

38
#>627 - Chris Ford / @ctford

10/20/2013 at 09:41AM

41
#>898 - Chris Ford / @ctford

10/20/2013 at 09:38AM

41
#>898 - Chris Ford / @ctford

10/20/2013 at 09:39AM

42
#>975 - Chris Ford / @ctford

10/20/2013 at 09:28AM

42
#>975 - Chris Ford / @ctford

10/20/2013 at 09:29AM

42
#>975 - Chris Ford / @ctford

10/20/2013 at 09:39AM

44
#>1116 - Chris Ford / @ctford

10/20/2013 at 09:25AM

45
#>1162 - Chris Ford / @ctford

10/20/2013 at 09:19AM

45
#>1162 - Chris Ford / @ctford

10/20/2013 at 09:21AM

46
#>1218 - Chris Ford / @ctford

10/20/2013 at 09:13AM

46
#>1218 - Chris Ford / @ctford

10/20/2013 at 09:24AM

47
#>1272 - Chris Ford / @ctford

10/20/2013 at 09:14AM

47
#>1272 - Chris Ford / @ctford

10/20/2013 at 09:15AM

48
#>1331 - Chris Ford / @ctford

10/20/2013 at 09:11AM

49
#>1368 - Chris Ford / @ctford

10/20/2013 at 09:09AM

49
#>1368 - Chris Ford / @ctford

10/20/2013 at 09:23AM

50
#>1402 - Chris Ford / @ctford

10/20/2013 at 09:07AM

51
#>1423 - Chris Ford / @ctford

10/20/2013 at 09:08AM

51
#>1423 - Chris Ford / @ctford

10/20/2013 at 09:12AM

52
#>1456 - Chris Ford / @ctford

10/20/2013 at 09:04AM

52
#>1456 - Chris Ford / @ctford

10/20/2013 at 09:13AM

56
#>1542 - Chris Ford / @ctford

10/20/2013 at 09:03AM

67
#>1650 - Chris Ford / @ctford

10/20/2013 at 09:01AM