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

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

1603 active golfers, 6512 entries

Solutions by @stefanlz:
33
#233 - Stefan Leszkiewicz / @stefanlz

11/17/2013 at 12:15AM

34
#>288 - Stefan Leszkiewicz / @stefanlz

02/17/2013 at 02:06AM

34
#>289 - Stefan Leszkiewicz / @stefanlz

04/26/2013 at 01:10PM

35
#>338 - Stefan Leszkiewicz / @stefanlz

02/17/2013 at 01:56AM

36
#>423 - Stefan Leszkiewicz / @stefanlz

02/17/2013 at 01:54AM

37
#>508 - Stefan Leszkiewicz / @stefanlz

02/17/2013 at 01:53AM

38
#>587 - Stefan Leszkiewicz / @stefanlz

02/17/2013 at 01:43AM

40
#>764 - Stefan Leszkiewicz / @stefanlz

02/17/2013 at 01:26AM

41
#>851 - Stefan Leszkiewicz / @stefanlz

11/17/2013 at 12:13AM

43
#>973 - Stefan Leszkiewicz / @stefanlz

02/17/2013 at 02:10AM

45
#>1084 - Stefan Leszkiewicz / @stefanlz

02/17/2013 at 01:15AM

46
#>1141 - Stefan Leszkiewicz / @stefanlz

02/17/2013 at 01:08AM

57
#>1448 - Stefan Leszkiewicz / @stefanlz

04/29/2012 at 09:50AM

60
#>1481 - Stefan Leszkiewicz / @stefanlz

04/26/2013 at 01:04PM

74
#>1545 - Stefan Leszkiewicz / @stefanlz

03/25/2012 at 12:55AM

91
#>1578 - Stefan Leszkiewicz / @stefanlz

03/25/2012 at 01:01AM

97
#>1585 - Stefan Leszkiewicz / @stefanlz

03/25/2012 at 01:26AM