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

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

1872 active golfers, 7584 entries

Solutions by @Gullfaxi29:
34
#340 - Alex Barnett / @Gullfaxi29

01/09/2026 at 04:07AM

35
#>423 - Alex Barnett / @Gullfaxi29

01/09/2026 at 01:53AM

38
#>711 - Alex Barnett / @Gullfaxi29

01/09/2026 at 12:56AM

41
#>989 - Alex Barnett / @Gullfaxi29

01/08/2026 at 04:56AM

42
#>1065 - Alex Barnett / @Gullfaxi29

01/06/2026 at 05:49AM

51
#>1512 - Alex Barnett / @Gullfaxi29

01/06/2026 at 05:06AM

53
#>1567 - Alex Barnett / @Gullfaxi29

01/06/2026 at 04:54AM

68
#>1760 - Alex Barnett / @Gullfaxi29

01/05/2026 at 11:57PM