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):
36
#91 - Chris Maguire / @chriswmaguire

12/05/2012 at 04:42PM

36
#92 - Mikhail / @styx_mp

12/05/2012 at 07:13PM

36
#93 - Casey Robinson / @rampant_monkey

12/05/2012 at 09:12PM

36
#94 - FrantiĊĦek Hartman / @frant_hartm

12/06/2012 at 03:30PM

36
#95 - Michael / @patheticpat

12/16/2012 at 05:59PM

36
#96 - Michael / @Amormzee

12/17/2012 at 03:41PM

36
#97 - n0nick / @n0nick

12/19/2012 at 01:08PM

36
#98 - John Papanastasiou / @JohnPapps

01/12/2013 at 07:31PM

37
#99 - Sean Anderson / @sean_anderson

04/29/2013 at 10:20AM

37
#100 - Brendan Schaenzer / @bschaenzer

09/30/2020 at 04:21PM

38
#101 - Runar / @runarfu

12/04/2012 at 07:56AM

38
#102 - Arun / @UArunKumar

12/04/2012 at 07:46PM

38
#103 - Johnny Hoang / @JohnnyHoang

12/04/2012 at 10:49PM

38
#104 - Fred Nias / @frednias

12/06/2012 at 12:52PM

38
#105 - Jon Moshier / @jonmoshier

12/06/2012 at 11:30PM

38
#106 - mnx / @mnxx

12/17/2012 at 11:28PM

38
#107 - Marko Tibold / @markotibold

12/24/2012 at 12:46AM

38
#108 - XGOLFER / @vimg0lfer

01/04/2013 at 10:51PM

38
#109 - Eric Potter / @pottereric

05/27/2013 at 08:02PM

38
#110 - Joe Sullivan / @itsjoesullivan

06/19/2013 at 06:04AM

38
#111 - moo goo / @m00g000

07/01/2013 at 07:40PM

38
#112 - Kevin James / @KevinKarruthers

11/20/2013 at 09:12PM

38
#113 - Fnord Everywhere / @FnordE

12/16/2013 at 12:49PM

38
#114 - Mauro Persano / @fzort

11/16/2014 at 02:54AM

38
#115 - Brian Hall / @_bruab_

03/29/2017 at 03:18PM

38
#116 - yokibahim / @yokibahim

10/21/2019 at 07:24PM

38
#117 - Nougatine Naja / @NougatineNaja

01/12/2022 at 03:58PM

39
#118 - Roland Schatz / @fl_Overmind

12/14/2012 at 02:16PM

39
#119 - CY / @wongcy0

01/28/2013 at 06:51AM

39
#120 - Christopher Harrison / @Xophmeister

01/29/2013 at 02:32PM