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):
25
#31 - Alan Kessler / @alankesslr

12/10/2012 at 06:45PM

25
#32 - Édouard M'tou / @DouardM

12/19/2012 at 03:02PM

25
#33 - Chris Trombley / @ctrombley

01/28/2013 at 05:44PM

25
#34 - Trevor Powell / @DoomedBunnies

04/11/2013 at 02:46AM

25
#35 - Bradd Szonye / @bszonye

07/13/2013 at 01:33AM

25
#36 - powertomato / @powertomato

07/22/2013 at 11:50AM

25
#37 - Dom Armstrong / @dom_cycleface

10/01/2013 at 01:04PM

25
#38 - Casey Dwyer / @caseydwyer

11/04/2013 at 04:30AM

25
#39 - US Dollar Price / @USDollarPrice

11/06/2013 at 07:03AM

25
#40 - João Paiva / @jgpaiva

01/31/2014 at 06:17PM

25
#41 - mark0829 / @mark0829

03/05/2015 at 06:24AM

25
#42 - pftb12345 / @pftb12345

04/11/2015 at 05:18PM

25
#43 - Clark DuVall / @theclarkatron

05/22/2015 at 06:21AM

25
#44 - Dimitar Dimitrov / @kurkale6ka

03/23/2016 at 02:58PM

25
#45 - Turkey Man / @lvturkeyman

11/26/2017 at 09:10AM

25
#46 - DHM / @DHM29978992

05/01/2018 at 01:51AM

25
#47 - Chester Yap / @Chest_ErYap

08/04/2019 at 04:52PM

29
#48 - N / @nymph192

02/11/2013 at 09:23PM

31
#49 - h_east (トロッコ6個) / @h_east

12/04/2012 at 01:20PM

31
#50 - Joel Elkins / @dice_tea

03/04/2013 at 04:34AM

31
#51 - Ram Tamtam / @ramtamtamtam

07/17/2014 at 10:19AM

32
#52 - 無ん垢の叫び / @john_ababa

12/09/2012 at 10:26AM

32
#53 - banana / @sparkleseed

12/23/2012 at 05:18AM

32
#54 - Global Maquereau / @GlobalMaquereau

12/24/2012 at 12:53PM

32
#55 - Tobias Praetsch / @tpraetsch

02/17/2013 at 09:06PM

32
#56 - Tyler / @tylerbindon

04/03/2013 at 04:06AM

32
#57 - Justin / @justinjaffray

04/23/2013 at 04:45PM

32
#58 - Nathan / @NathanHarperoni

06/01/2013 at 04:03AM

32
#59 - Andrew Crites / @ExplosionPills

09/14/2013 at 03:51AM

32
#60 - Domingue Justin / @_jdomingue

12/24/2013 at 04:51AM