Tim Chase wrote:
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.

Ironically, perhaps, :insert would be useful interactively only when invoked from within :global, yet the standalone (non-global) usage is the only one that actually works interactively.


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 :)

No problem. I should have searched the archives first. I appreciate your posting the link. It explains why Bram ignored this thread.

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