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

grep and quickfix

Expand Messages
  • Mark Volkmann
    ... it outputs lots of matches. ... and there is nothing in the quickfix list. Isn t the grep command supposed to populate that? Any ideas what I might be
    Message 1 of 7 , May 25, 2014
    • 0 Attachment
      When I run this:
      :grep some-word **/*.js
      it outputs lots of matches.
      Then I run this:
      :copen
      and there is nothing in the quickfix list.
      Isn't the grep command supposed to populate that?
      Any ideas what I might be doing wrong?
      I have not modified the grepprg or grepformat options.

      --
      --
      You received this message from the "vim_use" 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

      ---
      You received this message because you are subscribed to the Google Groups "vim_use" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
      For more options, visit https://groups.google.com/d/optout.
    • Jean-Rene David
      ... The most likely error is that grepformat doesn t match the output that you get. But you re not giving us much to go on. Can you perhaps show us what one
      Message 2 of 7 , May 25, 2014
      • 0 Attachment
        * Mark Volkmann [2014.05.25 20:44]:
        > When I run this:
        > :grep some-word **/*.js
        > it outputs lots of matches.
        > Then I run this:
        > :copen
        > and there is nothing in the quickfix list.
        > Isn't the grep command supposed to populate that?
        > Any ideas what I might be doing wrong?
        > I have not modified the grepprg or grepformat options.

        The most likely error is that grepformat doesn't
        match the output that you get. But you're not
        giving us much to go on.

        Can you perhaps show us what one line of output
        looks like?

        And while you're at it, can you show us the values
        of grepprg and grepformat, just to be sure?

        --
        JR

        --
        --
        You received this message from the "vim_use" 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

        ---
        You received this message because you are subscribed to the Google Groups "vim_use" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
        For more options, visit https://groups.google.com/d/optout.
      • Tony Mechelynck
        ... Or you might try using :vimgrep (q.v.) instead of :grep, unless your *.js files are too big for Vim s memory space. Best regards, Tony. -- Some people live
        Message 3 of 7 , May 25, 2014
        • 0 Attachment
          On 26/05/14 03:18, Jean-Rene David wrote:
          > * Mark Volkmann [2014.05.25 20:44]:
          >> When I run this:
          >> :grep some-word **/*.js
          >> it outputs lots of matches.
          >> Then I run this:
          >> :copen
          >> and there is nothing in the quickfix list.
          >> Isn't the grep command supposed to populate that?
          >> Any ideas what I might be doing wrong?
          >> I have not modified the grepprg or grepformat options.
          >
          > The most likely error is that grepformat doesn't
          > match the output that you get. But you're not
          > giving us much to go on.
          >
          > Can you perhaps show us what one line of output
          > looks like?
          >
          > And while you're at it, can you show us the values
          > of grepprg and grepformat, just to be sure?
          >

          Or you might try using :vimgrep (q.v.) instead of :grep, unless your
          *.js files are too big for Vim's memory space.

          Best regards,
          Tony.
          --
          Some people live life in the fast lane. You're in oncoming traffic.

          --
          --
          You received this message from the "vim_use" 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

          ---
          You received this message because you are subscribed to the Google Groups "vim_use" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
          For more options, visit https://groups.google.com/d/optout.
        • Mark Volkmann
          The issue is a conflict is between grep and jshint.vim. When I search for .js files that contain a given string, it finds them, then runs jshint on the first
          Message 4 of 7 , May 26, 2014
          • 0 Attachment
            The issue is a conflict is between grep and jshint.vim. When I search for .js files that contain a given string, it finds them, then runs jshint on the first file. It finds no issues in the file, but that replaces the quickfix list that had been populated with search results with an empty list of jshint warnings. Any idea how I can make those two coexist?

            --
            --
            You received this message from the "vim_use" 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

            ---
            You received this message because you are subscribed to the Google Groups "vim_use" group.
            To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
            For more options, visit https://groups.google.com/d/optout.
          • Mark Volkmann
            ... Looks like the key is to use ... to get to the previous quickfix list created by grep. -- -- You received this message from the vim_use maillist. Do not
            Message 5 of 7 , May 26, 2014
            • 0 Attachment
              On Monday, May 26, 2014 5:28:11 PM UTC-5, Mark Volkmann wrote:
              > The issue is a conflict is between grep and jshint.vim. When I search for .js files that contain a given string, it finds them, then runs jshint on the first file. It finds no issues in the file, but that replaces the quickfix list that had been populated with search results with an empty list of jshint warnings. Any idea how I can make those two coexist?

              Looks like the key is to use
              :colder
              to get to the previous quickfix list created by grep.

              --
              --
              You received this message from the "vim_use" 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

              ---
              You received this message because you are subscribed to the Google Groups "vim_use" group.
              To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
              For more options, visit https://groups.google.com/d/optout.
            • Ben Fritz
              ... Ah, so you have a plugin that runs when you open the first file, overriding your quickfix list. I have two suggestions then: 1. Use :grep! instead of :grep
              Message 6 of 7 , May 27, 2014
              • 0 Attachment
                On Monday, May 26, 2014 6:47:53 PM UTC-5, Mark Volkmann wrote:
                > On Monday, May 26, 2014 5:28:11 PM UTC-5, Mark Volkmann wrote:
                > > The issue is a conflict is between grep and jshint.vim. When I search for .js files that contain a given string, it finds them, then runs jshint on the first file. It finds no issues in the file, but that replaces the quickfix list that had been populated with search results with an empty list of jshint warnings. Any idea how I can make those two coexist?
                >
                > Looks like the key is to use
                > :colder
                > to get to the previous quickfix list created by grep.

                Ah, so you have a plugin that runs when you open the first file, overriding your quickfix list.

                I have two suggestions then:

                1. Use :grep! instead of :grep to avoid opening the first match automatically.
                2. Use ':noautocmd grep' to avoid running any plugins when the file is opened. Note this will prevent the filetype/syntax rules from loading as well, so it's probably better to use the first suggestion.

                I mainly suggest method (2) because it can be very useful with :vimgrep, especially using the ! variant :vimgrep!. It often speeds up your search. See http://vim.wikia.com/wiki/Find_in_files_within_Vim

                --
                --
                You received this message from the "vim_use" 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

                ---
                You received this message because you are subscribed to the Google Groups "vim_use" group.
                To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
                For more options, visit https://groups.google.com/d/optout.
              • LCD 47
                ... Alternatively: 3. Use :lgrep / :lvimgrep instead of :grep / :vimgrep, to put search results in a loclist, rather than in the quickfix list. 3 . Use
                Message 7 of 7 , May 27, 2014
                • 0 Attachment
                  On 27 May 2014, Ben Fritz <fritzophrenic@...> wrote:
                  > On Monday, May 26, 2014 6:47:53 PM UTC-5, Mark Volkmann wrote:
                  > > On Monday, May 26, 2014 5:28:11 PM UTC-5, Mark Volkmann wrote:
                  > > > The issue is a conflict is between grep and jshint.vim. When I
                  > > > search for .js files that contain a given string, it finds them,
                  > > > then runs jshint on the first file. It finds no issues in the
                  > > > file, but that replaces the quickfix list that had been populated
                  > > > with search results with an empty list of jshint warnings. Any
                  > > > idea how I can make those two coexist?
                  > >
                  > > Looks like the key is to use
                  > > :colder
                  > > to get to the previous quickfix list created by grep.
                  >
                  > Ah, so you have a plugin that runs when you open the first file,
                  > overriding your quickfix list.
                  >
                  > I have two suggestions then:
                  >
                  > 1. Use :grep! instead of :grep to avoid opening the first match
                  > automatically.
                  > 2. Use ':noautocmd grep' to avoid running any plugins when the file is
                  > opened. Note this will prevent the filetype/syntax rules from loading
                  > as well, so it's probably better to use the first suggestion.
                  >
                  > I mainly suggest method (2) because it can be very useful with
                  > :vimgrep, especially using the ! variant :vimgrep!. It often speeds up
                  > your search. See http://vim.wikia.com/wiki/Find_in_files_within_Vim

                  Alternatively:

                  3. Use :lgrep / :lvimgrep instead of :grep / :vimgrep, to put search
                  results in a loclist, rather than in the quickfix list.

                  3'. Use something like syntastic to run jshint checks, which
                  automatically puts check results in a loclist.

                  I personally prefer syntastic combined with Ack, which is a frontend
                  to ack, which in turn is a (much) better grep:

                  http://beyondgrep.com/

                  /lcd

                  --
                  --
                  You received this message from the "vim_use" 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

                  ---
                  You received this message because you are subscribed to the Google Groups "vim_use" group.
                  To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
                  For more options, visit https://groups.google.com/d/optout.
                Your message has been successfully submitted and would be delivered to recipients shortly.