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 210 remaining solutions by signing in and submitting your own entry
#211 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

211 active golfers, 557 entries

Leaderboard (lowest score wins):
15
#61 - Marian Schubert / @MarianSchubert

12/29/2010 at 04:10PM

15
#62 - Lee Jarvis / @lee_jarvis

12/29/2010 at 04:20PM

15
#63 - Aaron Bull Schaefer / @elasticdog

12/29/2010 at 04:38PM

15
#64 - Daniel Chcouri / @daniel_chcouri

12/29/2010 at 04:54PM

15
#65 - Steve Morrow / @yawmark

12/29/2010 at 06:19PM

15
#66 - Adam Pohorecki / @apohorecki

12/29/2010 at 08:12PM

15
#67 - kuhout / @kuhout

12/29/2010 at 08:19PM

15
#68 - uuu / @uu59

12/29/2010 at 10:05PM

15
#69 - Douglas Stockwell / @dstockwell

12/30/2010 at 01:21AM

15
#70 - Addisu Taddese / @azeey

12/30/2010 at 07:37AM

15
#71 - Ben Lenarts / @benlenarts

12/30/2010 at 11:18AM

15
#72 - Israel Chauca F. / @Raimondi

01/01/2011 at 09:35PM

15
#73 - Ben Brown / @benofbrown

01/09/2011 at 12:16PM

15
#74 - Francisco Dibar / @frandibar

01/14/2011 at 03:14AM

15
#75 - duckdalbe / @duckdalbe

01/14/2011 at 12:23PM

15
#76 - Pete Johns / @johnsyweb

01/15/2011 at 02:57AM

15
#77 - h_east (トロッコ6個) / @h_east

01/16/2011 at 09:02AM

15
#78 - Andrey A. Ugolnik / @andreyugolnik

01/20/2011 at 02:02AM

15
#79 - Thomas Schönwälder / @Masei1988

01/22/2011 at 09:52PM

15
#80 - vg / @vimgolfer

01/29/2011 at 03:11AM

15
#81 - Wesley Wong / @wesleymwwong

01/30/2011 at 10:40AM

15
#82 - Ravil Bayramgalin / @brainopia

02/12/2011 at 05:01PM

15
#83 - Eivind Jahren / @HaskellElephant

02/21/2011 at 05:37PM

15
#84 - Dragan Cvetinovic / @kawkafi

05/08/2011 at 06:24PM

15
#85 - Hu Junfeng / @junfeng

07/17/2011 at 02:16PM

15
#86 - Jim Infield / @jinfield

07/20/2011 at 11:39PM

15
#87 - Tyler Wymer / @twymer

10/14/2011 at 12:08AM

15
#88 - Trevor Powell / @DoomedBunnies

11/29/2011 at 06:50AM

15
#89 - Xavier Nayrac / @lkdjiin

12/30/2011 at 10:51AM

15
#90 - GiaNU / @sgianazza

02/04/2012 at 12:07AM