Compose a Vim quine!




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).


  • 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.


Posted 2011-06-25T02:01:13.167

Reputation: 295

Question was closed 2014-08-31T13:47:30.813

-1 for mentioning Notepad. – user unknown – 2011-06-28T00:55:20.073

6user unknown: That's a quite stupid reason for downvoting, actually. – Joey – 2011-06-28T19:49:46.823

3@Joey Don't try to find logic in a fanboy's reasoning. – Marcelo – 2011-06-29T19:36:26.853

2You should add an objective winning criterium, like amount of votes or character/byte count. – overactor – 2014-08-30T22:36:25.860



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?

n. 'pronouns' m.

Posted 2011-06-25T02:01:13.167

Reputation: 346

All I get is a file containing ":wq" followed by a couple newlines. – Joey Adams – 2011-06-27T19:42:53.750

Oops, I've mangled the sequence. Will fix in a moment. – n. 'pronouns' m. – 2011-06-27T19:52:03.353

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 – 2011-06-27T23:44:09.247

Also, by <kbd>A</kbd>, do you mean <kbd>Shift</kbd>+<kbd>a</kbd> ? – Joey Adams – 2011-06-28T00:51:32.990

@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. – 2011-06-28T02:25:49.117

Awesome. Well done. :) – ClosureCowboy – 2011-06-30T00:45:53.640


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.


Posted 2011-06-25T02:01:13.167

Reputation: 5 283


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


Posted 2011-06-25T02:01:13.167

Reputation: 2 495