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

Re: Patch to add the vimgrep command

Expand Messages
  • Ron Aaron
    Yegappan, THANK YOU!!!! (for cbuffer as well :=)
    Message 1 of 9 , Nov 5, 2004
      Yegappan,

      THANK YOU!!!! (for cbuffer as well :=)
    • Ron Aaron
      Yegappan, ... But I have a bunch of files encoded in CP1255, and my encoding is UTF8. So when I edit the files, vim converts them back and forth. ... doesn t
      Message 2 of 9 , Nov 5, 2004
        Yegappan,

        :vimgrep works fine for normal text.

        But I have a bunch of files encoded in CP1255, and my encoding is UTF8. So
        when I edit the files, vim converts them back and forth.

        :vimgrep <utf8string> [cp1255files]

        doesn't work; it returns nothing, even when searching for text I *know* is in
        the files.

        Help!
        --
        My GPG public key is at http://ronware.org/
        fingerprint: 8130 734C 69A3 6542 0853 CB42 3ECF 9259 AD29 415D
      • drchip@campbellfamily.biz
        ... Hello! Just wanted to point out that it works well with , too (http://vim.sourceforge.net/scripts/script.php?script_id=1027). That puts a
        Message 3 of 9 , Nov 5, 2004
          Quoting Yegappan Lakshmanan <yegappan@...>:
          > The attached patch implements the vimgrep command. This patch
          > is against the Vim 6.3 sources.
          >
          > The syntax of the command is:
          >
          > :vimgrep <pattern> <filename(s)>
          >
          > You can search for any Vim reg-ex patterns in the specified
          > files. I will add the documentation, after all the
          > comments/suggestions are incorporated.

          Hello!

          Just wanted to point out that it works well with <errsign.vim>, too
          (http://vim.sourceforge.net/scripts/script.php?script_id=1027).

          That puts a highlight on the matching lines and flags them with
          >> signs. (to use it you need +signs)

          Regards,
          Chip Campbell
        • Yegappan Lakshmanan
          Hi Ron, ... Good to hear that. ... Does the normal Vim search using / or ? or search() work for the UTF8 pattern/string? As I am not familiar with Unicode,
          Message 4 of 9 , Nov 7, 2004
            Hi Ron,

            --- Ron Aaron <ron@...> wrote:

            > Yegappan,
            >
            > :vimgrep works fine for normal text.
            >

            Good to hear that.

            >
            > But I have a bunch of files encoded in CP1255, and my encoding is UTF8. So
            > when I edit the files, vim converts them back and forth.
            >
            > :vimgrep <utf8string> [cp1255files]
            >
            > doesn't work; it returns nothing, even when searching for text I *know* is in
            > the files.
            >

            Does the normal Vim search using "/" or "?" or search() work for
            the UTF8 pattern/string?

            As I am not familiar with Unicode, we need to wait for someone
            (Bram?) familiar with it to help us here.

            - Yegappan




            __________________________________
            Do you Yahoo!?
            Check out the new Yahoo! Front Page.
            www.yahoo.com
          • Ron Aaron
            ... Hi. ... Indeed it does. I think you need to do whatever vim does when reading in a file -- including converting encodings. Otherwise your grep will not do
            Message 5 of 9 , Nov 8, 2004
              On Sun, November 7, 2004 21:40, Yegappan Lakshmanan said:
              > Hi Ron,
              Hi.
              >
              > Does the normal Vim search using "/" or "?" or search() work for
              > the UTF8 pattern/string?

              Indeed it does.

              I think you need to do whatever vim does when reading in a file -- including
              converting encodings. Otherwise your grep will not do "the right thing" with
              respect to these situations.

              --
              My GPG public key is at http://ronware.org/
              fingerprint: 8130 734C 69A3 6542 0853 CB42 3ECF 9259 AD29 415D
            • Bram Moolenaar
              ... When using :grep and setting grepprg to something specific to use internal grepping, it s easier to type the command. But it will not be compatible
              Message 6 of 9 , Nov 19, 2004
                Mikolaj Machowski wrote:

                > Dnia pi±tek, 5 listopada 2004 02:36, Yegappan Lakshmanan napisa³:
                > > Hi all,
                > >
                > > The attached patch implements the vimgrep command. This patch
                > > is against the Vim 6.3 sources.
                > >
                > > The syntax of the command is:
                > > :vimgrep <pattern> <filename(s)>
                > >
                > That's great!
                >
                > One organizational thing: wouldn't it be better to make it an option to
                > :grep command and 'grepprg' option - "builtin" - like for 'term' option?
                >
                > Note: this is question to Bram and other users so don't hurry to make it
                > real :)

                When using ":grep" and setting 'grepprg' to something specific to use
                internal grepping, it's easier to type the command. But it will not be
                compatible with previous versions, since the Vim pattern works a bit
                different from the external grep program.

                When using ":vimgrep" it's easy to switch between external and internal
                grepping. The only disadvantage appears to be that the command is
                longer to type.

                It would also be possible to do both: Supply ":vimgrep" that always does
                it internally, and allow setting 'grepprg' to make ":grep" work
                internally. That at least makes ":grep" work for systems that don't
                have an external grep command. And scripts can use ":vimgrep", as it
                works the same way on all systems.

                --
                "Hegel was right when he said that we learn from history that man can
                never learn anything from history." (George Bernard Shaw)

                /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
                /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
                \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
                \\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///
              • Mikolaj Machowski
                ... This is not small disadvantage. ... Yes, this the best solution. Leave grepprg default as is but provide option to call grep internally. m.
                Message 7 of 9 , Nov 19, 2004
                  Dnia piątek, 19 listopada 2004 17:01, Bram Moolenaar napisał:
                  > > One organizational thing: wouldn't it be better to make it an option
                  > > to
                  > >
                  > > :grep command and 'grepprg' option - "builtin" - like for 'term'
                  > > : option?
                  > >
                  > When using ":grep" and setting 'grepprg' to something specific to use
                  > internal grepping, it's easier to type the command. But it will not be
                  > compatible with previous versions, since the Vim pattern works a bit
                  > different from the external grep program.
                  >
                  > When using ":vimgrep" it's easy to switch between external and internal
                  > grepping. The only disadvantage appears to be that the command is
                  > longer to type.

                  This is not small disadvantage.

                  > It would also be possible to do both: Supply ":vimgrep" that always does
                  > it internally, and allow setting 'grepprg' to make ":grep" work
                  > internally. That at least makes ":grep" work for systems that don't
                  > have an external grep command. And scripts can use ":vimgrep", as it
                  > works the same way on all systems.

                  Yes, this the best solution. Leave 'grepprg' default as is but
                  provide option to call grep internally.

                  m.
                Your message has been successfully submitted and would be delivered to recipients shortly.