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

157 active golfers, 559 entries

Leaderboard (lowest score wins):
39
#121 - Neil Pahl / @neildaemond

02/23/2013 at 06:47PM

39
#122 - Joshua Draper / @JoshuaBDraper

05/25/2013 at 08:14PM

39
#123 - gary.klindt@googlema / @garstekli

12/01/2013 at 07:40PM

39
#124 - David Tabachnikov / @davidtab

09/30/2014 at 01:29PM

39
#125 - Robert Robertson / @RobertC3228687

07/01/2015 at 05:31PM

39
#126 - Gerald Tilma / @GeraldTilma

10/22/2015 at 02:33AM

39
#127 - Etienne Tremel / @etiennetremel

02/20/2016 at 09:31PM

40
#128 - joe di castro / @joe_di_castro

12/04/2012 at 10:25PM

40
#129 - Peter Xiao / @PterXiao

01/23/2013 at 05:04AM

40
#130 - Matt Robbins / @mcrmfc

04/21/2013 at 09:12PM

40
#131 - RobertT / @techrt2050

07/18/2013 at 06:06AM

40
#132 - Hachez Floran / @FloranHachez

09/03/2013 at 08:52PM

41
#133 - Django Janny / @keltroth

12/08/2012 at 04:10PM

41
#134 - Gabutero / @wizmokeri

04/07/2014 at 05:27AM

41
#135 - Alex J. Ahraus / @fanaugen

10/22/2015 at 04:52PM

41
#136 - Liam Chimes / @ChimesLiam

05/02/2018 at 12:29PM

42
#137 - Brent Woo / @BrentPWoo

10/16/2018 at 08:27PM

43
#138 - Garrett Oreilly / @garrett_oh

02/14/2013 at 01:48AM

43
#139 - Jonathan Karlsson / @karlsjona

05/07/2013 at 08:28AM

43
#140 - William Ott / @oddalot

04/11/2015 at 11:24PM

43
#141 - Andrew Michaud / @andrewjmichaud

09/05/2015 at 01:54AM

44
#142 - BJ Neilsen / @localshred

12/04/2012 at 03:53PM

44
#143 - A R / @arusso23

12/22/2012 at 08:46AM

44
#144 - Patrick Pitoscia / @Patrick03960431

08/11/2014 at 02:01AM

44
#145 - Justin Knag / @justinknag

08/28/2014 at 01:04PM

44
#146 - Rolf Vreijdenberger / @3l33th4x0r

07/26/2017 at 07:51PM

44
#147 - c0llision / @sh3llcode

01/28/2018 at 02:16PM

46
#148 - Oliver Christ / @0liverChrist

09/25/2013 at 03:01PM

48
#149 - Tj / @yrddy

08/19/2014 at 07:02AM

49
#150 - Chirag Tailor / @ctailor2

01/27/2014 at 07:25AM