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 4d1b4ac3c58eaa2a8a0005c2

Ruby 1.9 compat

Remember when Ruby supported `when <expr> :`? Well, it doesn't in 1.9, so let's make sure we use `then`, without ruining our lovely new hash syntax!

Start file
#!/usr/bin/env ruby

class Klass
  ITEMS = {
    foo: ["bar", "baz"],
    lorem: "ipsum",
  }

  def initialize(args)
    @item = case args.first
    when :foo, :bar: ITEMS[:foo][1]
    when :lorem    : ITEMS[:lorem]
    end
  end
end
End file
#!/usr/bin/env ruby

class Klass
  ITEMS = {
    foo: ["bar", "baz"],
    lorem: "ipsum",
  }

  def initialize(args)
    @item = case args.first
    when :foo, :bar then ITEMS[:foo][1]
    when :lorem     then ITEMS[:lorem]
    end
  end
end

View Diff

11,12c11,12
<     when :foo, :bar: ITEMS[:foo][1]
<     when :lorem    : ITEMS[:lorem]
---
>     when :foo, :bar then ITEMS[:foo][1]
>     when :lorem     then ITEMS[:lorem]

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 206 remaining solutions by signing in and submitting your own entry
#207 Ben Bayard / @partyfists - Score: 174 - 12/29/10 @ 18:47
<Down><Down><Down><Down><Down><Down><Down><Down><Down><Down><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><BS><Right>i<BS> then<Down><Left><Left><Left><Left><BS>theb=<BS><BS>m<BS>n<Left><Left><Left><Left><Left><Right> !Q<BS><BS><Esc>:wq<CR>

0 comments


Created by: @lee_jarvis

207 active golfers, 545 entries

Leaderboard (lowest score wins):
14
#1 - Tom Adams / @holizz

12/29/2010 at 04:00PM

14
#2 - Leonard Chin / @lchin

12/29/2010 at 04:02PM

14
#3 - Indrek Juhkam / @indrekj

12/29/2010 at 04:04PM

14
#4 - Marian Schubert / @MarianSchubert

12/29/2010 at 04:16PM

14
#5 - Austin Taylor / @austintaylor

12/29/2010 at 08:09PM

14
#6 - Akira Matsuda / @a_matsuda

12/29/2010 at 08:31PM

14
#7 - Alex / @eskanete

12/30/2010 at 02:44PM

14
#8 - Matthew Draper / @_matthewd

12/31/2010 at 05:42PM

14
#9 - Mattiassich Ákos / @mattiassicha

01/02/2011 at 03:36PM

14
#10 - Wei Dai / @clvv42

01/02/2011 at 11:46PM

14
#11 - dominique pellé / @vimgolfisto

01/04/2011 at 11:40PM

14
#12 - Ujjwol Lamichhane / @Ujjwol

01/06/2011 at 01:16PM

14
#13 - Tim Chase / @gumnos

01/07/2011 at 11:54PM

14
#14 - Balkoth / @_Balkoth_

01/08/2011 at 06:09PM

14
#15 - Federico Galassi / @federicogalassi

01/17/2011 at 09:27PM

14
#16 - Oleg Roshupkin / @jjjahson

01/20/2011 at 04:11PM

14
#17 - xhtmlforum / @xhtmlforum

01/25/2011 at 03:20PM

14
#18 - dtennant / @dtennant

06/09/2011 at 03:30PM

14
#19 - Justin Love / @wondible

06/15/2011 at 04:31PM

14
#20 - (Emile (Swarts)) / @EmileSwarts

06/25/2011 at 11:42AM

14
#21 - not so punk :] / @notsopunk

06/26/2011 at 03:42AM

14
#22 - Sammasati / @sammasati0

07/16/2011 at 04:54PM

14
#23 - Andrey Ivanov / @Bytamine

08/11/2011 at 03:40PM

14
#24 - You-Siang Lin / @yslinnctu

11/30/2011 at 01:56PM

14
#25 - William Dunand / @wdunand

12/02/2011 at 06:48AM

14
#26 - Pei-Lun Lee / @ypcatw

01/08/2012 at 04:57AM

14
#27 - Renat Aksitov / @Korvin79

02/09/2012 at 08:25AM

14
#28 - Vasil Sakarov / @vsakarov

02/17/2012 at 08:42PM

14
#29 - 無ん垢の叫び / @john_ababa

02/23/2012 at 10:07AM

14
#30 - kjrn / @kjrnleto

03/26/2012 at 06:41PM