2
\$\begingroup\$

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

\$\endgroup\$

closed as too broad by DJMcMayhem, Blue, Mego, Rɪᴋᴇʀ, a spaghetto Apr 19 '16 at 15:31

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

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

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.

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

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

\$\endgroup\$
4
\$\begingroup\$

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
\$\endgroup\$
  • \$\begingroup\$ Nice ones! forgery especially. \$\endgroup\$ – hoosierEE May 30 '14 at 13:04
3
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ 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. \$\endgroup\$ – hoosierEE May 29 '14 at 20:41
  • \$\begingroup\$ Found a four letter one. \$\endgroup\$ – Greg Hewgill May 29 '14 at 21:01

Not the answer you're looking for? Browse other questions tagged or ask your own question.