[comp.editors] vi map magic for "embolden"?

alien@hpdmd48.boi.hp.com (Tom von Alten) (03/28/91)

This sort of thing has undoubtedly been hashed over before, so I ask
for your indulgence to a newcomer to comp.editors.

I'd like to be able to create bold text in a vi document, without the
constraints of having the source be nroff input.  One way that occurred to
me was to embolden one character at a time, to get the same result that
nroff produces, e.g. S^HS^HS^HS for a bold 'S'.

"ayla\^H\^H\^H^[hh"apl"apl"apl

works in the editor, but when mapped, it inserts the 3 backspaces, beeps
twice and leaves me on the next line.  I think it has to do with the buffer
transaction, but i'm not sure.  It seems to me that I've had some trouble
with ^[ in those map strings before...

Thanks for any clues, or suggestions for better solutions to the original
problem.
_____________
Tom von Alten           email: alien@hpdmd48.boi.hp.com
                        Hewlett-Packard Disk Mechanisms Division
                        208 323-2711____________________________

alien@hpdmd48.boi.hp.com (Tom von Alten) (03/28/91)

A little asking, a few clues and some trial and error produced one
solution (which purposely avoids yank):

" Embolden one character:  Append a backspace.  Backup one char and delete
" 2 chars. Put,put,put.  Backup one char, delete it and Put it back.
" Move forward one char and put again.  Voila!
map #4 a\^H^[h2xPpphxPlp
_____________
Tom von Alten           email: alien@hpdmd48.boi.hp.com
                        Hewlett-Packard Disk Mechanisms Division
                        208 323-2711____________________________

alien@hpdmd48.boi.hp.com (Tom von Alten) (03/28/91)

Or even cleaner:

" Embolden one character:  Append a backspace.  Backup one char and delete
" 2 chars. Put,put,put,put, then delete the last backspace.
map #4 a\^H^[h2xPpppx

Except for one niggling problem - in my .exrc file, this behaves as if
I hit carriage return after the above string - it leaves the cursor on the
beginning of the next line.  What's wrong??
_____________
Tom von Alten           email: alien@hpdmd48.boi.hp.com

alien@hpdmd48.boi.hp.com (Tom von Alten) (04/03/91)

I tracked down the <cr> problem - it seems the default definitions
for softkeys on the HPterm I'm using includes it.

Mapping the character sequence to a "regular" key (like ^A) makes
it work just fine.

Thanks to Ed Allen for helping me figure it out.