vi puzzle 2
gbergman at ucbtopaz.CC.Berkeley.ARPA
gbergman at ucbtopaz.CC.Berkeley.ARPA
Sun Sep 23 08:17:35 AEST 1984
I've discovered of a few variants on my second solution (the
one using ^V) since last night. Below, I will show the characters as
one types them rather than as they eventually appear. First variant:
:unab yes^V!<CR>
Explanation: the unab command will take as its argument either the
abbreviation or its expansion. (Side comment: Suppose you do
:ab a x|ab b x|ab c x. Then any of the commands unab a, unab b, unab c,
will be "transformed" into unab x, and this will only undo the last of
these 3 abbreviations. You can undo all 3 with unab x|unab x|unab x.
If you want to specifically unabbreviate b, you can do :unab ^Vb.)
Second variant
:ab yes^V! oui
:unab yes!<CR>
Explanation: If you do two "chained" abbreviations, such as
ab x y and then ab y z, the second cancels the first. I can't
imagine why. If you really want to have both, you can do them
in reverse order: ab y z then ab x y^V|
Third variant:
:ab yes^V oui
:unab yes|unab yes
I leave you to discover why you have to unab yes twice. You could
equally well use "oui" in its place, for the reason mentioned under
the first variant.
Further comment: the setting :se noremap doesn't seem to have
any effect on this nonsense.
Do these solutions work for other people as they do for me?
Any other comments?
George Bergman
Math, UC Berkeley 94720 USA
...!ucbvax!ucbcartan!gbergman
More information about the Comp.unix.wizards
mailing list