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

Re: vimgrep command - a seeming problem

Expand Messages
  • 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 1 of 9 , Nov 7, 2004
    • 0 Attachment
      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 2 of 9 , Nov 8, 2004
      • 0 Attachment
        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 3 of 9 , Nov 19, 2004
        • 0 Attachment
          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 4 of 9 , Nov 19, 2004
          • 0 Attachment
            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.