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

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

1790 active golfers, 7252 entries

Solutions by @kevincking1986:
33
#275 - kevincking1986 / @kevincking1986

03/24/2025 at 01:29PM

33
#>275 - kevincking1986 / @kevincking1986

03/24/2025 at 01:35PM

34
#>329 - kevincking1986 / @kevincking1986

03/24/2025 at 01:26PM

35
#>407 - kevincking1986 / @kevincking1986

03/24/2025 at 01:21PM

35
#>407 - kevincking1986 / @kevincking1986

03/24/2025 at 01:23PM

36
#>495 - kevincking1986 / @kevincking1986

03/24/2025 at 01:13PM

38
#>687 - kevincking1986 / @kevincking1986

03/24/2025 at 11:46AM

39
#>795 - kevincking1986 / @kevincking1986

03/24/2025 at 11:43AM

40
#>869 - kevincking1986 / @kevincking1986

03/24/2025 at 11:32AM

42
#>1030 - kevincking1986 / @kevincking1986

03/24/2025 at 11:24AM

44
#>1154 - kevincking1986 / @kevincking1986

03/23/2025 at 10:27PM

44
#>1154 - kevincking1986 / @kevincking1986

03/23/2025 at 11:14PM

47
#>1319 - kevincking1986 / @kevincking1986

03/23/2025 at 10:23PM

47
#>1319 - kevincking1986 / @kevincking1986

03/23/2025 at 11:07PM

51
#>1457 - kevincking1986 / @kevincking1986

03/23/2025 at 11:06PM

53
#>1509 - kevincking1986 / @kevincking1986

03/23/2025 at 10:16PM

53
#>1509 - kevincking1986 / @kevincking1986

03/23/2025 at 10:58PM

77
#>1725 - kevincking1986 / @kevincking1986

03/23/2025 at 10:14PM