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

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

1759 active golfers, 7171 entries

Solutions by @Benoit_Mortgat:
35
#386 - Benoit Mortgat / @Benoit_Mortgat

11/14/2017 at 10:49AM

36
#>473 - Benoit Mortgat / @Benoit_Mortgat

11/14/2017 at 10:41AM

37
#>563 - Benoit Mortgat / @Benoit_Mortgat

11/14/2017 at 09:20AM

39
#>756 - Benoit Mortgat / @Benoit_Mortgat

11/14/2017 at 09:17AM

40
#>840 - Benoit Mortgat / @Benoit_Mortgat

11/14/2017 at 09:13AM

40
#>840 - Benoit Mortgat / @Benoit_Mortgat

11/14/2017 at 09:16AM

40
#>840 - Benoit Mortgat / @Benoit_Mortgat

11/14/2017 at 09:16AM

40
#>840 - Benoit Mortgat / @Benoit_Mortgat

11/14/2017 at 09:17AM

41
#>922 - Benoit Mortgat / @Benoit_Mortgat

11/14/2017 at 09:10AM

42
#>1002 - Benoit Mortgat / @Benoit_Mortgat

11/14/2017 at 09:07AM

44
#>1134 - Benoit Mortgat / @Benoit_Mortgat

11/14/2017 at 09:06AM

48
#>1342 - Benoit Mortgat / @Benoit_Mortgat

11/14/2017 at 09:05AM

52
#>1465 - Benoit Mortgat / @Benoit_Mortgat

11/14/2017 at 09:04AM