[comp.editors] vi macros and pipe operator

javey@hybrid.UUCP (shahram javey) (02/07/91)

I want to write a simple macro that opens a new line and inserts the
vertical bar (unix pipe operator). I cannot find a way of turning off
the meaning of | in ex. Is there a way? The macro I've tried is

map v o|

When i try to execute this macro I get a blank line. Where is the vertical
bar? I thought that in insert mode you should be able to enter any character.
Well, o puts you in insert mode. What is missing?

Thanks...sj

steinbac@hpl-opus.hpl.hp.com (Guenter Steinbach) (02/09/91)

In comp.editors, javey@hybrid.UUCP (shahram javey) writes:

> map v o|

> When i try to execute this macro I get a blank line. Where is the vertical
> bar? I thought that in insert mode you should be able to enter any character.
> Well, o puts you in insert mode. What is missing?

What is mising is a control-V before the pipe to escape it (turn off its
special meaning).  I guess you lose that pipe when the macro is defined,
not when it is interpreted.
This works for me when :so'urced into a vi session:

map v o^V|

Good luck, and get those Basselopes something to do!

	 Guenter Steinbach		gunter_steinbach@hplabs.hp.com