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

124328Re: Fold the output of grep

Expand Messages
  • Marko Mahnič
    Jun 30, 2011
      On Jun 30, 4:46 am, howard Schwartz <howard...@...> wrote:
      > Here's what I would like to do: Using gnu grep (or similar one), search files
      > for some string, STRING, with the output including a context line before and
      > after each line found. That would look like:
      > filename:21: This is a context line
      > filename:22: This line contains STRING
      > filename:23: This is another context line

      The command VxOccur from the script 2606 will run grep and turn the
      above list into something like:
      21: This is a context line
      22: This line contains STRING
      23: This is another context line
      filename 2
      It will display the matches in a popup window. Then you can use the
      filter mode (press f) to narrow the results interactively. If you
      search for 'STR' you would see:
      22: This line contains STRING

      In the new (unpublished) version the 'STR' in STRING would also be

      You have to set g:vxoccur_grep_mode to 1 or 2 if you want to use grep
      (0 uses :vimgrep).
      For grep to display N context lines, add -CN to the range of files to
      search when prompted.

      VxOccur documentation:
      The script

      The preview of the next version:
      This implements the popuplist() function in C. Different algorithms
      are implemented for filtering the displayed items. They are described
      in help, see :h puls-matchers, or the file runtime/doc/popuplist.txt
      in the tar file.


      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
    • Show all 5 messages in this topic