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

1614 active golfers, 6557 entries

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

09/02/2016 at 03:37AM

32
#>147 - Stephen Aument / @saument

09/02/2016 at 03:38AM

32
#>147 - Stephen Aument / @saument

09/02/2016 at 03:39AM

33
#>258 - Stephen Aument / @saument

09/02/2016 at 03:34AM

34
#>308 - Stephen Aument / @saument

09/02/2016 at 03:33AM

35
#>373 - Stephen Aument / @saument

09/02/2016 at 03:31AM

36
#>451 - Stephen Aument / @saument

09/02/2016 at 03:29AM

37
#>539 - Stephen Aument / @saument

09/02/2016 at 03:28AM

38
#>620 - Stephen Aument / @saument

09/02/2016 at 03:26AM

40
#>798 - Stephen Aument / @saument

09/02/2016 at 03:25AM

42
#>948 - Stephen Aument / @saument

09/02/2016 at 03:24AM

44
#>1068 - Stephen Aument / @saument

09/02/2016 at 03:18AM

44
#>1068 - Stephen Aument / @saument

09/02/2016 at 03:20AM

45
#>1110 - Stephen Aument / @saument

09/02/2016 at 03:17AM

46
#>1158 - Stephen Aument / @saument

09/02/2016 at 03:16AM