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

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

1889 active golfers, 7681 entries

Solutions by @GavinKoeng:
28
#10 - Gavin / @GavinKoeng

07/13/2026 at 09:04AM

32
#>193 - Gavin / @GavinKoeng

07/13/2026 at 09:02AM

33
#>289 - Gavin / @GavinKoeng

07/13/2026 at 09:02AM

34
#>349 - Gavin / @GavinKoeng

07/13/2026 at 09:01AM

35
#>432 - Gavin / @GavinKoeng

07/13/2026 at 09:00AM

37
#>627 - Gavin / @GavinKoeng

07/13/2026 at 08:56AM

38
#>723 - Gavin / @GavinKoeng

07/13/2026 at 08:53AM

39
#>834 - Gavin / @GavinKoeng

07/13/2026 at 08:52AM

40
#>909 - Gavin / @GavinKoeng

07/13/2026 at 08:50AM

42
#>1078 - Gavin / @GavinKoeng

07/13/2026 at 08:49AM

44
#>1210 - Gavin / @GavinKoeng

07/13/2026 at 08:47AM

46
#>1316 - Gavin / @GavinKoeng

07/13/2026 at 08:44AM

47
#>1383 - Gavin / @GavinKoeng

07/13/2026 at 08:47AM

49
#>1469 - Gavin / @GavinKoeng

07/13/2026 at 08:42AM

50
#>1497 - Gavin / @GavinKoeng

07/13/2026 at 08:43AM

76
#>1812 - Gavin / @GavinKoeng

07/13/2026 at 08:43AM