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

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

1602 active golfers, 6511 entries

Solutions by @dimkino:
33
#262 - Дима / @dimkino

09/07/2017 at 06:33PM

34
#>307 - Дима / @dimkino

09/07/2017 at 06:31PM

35
#>372 - Дима / @dimkino

09/07/2017 at 06:30PM

36
#>453 - Дима / @dimkino

09/07/2017 at 06:25PM

37
#>538 - Дима / @dimkino

09/07/2017 at 06:24PM

38
#>622 - Дима / @dimkino

09/07/2017 at 06:23PM

40
#>795 - Дима / @dimkino

09/07/2017 at 06:21PM

42
#>948 - Дима / @dimkino

09/07/2017 at 06:20PM

44
#>1066 - Дима / @dimkino

09/07/2017 at 06:15PM

45
#>1108 - Дима / @dimkino

09/07/2017 at 06:12PM

46
#>1158 - Дима / @dimkino

09/07/2017 at 06:11PM

49
#>1293 - Дима / @dimkino

09/07/2017 at 06:09PM