>From the Vim help on :append and :insert...

>>>
When these commands are used with :global or :vglobal then the lines
are
obtained from the text following the command.  Separate lines with a
NL
escaped with a backslash:
        :global/abc/insert\
        one line\
        another line
The final "." is not needed then.
<<<

When I paste the 3 script lines above into a buffer and execute them
(by sourcing from the buffer to be modified), I get the following
errors:

Error detected while processing C:/home/.vim/plugin/txtfmt.tut:
line    2:
E488: Trailing characters
line    3:
E492: Not an editor command: one line\
line    4:
E492: Not an editor command: another line

Note: Filetype is unix, and I've even used xxd to verify that the
backslashes are followed by a single NL, so I know the "Trailing
characters" error is not caused by an unexpected CR.

0000000: 3a67 6c6f 6261 6c2f 6162 632f 696e 7365  :global/abc/inse
0000010: 7274 5c0a 6f6e 6520 6c69 6e65 5c0a 616e  rt\.one line\.an
0000020: 6f74 6865 7220 6c69 6e65 0a              other line.

Is this a bug, or is there an option setting that could be preventing
the example from working as expected?

Note that what I really want is to use :append and :insert *without*
global: e.g.,

insert
one line
another line
.

...And this actually does what I want. I hesitate to use it, however,
because of the following 2 statements in the Vim help, which seem to
imply that you must use :global or :vglobal for non-interactive usage.

        >>>
        These two commands will keep on asking for lines, until you type
        a line containing only a ".".
        .
        .
        When these commands are used with :global or :vglobal then the
        lines are obtained from the text following the command.
        <<<

Although :append and :insert appear to work non-interactively as well,
I don't want to use them this way if the behavior is undefined.

Thanks,
Brett Stahlman

-- 
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

Reply via email to