A quick check confirms that '|' also works as a command separator
in exrc, so it's not clear to me if there is an actual bug or if
you are fighting against a poorly documented feature.

Hi, this is some kind of feature of nvi. You can take a look at
the sources. Apart of the traditional command separator, you can
use it in some other contexts, making life easiest. The part of the
code that make that possible is somewhat, let's say _funny_.

For example, you can make a map like this:

map =c yEo^[p:.,.! tr -d '\n' | wc -m^M

to count the following word, because after the !, vi will treat
'|' like part of the shell command. But if you put that in exrc,
it will treat the '|' like a command separator. The magic is in
common/seq.c, there I saw that when constructing the sequence from
input, it inserts before a CH_LITERAL (0x16).  Indeed you can use
Control-X to insert 0x16 before '|' in exrc, and the map will work.

If you mind correctness you have several choices: One is to make
the loading of exrc behave like the typed commands (that is what
the patch does). another is to add a comment in the man page about
inserting 0x16 before '|' in exrc when you don't want to use it
like a command separator (I really don't like this option). Well,
another solution could be to use Control-V to insert the pair 0x16|
when used before |, and document the different behavior when loading
a configuration file, or better, make that the common behavior
typing commands and loading them.

Of course the more sensible aproach to me is just to use another
character for command separation, but that would be a big change for
this venerable companion...

Or maybe I'm just missing something and the best option is just to
ignore me.

Regards,
adr

Reply via email to