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

1756 active golfers, 7160 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
#>301 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:44PM

35
#>360 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:43PM

37
#>541 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:38PM

38
#>627 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:33PM

39
#>729 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:27PM

43
#>1037 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:23PM

44
#>1113 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:22PM

49
#>1365 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:12PM

50
#>1400 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:09PM

51
#>1421 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:04PM

52
#>1453 - Jonathan Potter / @nTypeRed

11/11/2013 at 05:16PM

53
#>1479 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:03PM

54
#>1501 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:00PM

63
#>1622 - Jonathan Potter / @nTypeRed

11/11/2013 at 05:31PM