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 168 remaining solutions by signing in and submitting your own entry
#169 생각하자. / @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

169 active golfers, 618 entries

Leaderboard (lowest score wins):
38
#121 - yokibahim / @yokibahim

10/21/2019 at 07:24PM

38
#122 - Nougatine Naja / @NougatineNaja

01/12/2022 at 03:58PM

38
#123 - Neo / @neothetranquil

09/25/2022 at 05:09AM

39
#124 - Roland Schatz / @fl_Overmind

12/14/2012 at 02:16PM

39
#125 - CY / @wongcy0

01/28/2013 at 06:51AM

39
#126 - Christopher Harrison / @Xophmeister

01/29/2013 at 02:32PM

39
#127 - Neil Pahl / @neildaemond

02/23/2013 at 06:47PM

39
#128 - Joshua Draper / @JoshuaBDraper

05/25/2013 at 08:14PM

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

12/01/2013 at 07:40PM

39
#130 - David Tabachnikov / @davidtab

09/30/2014 at 01:29PM

39
#131 - Robert Robertson / @RobertC3228687

07/01/2015 at 05:31PM

39
#132 - Gerald Tilma / @GeraldTilma

10/22/2015 at 02:33AM

39
#133 - Etienne Tremel / @etiennetremel

02/20/2016 at 09:31PM

40
#134 - joe di castro / @joe_di_castro

12/04/2012 at 10:25PM

40
#135 - Peter Xiao / @PterXiao

01/23/2013 at 05:04AM

40
#136 - Matt Robbins / @mcrmfc

04/21/2013 at 09:12PM

40
#137 - RobertT / @techrt2050

07/18/2013 at 06:06AM

40
#138 - Hachez Floran / @FloranHachez

09/03/2013 at 08:52PM

41
#139 - Django Janny / @keltroth

12/08/2012 at 04:10PM

41
#140 - Gabutero / @wizmokeri

04/07/2014 at 05:27AM

41
#141 - Alex J. Ahraus / @fanaugen

10/22/2015 at 04:52PM

41
#142 - Liam Chimes / @ChimesLiam

05/02/2018 at 12:29PM

42
#143 - Brent Woo / @BrentPWoo

10/16/2018 at 08:27PM

42
#144 - Olivier Bégassat / @zk_evm

06/15/2023 at 08:23PM

43
#145 - Garrett / @heygarrett

02/14/2013 at 01:48AM

43
#146 - Jonathan Karlsson / @karlsjona

05/07/2013 at 08:28AM

43
#147 - William Ott / @oddalot

04/11/2015 at 11:24PM

43
#148 - Andrew Michaud / @andrewjmichaud

09/05/2015 at 01:54AM

44
#149 - BJ Neilsen / @localshred

12/04/2012 at 03:53PM

44
#150 - A R / @arusso23

12/22/2012 at 08:46AM