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):
35
#331 - h_east (トロッコ6個) / @h_east

01/17/2011 at 12:59AM

35
#332 - Antony Scriven / @antonyscriven

02/05/2011 at 08:23PM

35
#333 - Mark Scholtz / @markscholtz

02/07/2011 at 08:17PM

35
#334 - David / @dpa_92

08/01/2011 at 09:09AM

35
#335 - William Dunand / @wdunand

12/13/2011 at 05:50AM

35
#336 - Paul Bourke / @brk3

12/13/2011 at 02:52PM

35
#337 - Sergio Benitez / @Sergio965

01/30/2012 at 06:50PM

35
#338 - Aaron Spiegel / @spiegela

02/05/2012 at 01:36AM

35
#339 - snuffling / @snuffling

02/12/2012 at 08:58PM

35
#340 - フルメキ / @hurumeki

03/24/2012 at 12:48AM

35
#341 - Einar Jónsson / @einarj

03/30/2012 at 03:58PM

35
#342 - Rubén Laguna / @ecerulm

04/21/2012 at 07:45AM

35
#343 - Rodrigo Ayala / @RodrigoAyala

05/15/2012 at 05:49PM

35
#344 - OMF / @exolon

05/25/2012 at 10:45PM

35
#345 - shark dick / @DickShark

07/12/2012 at 09:10PM

35
#346 - wes / @_weslly

07/16/2012 at 03:20PM

35
#347 - Dan Oneata / @DanOneata

08/04/2012 at 04:32PM

35
#348 - vansan / @VinceVansan

08/23/2012 at 11:22AM

35
#349 - Mats Sigge / @MatsSigge

09/29/2012 at 10:11AM

35
#350 - Tamás Kárándi / @tkarandi

12/02/2012 at 08:57PM

35
#351 - Satoshi Matsumoto / @kaorimatz

12/22/2012 at 03:39AM

35
#352 - Kuldeep Bora / @kuldeep_bora

04/17/2013 at 07:57AM

35
#353 - Eric Potter / @pottereric

06/05/2013 at 04:33PM

35
#354 - Arthur LEDARD / @arthur_yaal

06/27/2013 at 04:49PM

35
#355 - RobertT / @techrt2050

07/11/2013 at 10:21AM

35
#356 - Roland Schatz / @fl_Overmind

07/12/2013 at 02:54PM

35
#357 - Armand Halbert / @armandhalbert

08/16/2013 at 08:46PM

35
#358 - Colin Garriga-Salaün / @cgarrigasalaun

09/26/2013 at 07:25PM

35
#359 - atemeresclencare / @kfzhyzdj

09/30/2013 at 06:52AM

35
#360 - omonsaboliturisl / @rarylverwaffelp

09/30/2013 at 07:08AM