Loading ...
Sorry, an error occurred while loading the content.

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

Expand Messages
  • Andy Wokula
    ... A similar thread from July 2009 Subject: :global problem http://groups.google.com/group/vim_use/browse_thread/thread/2ff60cd19b813e62 -- Andy -- You
    Message 1 of 16 , Feb 3, 2010
    • 0 Attachment
      Am 23.01.2010 17:16, schrieb Brett Stahlman:
      >> 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.
      > <<<

      A similar thread from July 2009
      Subject: :global problem
      http://groups.google.com/group/vim_use/browse_thread/thread/2ff60cd19b813e62

      --
      Andy

      --
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
    • Stahlman Family
      ... Ah, yes! That s the issue exactly. Thanks, Brett Stahlman ... -- You received this message from the vim_use maillist. For more information, visit
      Message 2 of 16 , Feb 3, 2010
      • 0 Attachment
        Andy Wokula wrote:
        > Am 23.01.2010 17:16, schrieb Brett Stahlman:
        >>> 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.
        >> <<<
        >
        > A similar thread from July 2009
        > Subject: :global problem
        > http://groups.google.com/group/vim_use/browse_thread/thread/2ff60cd19b813e62

        Ah, yes! That's the issue exactly.
        Thanks,
        Brett Stahlman

        >
        >

        --
        You received this message from the "vim_use" maillist.
        For more information, visit http://www.vim.org/maillist.php
      • Tim Chase
        ... 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
        Message 3 of 16 , Feb 3, 2010
        • 0 Attachment
          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
        • Stahlman Family
          ... Ironically, perhaps, :insert would be useful interactively only when invoked from within :global, yet the standalone (non-global) usage is the only one
          Message 4 of 16 , Feb 3, 2010
          • 0 Attachment
            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
          Your message has been successfully submitted and would be delivered to recipients shortly.