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

1889 active golfers, 7681 entries

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

09/02/2016 at 03:37AM

32
#>158 - Stephen Aument / @saument

09/02/2016 at 03:38AM

32
#>158 - Stephen Aument / @saument

09/02/2016 at 03:39AM

33
#>278 - Stephen Aument / @saument

09/02/2016 at 03:34AM

34
#>329 - Stephen Aument / @saument

09/02/2016 at 03:33AM

35
#>407 - Stephen Aument / @saument

09/02/2016 at 03:31AM

36
#>495 - Stephen Aument / @saument

09/02/2016 at 03:29AM

37
#>590 - Stephen Aument / @saument

09/02/2016 at 03:28AM

38
#>683 - Stephen Aument / @saument

09/02/2016 at 03:26AM

40
#>885 - Stephen Aument / @saument

09/02/2016 at 03:25AM

42
#>1051 - Stephen Aument / @saument

09/02/2016 at 03:24AM

44
#>1192 - Stephen Aument / @saument

09/02/2016 at 03:18AM

44
#>1192 - Stephen Aument / @saument

09/02/2016 at 03:20AM

45
#>1241 - Stephen Aument / @saument

09/02/2016 at 03:17AM

46
#>1292 - Stephen Aument / @saument

09/02/2016 at 03:16AM