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

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

1762 active golfers, 7178 entries

Solutions by @saument:
32
#148 - Stephen Aument / @saument

09/02/2016 at 03:37AM

32
#>148 - Stephen Aument / @saument

09/02/2016 at 03:38AM

32
#>148 - Stephen Aument / @saument

09/02/2016 at 03:39AM

33
#>262 - Stephen Aument / @saument

09/02/2016 at 03:34AM

34
#>313 - Stephen Aument / @saument

09/02/2016 at 03:33AM

35
#>384 - Stephen Aument / @saument

09/02/2016 at 03:31AM

36
#>468 - Stephen Aument / @saument

09/02/2016 at 03:29AM

37
#>561 - Stephen Aument / @saument

09/02/2016 at 03:28AM

38
#>649 - Stephen Aument / @saument

09/02/2016 at 03:26AM

40
#>840 - Stephen Aument / @saument

09/02/2016 at 03:25AM

42
#>999 - Stephen Aument / @saument

09/02/2016 at 03:24AM

44
#>1133 - Stephen Aument / @saument

09/02/2016 at 03:18AM

44
#>1133 - Stephen Aument / @saument

09/02/2016 at 03:20AM

45
#>1177 - Stephen Aument / @saument

09/02/2016 at 03:17AM

46
#>1226 - Stephen Aument / @saument

09/02/2016 at 03:16AM