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 50bda7a73645b3000200004b

lamb had a little Mary

"Mary" and "lamb" are swapped. Unswap them. Fast as you can.

Start file
lamb had a little Mary,
Whose fleece was white as snow.
And everywhere that lamb went,
The Mary was sure to go.

It followed her to school one day,
Which was against the rule.
It made the children laugh and play,
To see a Mary at school.

And so the teacher turned it out,
But still it lingered near,
And waited patiently about,
Till lamb did appear.

"Why does the Mary love lamb so?"
The eager children cry.
"Why, lamb loves the Mary, you know."
The teacher did reply.
End file
Mary had a little lamb,
Whose fleece was white as snow.
And everywhere that Mary went,
The lamb was sure to go.

It followed her to school one day,
Which was against the rule.
It made the children laugh and play,
To see a lamb at school.

And so the teacher turned it out,
But still it lingered near,
And waited patiently about,
Till Mary did appear.

"Why does the lamb love Mary so?"
The eager children cry.
"Why, Mary loves the lamb, you know."
The teacher did reply.

View Diff

1c1
< lamb had a little Mary,
---
> Mary had a little lamb,
3,4c3,4
< And everywhere that lamb went,
< The Mary was sure to go.
---
> And everywhere that Mary went,
> The lamb was sure to go.
9c9
< To see a Mary at school.
---
> To see a lamb at school.
14c14
< Till lamb did appear.
---
> Till Mary did appear.
16c16
< "Why does the Mary love lamb so?"
---
> "Why does the lamb love Mary so?"
18c18
< "Why, lamb loves the Mary, you know."
---
> "Why, Mary loves the lamb, you know."

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 145 remaining solutions by signing in and submitting your own entry
#146 infinitekh / @infinitekh - Score: 121 - 12/11/12 @ 16:29
:%s/lamb/temmmmm<BS><BS><BS><BS><BS><BS><BS>tteemmpp/g<CR>:<Up><Left><Right><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS>Mary/lamb/g<CR>:<Up><Up><Left><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><BS><BS><Left><Left><Left><Left><Left><Left><Left><Left><BS><BS><BS><BS><BS><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right>/Mary/g<CR>:wq<CR>

0 comments


Created by: @udioica

146 active golfers, 491 entries

Leaderboard (lowest score wins):
34
#61 - Kai Yuan / @kentyuan

02/22/2013 at 01:31AM

34
#62 - cj / @cj01101

08/08/2013 at 11:59AM

34
#63 - James / @Dronak

08/29/2013 at 03:34PM

34
#64 - Paul Federspiel / @parobalth

10/23/2013 at 09:04PM

34
#65 - Patrick Oscity / @der_padde

02/11/2014 at 02:00PM

34
#66 - eBrnd / @eBrnd

11/05/2014 at 09:23PM

34
#67 - Liam Thurston / @lthurston188

08/18/2015 at 05:42AM

34
#68 - Walker Boh / @walker_boh

10/14/2015 at 03:34PM

34
#69 - tPenguinLTG / @tpenguinltg

05/01/2016 at 11:13PM

34
#70 - Gurukandhamoorthi / @Gurukandhamoor1

07/22/2017 at 04:36PM

35
#71 - Asmund / @herrasbe

12/23/2012 at 11:47PM

35
#72 - Steven Herbst / @transistorman

02/25/2013 at 12:28AM

35
#73 - Nathan Fisher / @natbobc

03/16/2013 at 02:26AM

35
#74 - David Yan / @david_yan

04/18/2013 at 10:51AM

35
#75 - Bunwut Tson / @NbTson

09/01/2013 at 10:31PM

35
#76 - brett / @brettyukich

09/21/2013 at 08:35AM

35
#77 - Tom Cammann / @tea_sea

05/13/2014 at 08:40AM

35
#78 - Caek / @Caek_

07/07/2014 at 02:50AM

36
#79 - Daniel Lundin / @danielundin

12/04/2012 at 09:15AM

36
#80 - Eric Andres / @eric_m_andres

12/04/2012 at 05:57PM

36
#81 - Lieven Keersmaekers / @LievenKeersmaek

12/04/2012 at 06:03PM

36
#82 - Pawel Obrok / @mrYapee

12/05/2012 at 07:45AM

36
#83 - Chris Maguire / @chriswmaguire

12/05/2012 at 04:42PM

36
#84 - Mikhail / @styx_mp

12/05/2012 at 07:13PM

36
#85 - Casey Robinson / @rampant_monkey

12/05/2012 at 09:12PM

36
#86 - František Hartman / @frant_hartm

12/06/2012 at 03:30PM

36
#87 - Michael / @patheticpat

12/16/2012 at 05:59PM

36
#88 - Michael / @Amormzee

12/17/2012 at 03:41PM

36
#89 - Tamás Kárándi / @tkarandi

12/17/2012 at 11:08PM

36
#90 - n0nick / @n0nick

12/19/2012 at 01:08PM