# Write a Vim command that reads as English text [closed]

Once you grok vi, your muscle memory learns tricks like ggVGx to delete all the text in a file. Trouble is, ggVGx is not an English word, so it makes a terrible mnemonic.

This challenge is about constructing a single Vi[m] command that can be reasonably read as an English word, phrase or sentence. One point per letter.

Modifier keys such as meta/alt, control, and shift should be written as they are in VimScript, e.g. <C-c> so we can read them, but will be pronounced as two consecutive letters: cc, for a score of 2.

Vim commands that start with : are only count toward your scrore if they build a word out of non-words. So :%s/aword/anotherword/gi would only add 3 to your score, for sgi (and only then if sgi is part of an actual English word or phrase, such as hasgills. Similarly :help would add zero to your score.

No user-defined mappings. Your answer should work on a fresh install of Vim with no .vimrc or other gizmos.

Finally, the command has to do something other than throw an error.

Example Entry:

# cap (3)

cap, change a paragraph

• Are you excluding commands that start with :? Most of them are pretty obviously English words. – Greg Hewgill May 29 '14 at 1:26
• ah good point, updating... – hoosierEE May 29 '14 at 1:37
• Wait, people still use vim? Don't they know that it's 2014? – Kyle Kanos May 29 '14 at 1:38
• The proper command to delete the entire buffer is obviously ggdG (or Gdgg) – Geoff Reedy May 29 '14 at 2:19
• @KyleKanos Wait, you mean there's people who don't use vim? – Kevin May 29 '14 at 2:48

Score 60

:s/foo/bar/incerepellingliceingreeceIgrillripeninggreenpepperinniceice

since repelling lice in Greece I grill ripening green pepper in nice ice

You can repeat flags arbitrarily in the :s command so this can get as long as you care to come up with a sentence/phrase/word using only the letters c,e,g,i,I,n,p,l,r and starting with an s.

• That's ridiculous. Grilling with nice ice just makes a bunch of steam. – hoosierEE May 29 '14 at 3:18

I think this a really cheesy answer.

Prints " think this is a really cheesy answer.", score of 36. If you count "anything typed in insert mode" as one point, we can construct arbitrarily long cheesy strings like this:

I think really cheesy answers are accidents. No really, they're accidents. I mentioned they're accidents, right?

Where each cc in "accident" is the <Ctrl-C> insert mode command. The following i puts us back in insert mode for an additional two characters whenever we write "accident". If we have to end in normal mode, we can finish the paragraph with:

But I really like soccer!

Which leaves insert mode, moves to the end of the last word, and replaces the last character with a !.

Vim's text objects provide a variety of three-letter words (of which cap is one).

grep -E '^[cdv][ai][wspbt]\$' /usr/share/dict/words

• cab
• cap
• cat
• caw
• cis
• cit
• dab
• dap
• das
• dat
• daw
• dib
• dip
• dis
• dit
• vas
• vat
• vaw
• vip
• vis

I only found one four letter command that is a word:

• guib

I opted not to include insert mode commands such as a, r, s where the remainder of the "word" is just text typed into the document. Otherwise, you would have to accept any word starting with one of those letters.

• This answer definitely fits with what I had in mind when I asked the question. No loopholes (standard or non), but it seems a bit odd that they're all 3 characters long. – hoosierEE May 29 '14 at 20:41
• Found a four letter one. – Greg Hewgill May 29 '14 at 21:01

Haven't spent much time, but found at least one 6-letter word which is a valid command: toggle (go to next letter 'o', then jump to beginning of file, then second line and to the end of a first word there). I am sure there could be a lot of other words combined from movement commands.

Found another one. This one at least does something (and is 7 letters): forgery (go to 'o', replace with 'g', go to end of word, replace with 'y').

More words and phrases:

Brand new
Entangled<space>
Su<cc>ulents

• Nice ones! forgery especially. – hoosierEE May 30 '14 at 13:04