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

Re: execute macro in bufdo command

Expand Messages
  • Eric Arnold
    ... Try bufdo normal @a @a in :ex doesn t mean execute .
    Message 1 of 4 , May 31, 2006
    • 0 Attachment
      On 5/31/06, Johannes Schwarz <J.Schwarz@...> wrote:
      > Hi all,
      >
      > I recorded a macro (search for line and paste 3 lines out of the
      > clipboard "*p )
      >
      > I want to execute the macro in 15 different buffers and tried it with
      > the bufdo - Command, without success
      >
      > :bufdo @a | update

      Try

      bufdo normal @a

      @a in :ex doesn't mean 'execute'.


      > Vim prints 30 lines (every first line the filename and every second
      > line the search-criterium), then it waits for me pressing a key.
      > But nothing changed in the files.
      >
      > Does someone can give me a hint?
      >
    • Tim Chase
      ... Without the contents of the macro, this may be a bit difficult to troubleshoot. ... You likely want ... However, norm doesn t allow extra stuff after it
      Message 2 of 4 , May 31, 2006
      • 0 Attachment
        > I recorded a macro (search for line and paste 3 lines out of the
        > clipboard "*p )

        Without the contents of the macro, this may be a bit difficult to
        troubleshoot.

        > :bufdo @a | update

        You likely want

        :bufdo norm @a

        However, "norm" doesn't allow extra stuff after it (such as your
        update). My preferred way to make such batch changes is to
        enable the 'hidden' setting, allowing me to review all the
        changes before updating them all with ":wall"

        From the description of what you want to do, you can also do it
        in ex mode:

        :set hidden
        :bufdo g/regexp/put *
        [review changes]
        :wall

        This will put the clipboard's contents after *every* line
        containing regexp. If you only want the first, you can use

        :set hidden wrapscan
        :bufdo $/regexp/put *

        Hope this gives you some stuff to work with.

        -tim
      • Eric Arnold
        ... Hmm. Well, I don t think it means execute keystrokes , correct if wrong.
        Message 3 of 4 , May 31, 2006
        • 0 Attachment
          On 5/31/06, Eric Arnold <eric.p.arnold@...> wrote:
          > On 5/31/06, Johannes Schwarz <J.Schwarz@...> wrote:
          > > Hi all,
          > >
          > > I recorded a macro (search for line and paste 3 lines out of the
          > > clipboard "*p )
          > >
          > > I want to execute the macro in 15 different buffers and tried it with
          > > the bufdo - Command, without success
          > >
          > > :bufdo @a | update
          >
          > Try
          >
          > bufdo normal @a
          >
          > @a in :ex doesn't mean 'execute'.

          Hmm. Well, I don't think it means 'execute keystrokes', correct if wrong.

          >
          > > Vim prints 30 lines (every first line the filename and every second
          > > line the search-criterium), then it waits for me pressing a key.
          > > But nothing changed in the files.
          > >
          > > Does someone can give me a hint?
          > >
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.