# Compose a Vim quine! [closed]

Goal:

Create and save file in Vim containing at least 25 ASCII characters. The exact keystrokes used during the creation and saving of this file must also produce identical contents in Windows Notepad (without having to save in Notepad).

Rules:

• For the purposes of this challenge, Vim begins open in command mode.
• The mouse is not allowed.
• Shift is allowed. Ctrl, alt, or any other modifier keys are not allowed.
• Your solution must work with the default "terminal" (non-GUI) Vim shipped with either Ubuntu 11.04 or OS X 10.6.7 (one of the two). Assume this Vim's .vimrc contains only set nocompatible (with no line break after it), which is itself located at ~/.vimrc. Pretend your operating system was just installed before opening Vim.
• You must not open any pre-existing files except for your .vimrc. Any files you create while solving this puzzle may be saved and re-opened as many times as necessary.
• Vim cannot be closed!

Disclosure, and a possible reason to close: I do not have a solution.

• -1 for mentioning Notepad. – user unknown Jun 28 '11 at 0:55
• user unknown: That's a quite stupid reason for downvoting, actually. – Joey Jun 28 '11 at 19:49
• @Joey Don't try to find logic in a fanboy's reasoning. – Marcelo Jun 29 '11 at 19:36
• You should add an objective winning criterium, like amount of votes or character/byte count. – overactor Aug 30 '14 at 22:36

The edited sequence (the first version was mangled).

2 A 2 A Esc 2 A 2 A Esc 2 A 2 A Esc

2 A 2 A Esc 2 A 2 A Esc 2 A 2 A Esc

2 A 2 A Esc 2 A 2 A Esc A : w q Enter

Esc Backspace Backspace Backspace Backspace Backspace : w q Enter

Should do the trick, if I'm counting my keystrokes correctly. No wait, is the escape key allowed?

• All I get is a file containing ":wq" followed by a couple newlines. – Joey Adams Jun 27 '11 at 19:42
• Oops, I've mangled the sequence. Will fix in a moment. – n. 'pronouns' m. Jun 27 '11 at 19:52
• Hmmm, what about the Vim cannot be closed requirement? I suppose the solution is simple enough: remove the two q's and one of the backspaces. – asoundmove Jun 27 '11 at 23:44
• Also, by <kbd>A</kbd>, do you mean <kbd>Shift</kbd>+<kbd>a</kbd> ? – Joey Adams Jun 28 '11 at 0:51
• @asoundmove ah yes, missed that part. Removing both "q"s and a backspace should fix it. @Joey Adams; I mean Shift+A indeed, but this notation takes too much space, enough is enough! – n. 'pronouns' m. Jun 28 '11 at 2:25

I Backspace H E L LO , Space W O R LD

Esc Shift+; W Enter I Backspace Backspace Backspace Backspace.

Produces "hello, world" in both.

34 keystrokes. Produces twenty-two A's followed by :x and a new line.

i Backspace

a a a a a a a a a a a

a a a a a a a a a a a

: x Enter Esc Backspace Backspace Backspace : x Enter