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

1621 active golfers, 6603 entries

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

09/07/2017 at 06:33PM

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

09/07/2017 at 06:31PM

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

09/07/2017 at 06:30PM

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

09/07/2017 at 06:25PM

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

09/07/2017 at 06:24PM

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

09/07/2017 at 06:23PM

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

09/07/2017 at 06:21PM

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

09/07/2017 at 06:20PM

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

09/07/2017 at 06:15PM

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

09/07/2017 at 06:12PM

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

09/07/2017 at 06:11PM

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

09/07/2017 at 06:09PM