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

The best way to learn is to practice. Below, you will find some of the solutions other golfers have entered. To unlock higher ranked solutions, submit your own entry which does as well or better than the solutions you can currently see - climb the ladder!

Check out these helpful resources to improve your Vim skills... Game on.

Unlock 1753 remaining solutions by signing in and submitting your own entry
#1754 Patrick Muldoon / @d00n - Score: 206 - 12/29/10 @ 15:12
<Esc>:<Up><Up><Up><Up><Up>g.<BS>/.*def.$<BS>*end.*/d<CR>:v/\S/f<BS>d<CR>fai*<Esc><Right><Right>cf))<Esc><Down><Left>i.join(',')<Esc>lldf:df"a"<Esc>=<Esc><Esc><BS><Up><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left>xxxxxi  <Down><Down><Esc>x<Up><Right>xx<Esc>:wq<CR>

0 comments


Created by: @igrigorik

1754 active golfers, 7154 entries

Leaderboard (lowest score wins):
32
#61 - Bradd Szonye / @bszonye

07/10/2013 at 08:37PM

32
#62 - ———đίxίє—flαтlίиє——— / @_dixie_flatline

07/20/2013 at 05:21PM

32
#63 - Maximiliano Padulo / @mpadulo

08/06/2013 at 08:53AM

32
#64 - joinvimgolf / @joinvimgolf

08/14/2013 at 07:09PM

32
#65 - Roman Charushin / @lompee

08/21/2013 at 08:58AM

32
#66 - Chris Webb / @chriswebb_42

08/21/2013 at 11:37PM

32
#67 - Jiří Chára / @JiriChara

08/22/2013 at 07:21AM

32
#68 - Stephen Drodge / @sjdrodge

08/24/2013 at 11:36PM

32
#69 - Sam Green / @magpi_

09/12/2013 at 12:02AM

32
#70 - StarkHalo / @hellektor

10/07/2013 at 06:32PM

32
#71 - Trần Lê Anh Minh / @lekima

10/13/2013 at 06:56AM

32
#72 - Song Zheng / @songz

10/15/2013 at 02:10AM

32
#73 - Robert Andersson / @StreamBag

10/23/2013 at 04:57AM

32
#74 - Francois Marais / @maraisf

11/06/2013 at 01:01PM

32
#75 - Jonathan Potter / @nTypeRed

11/11/2013 at 06:50PM

32
#76 - Ben Zittlau / @benzittlau

11/17/2013 at 07:49PM

32
#77 - digitalronin / @digitalronin

12/08/2013 at 10:49AM

32
#78 - Tim Smart / @tim_smart

12/10/2013 at 02:31AM

32
#79 - ynwsoft / @ynwsoft

12/12/2013 at 02:00PM

32
#80 - Paul Liu / @automorphism

12/18/2013 at 01:49PM

32
#81 - chilicuil / @chilicuil

12/27/2013 at 10:56AM

32
#82 - oliver mueller / @marcontwit

01/09/2014 at 09:13PM

32
#83 - alexscott / @4l3xsc0tt

01/15/2014 at 03:45PM

32
#84 - Christian Welle / @welle_tw

01/20/2014 at 09:37PM

32
#85 - Reese Wilson / @shinyvimgolf

02/03/2014 at 05:56AM

32
#86 - grey wolfs / @grey_wolfs

02/03/2014 at 11:31AM

32
#87 - Michael Morgan / @1n1n1s3

02/03/2014 at 06:08PM

32
#88 - Strabs / @artistavenue

02/05/2014 at 10:00AM

32
#89 - Pedro Santos / @pedrosans

02/13/2014 at 10:26PM

32
#90 - Jeremy Gold / @JeremyGold3

02/14/2014 at 08:22AM