[net.unix-wizards] VI question: how to initialize a named buffer from EXINIT?

ken@turtlevax.UUCP (Ken Turkowski) (09/09/85)

I'd like to initialize a named buffer (maybe more) with some well-used
commands (like removing blanks at the end of a line), so that I only
need to execute the @<bufname> command to execute them.  I know that I
can load them up with a yank or delete, but is it possible to do it
from EX mode, suitable for initializing from the EXINIT environment
variable or the ~/.exrc file?
-- 
Ken Turkowski @ CADLINC, Menlo Park, CA
UUCP: {amd,decwrl,hplabs,seismo,spar}!turtlevax!ken
ARPA: turtlevax!ken@DECWRL.ARPA

ed@mtxinu.UUCP (Ed Gould) (09/11/85)

Summary:
Expires:
Sender:
Followup-To:
Distribution:
Keywords:

In article <892@turtlevax.UUCP> ken@turtlevax.UUCP (Ken Turkowski) writes:
>I'd like to initialize a named buffer (maybe more) with some well-used
>commands (like removing blanks at the end of a line), so that I only
>need to execute the @<bufname> command to execute them.

Did you consider defining maps?  With them, one can define any key - including
function keys if available - to be a command.  For example, to define
the "b" key to remove any trailing blanks, one might use

	:map b :1,$s/  *$//^[

Note that ^[ is the escape key, ant must be preceeded by control-V (^V)
to get it into the command.  Try it.

-- 
Ed Gould                    mt Xinu, 2910 Seventh St., Berkeley, CA  94710  USA
{ucbvax,decvax}!mtxinu!ed   +1 415 644 0146

"A man of quality is not threatened by a woman of equality."