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

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

1825 active golfers, 7389 entries

Solutions by @MadPigeon:
32
#182 - Vsevolod Rychkov / @MadPigeon

07/15/2025 at 02:11PM

33
#>277 - Vsevolod Rychkov / @MadPigeon

07/15/2025 at 02:06PM

34
#>331 - Vsevolod Rychkov / @MadPigeon

07/15/2025 at 01:52PM

35
#>412 - Vsevolod Rychkov / @MadPigeon

07/15/2025 at 01:23PM

41
#>970 - Vsevolod Rychkov / @MadPigeon

07/15/2025 at 01:14PM

42
#>1046 - Vsevolod Rychkov / @MadPigeon

07/15/2025 at 12:54PM

43
#>1105 - Vsevolod Rychkov / @MadPigeon

04/28/2025 at 07:32AM

47
#>1337 - Vsevolod Rychkov / @MadPigeon

04/28/2025 at 07:07AM