Type out Green Eggs and Ham in vim The book Green Eggs and Ham by Dr. Seuss is famous for only having 50 different words in the entire story of the book.

Your task is to create a sequence of keystrokes that will result in the entire text of Green Eggs and Ham when applied to an empty file in the vim text editor, starting in normal mode with all default settings. Your keystrokes must not load any other files as part of their operation - all text must be generated within the editor itself.

Your final buffer must look exactly like this file, although it can remain in whichever mode it ends up being in (you don't have to have a final &lt;Esc&gt; to return it to normal mode).

Chorded keystrokes like &lt;C-o&gt; or using Shift to type a capital letter count as a single keystroke.

The sequence of the fewest keystrokes to achieve this goal wins.
1864 keystrokes

Somebody could probably write some code that produces a more optimal solution, but this beats the reference case for now. This is a damn mess, and I am ashamed I did it by hand.

First, we enter insert mode.

i


Then all this

That ]! That ]!
IDNlike that ]!

Do Y like$?

|;].
IDNlike$.

WPY LTB or tB?

IZ LTB or tB.
IZ LTanywB.
IDNlike$.
|;].

WPY LTin a h@?
WPY LT=a m@?

|in a h@.
|=a m@.
|B or tB.
|.
IDNlike$.
|;].

WPY ETin a box?
WPY ET=a fox?

Not_a box. Not =a fox.
Not_a h@. Not =a m@.
IZ ETB or tB.
IZ ETanywB.
IZ eat$.
|;].

WPY? CPY? In a car?
Eat them! Eat them! B they are.

IZ,X,_a car.

You may LT. You will see.
You may LTin a tree!

IZ,X_a tree.
Not_a car! You let me be.

|in a box.
|=a fox.
|in a h@.
|=a m@.
|B or tB.
|.
IDNlike$.
|;].

AQ! AQ! AQ! AQ!
CPY;wPY;on aQ?

Not_aQ! Not_a tree!
Not_a car! Sam! Let me be!

IZ,X,_a box.
IX,Z;=a fox.
:=a m@.
:in a h@.
:B or tB.
:anywB.
IDNlike$.
|;].

Say! In +? B_+!
WPY;cPY,_+?

IZ,X,_+.

WPY;cPY,_the rain?


IZ,X,_the rain.
Not_+. Not on aQ.
Not_a car. Not_a tree.
|;Sam;Y see.
Not_a h@. Not_a box.
Not =a m@. Not =a fox.
:B or tB.
|!

You do not like$?
|;].

CPY;wPY;=a g^?

IZ,X;=a g^!

WPY;cPY;on a b^?

IX,Z;on a b^.
IWN,WN;=a g^.

:in the rain.
:on aQ.
Not_+! Not_a tree!
Not_a car! You let me be!
|in a box.
|=a fox.
:in a h@.
|=a m@.
|B or tB.
|!

IDNlike$!
|;].

You do not LT. So Y say.
Try them! Try them! &amp; Y may.
Try them and Y may;I say.

Sam! If Y will let me be,
I will try them. You will see.

Say! I like$!
I do! I LT;]!
&amp; I wPETin a b^.
&amp; I wPET=a g^.

!ETin the rain.
&amp;_+. &amp; on aQ.
&amp;_a car. &amp;_a tree.
They are so good;so good;Y see!

So I will ETin a box.
!ET=a fox.
!ETin a h@.
!ET=a m@.
!ETB and tB.
Say! I will ETanywB!

I do so like$!

Thank Y! Thank Y;]!


Hit escape to enter command mode. And unravel the compressed stuff. Order matters, as I've compressed some compressed text.

&lt;Esc&gt;
%s/|/|anywB/g
%s/:/IWNET/g
%s/|/IDNLT/g
%s/Z/ wPnot/g
%s/X/ cPnot/g
%s/&amp;/And/g
%s/+/the dark/g
%s/@/ouse/g
%s/^/oat/g
%s/Y/you/g
%s/IDN/I do not /g
%s/LT/like them /g
%s/]/Sam-I-am/g
%s/ET/eat them /g
%s/WN/ will not/g
%s/$/ green eggs and ham/g
%s/P/ould /g
%s/!/And I will /g
%s/Q/ train/g
%s/B/here/g
%s/_/ in /g
%s/=/with /g
%s/;/, /g