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

Re: ":windo g/pattern/q" peculiarity

Expand Messages
  • Jean-Rene David
    [pasted from vim_use] ... Attached is a small patch that fixes this. The problem is that :g doesn t check whether the buffer it s in after it finishes is the
    Message 1 of 2 , Apr 29, 2011
      [pasted from vim_use]

      * Tim Chase [2011.04.28 14:00]:
      > Not sure if this is an old-version-of-vim thing, or if it's just a
      > peculiar interaction. Scenario: I had a bunch of vim-windows open on
      > various files and wanted to close those that contained a given
      > pattern (in the example below, using "@" as my pattern to close
      > windows with email addresses in them), so I issued:
      >
      > :windo g/pattern/q
      >
      > which did as I expected, but had the odd side effect of printing
      > misleading messages about additional/fewer lines:
      >
      > 193 more lines
      > E486: Pattern not found: @
      > 86 fewer lines
      > 16 fewer lines
      > E486: Pattern not found: @
      >
      > (the E486 is ignorable because those were the files that didn't match
      > the pattern). No lines were actually added/removed. The
      > "more"/"fewer" lines likely comes from Vim noting the number of lines
      > before the ":g" and comparing it to number of lines after the ":g",
      > and reporting the difference, but not noticing that the
      > file/buffer/window had changed in the process.
      >
      > Looks like a minor bug or underdocumentation to me, though certainly
      > not grievous.

      Attached is a small patch that fixes this. The problem is that :g
      doesn't check whether the buffer it's in after it finishes is the same
      as the buffer it started in.

      --
      JR

      --
      You received this message from the "vim_dev" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    • Bram Moolenaar
      ... Thanks for the patch! -- You have the right to remain silent. Anything you say will be misquoted, then used against you. /// Bram Moolenaar --
      Message 2 of 2 , Apr 29, 2011
        Jean-Rene David wrote:

        > [pasted from vim_use]
        >
        > * Tim Chase [2011.04.28 14:00]:
        > > Not sure if this is an old-version-of-vim thing, or if it's just a
        > > peculiar interaction. Scenario: I had a bunch of vim-windows open on
        > > various files and wanted to close those that contained a given
        > > pattern (in the example below, using "@" as my pattern to close
        > > windows with email addresses in them), so I issued:
        > >
        > > :windo g/pattern/q
        > >
        > > which did as I expected, but had the odd side effect of printing
        > > misleading messages about additional/fewer lines:
        > >
        > > 193 more lines
        > > E486: Pattern not found: @
        > > 86 fewer lines
        > > 16 fewer lines
        > > E486: Pattern not found: @
        > >
        > > (the E486 is ignorable because those were the files that didn't match
        > > the pattern). No lines were actually added/removed. The
        > > "more"/"fewer" lines likely comes from Vim noting the number of lines
        > > before the ":g" and comparing it to number of lines after the ":g",
        > > and reporting the difference, but not noticing that the
        > > file/buffer/window had changed in the process.
        > >
        > > Looks like a minor bug or underdocumentation to me, though certainly
        > > not grievous.
        >
        > Attached is a small patch that fixes this. The problem is that :g
        > doesn't check whether the buffer it's in after it finishes is the same
        > as the buffer it started in.

        Thanks for the patch!

        --
        You have the right to remain silent. Anything you say will be
        misquoted, then used against you.

        /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
        /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
        \\\ an exciting new programming language -- http://www.Zimbu.org ///
        \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

        --
        You received this message from the "vim_dev" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php
      Your message has been successfully submitted and would be delivered to recipients shortly.