Wednesday, February 3, 2010

Re: Possible bug affecting append/insert commands within :global

Stahlman Family wrote:
>
> Andy Wokula wrote:
>> Am 23.01.2010 17:16, schrieb Brett Stahlman:
>>>> From the Vim help on :append and :insert...
>> A similar thread from July 2009
>> Subject: :global problem
>> http://groups.google.com/group/vim_use/browse_thread/thread/2ff60cd19b813e62
>
> Ah, yes

From that thread, Bram wrote:

Note that this is only supposed to work when
used in a script, not when typed. It's quite
useless to type an :insert command.

Which I would contend depends on your definition of
"script"...there are a number of times I've reached for using
:insert or :append in a :g command and been stymied, forced to
use a :put instead. I'd like to be able to do something like

:g/foo/insert\
line1\
line2

and have it insert those two lines above every line containing
"foo" in my file. As it stands, I have to resort to something like

:g/foo/put! =\"line1\nline2\"

It's not exactly sourced from a script, but it is in a more
automated use than just typing plain ":insert" at the : prompt.

-tim

PS: Brett -- sorry I didn't chime in earlier on this thread, as I
didn't actually have much in the way of answers. Just my "me
too" observations on the weirdness of continued :insert/:append
commands and my workaround using :put which you now have in that
thread :)


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

No comments: