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):
16
#1 - Kerson Hsiao / @KersonHsiao

12/04/2012 at 04:34PM

16
#2 - Conner McDaniel / @connermcd

12/04/2012 at 05:21PM

16
#3 - Urtica dioica / @udioica

12/04/2012 at 11:20PM

16
#4 - Yann Moisan / @YannMoisan

02/10/2013 at 01:37PM

16
#5 - Chasetopher / @chasetopherlee

04/29/2013 at 04:45AM

16
#6 - Petro Тrouq / @zulolosi

05/11/2013 at 10:10PM

16
#7 - 张文远 / @zhwenyuan

05/25/2013 at 06:15AM

16
#8 - Marco Hinz / @_mhinz_

05/26/2013 at 11:58AM

16
#9 - Andrew O'Neill / @AndroidOatmeal

02/19/2014 at 03:47PM

16
#10 - John Braxler / @braxler

04/07/2014 at 07:54PM

16
#11 - ZorgroZ / @ZorgroZ

04/14/2014 at 10:41PM

16
#12 - retired account / @retired10072015

07/01/2014 at 08:35PM

16
#13 - I / @ForgetIt17

08/20/2014 at 01:52PM

16
#14 - Tim Grebien / @tiggg

02/21/2017 at 03:37PM

16
#15 - Daniel / @Daniel00288663

04/03/2017 at 10:05AM

16
#16 - BarbaJol / @drpproteus

01/10/2018 at 04:39PM

16
#17 - Mihai / @mihaicristiant

02/21/2019 at 03:26PM

16
#18 - majo senf / @majo_senf

06/25/2019 at 02:57PM

16
#19 - Tamás Kárándi / @tkarandi

10/19/2019 at 11:05AM

16
#20 - Lory / @Lory46845742

12/06/2019 at 11:01AM

16
#21 - Miłosz Łakomy / @foobar01123

02/13/2020 at 09:55AM

16
#22 - RockerZZY / @rocker_zzy

06/24/2020 at 06:44AM

16
#23 - Jean George / @JeanGeo20504212

03/24/2022 at 08:08PM

16
#24 - blabla zincou / @BZincou

04/19/2022 at 06:13PM

16
#25 - russellzhaomao / @russellzhaomao

06/12/2022 at 02:01AM

16
#26 - Janzen / @__Coos

09/28/2022 at 01:06PM

16
#27 - Remus Dalrymple / @bornintheflames

12/28/2023 at 06:17AM

16
#28 - Peppa Pig / @PeppaPigSg

05/05/2024 at 05:09AM

17
#29 - Alec Goebel / @zego5360

01/04/2013 at 04:43AM

17
#30 - Steve Tjoa / @stevetjoa

07/18/2013 at 06:21PM