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):
35
#91 - 0xf00ff00f / @0xf00ff00f

01/04/2025 at 11:25PM

36
#92 - Daniel Lundin / @danielundin

12/04/2012 at 09:15AM

36
#93 - Eric Andres / @eric_m_andres

12/04/2012 at 05:57PM

36
#94 - Lieven Keersmaekers / @LievenKeersmaek

12/04/2012 at 06:03PM

36
#95 - Pawel Obrok / @mrYapee

12/05/2012 at 07:45AM

36
#96 - Chris Maguire / @chriswmaguire

12/05/2012 at 04:42PM

36
#97 - Mikhail / @styx_mp

12/05/2012 at 07:13PM

36
#98 - Casey Robinson / @rampant_monkey

12/05/2012 at 09:12PM

36
#99 - František Hartman / @frant_hartm

12/06/2012 at 03:30PM

36
#100 - Michael / @patheticpat

12/16/2012 at 05:59PM

36
#101 - Michael / @Amormzee

12/17/2012 at 03:41PM

36
#102 - n0nick / @n0nick

12/19/2012 at 01:08PM

36
#103 - John Papanastasiou / @JohnPapps

01/12/2013 at 07:31PM

37
#104 - Sean Anderson / @sean_anderson

04/29/2013 at 10:20AM

37
#105 - Brendan Schaenzer / @bschaenzer

09/30/2020 at 04:21PM

38
#106 - Runar / @runarfu

12/04/2012 at 07:56AM

38
#107 - Arun / @UArunKumar

12/04/2012 at 07:46PM

38
#108 - Johnny Hoang / @JohnnyHoang

12/04/2012 at 10:49PM

38
#109 - Fred Nias / @frednias

12/06/2012 at 12:52PM

38
#110 - Jon Moshier / @jonmoshier

12/06/2012 at 11:30PM

38
#111 - mnx / @mnxx

12/17/2012 at 11:28PM

38
#112 - Marko Tibold / @markotibold

12/24/2012 at 12:46AM

38
#113 - XGOLFER / @vimg0lfer

01/04/2013 at 10:51PM

38
#114 - Eric Potter / @pottereric

05/27/2013 at 08:02PM

38
#115 - Joe Sullivan / @itsjoesullivan

06/19/2013 at 06:04AM

38
#116 - moo goo / @m00g000

07/01/2013 at 07:40PM

38
#117 - Kevin James / @KevinKarruthers

11/20/2013 at 09:12PM

38
#118 - Fnord Everywhere / @FnordE

12/16/2013 at 12:49PM

38
#119 - Mauro Persano / @fzort

11/16/2014 at 02:54AM

38
#120 - Brian Hall / @_bruab_

03/29/2017 at 03:18PM