ag

Ignore long lines in silversearcher


Right now I am using:

 ag sessions --color|cut -b1-130

But this will cause color artifacts if the search match is cut bu the cut command.

Silversearcher has this in the docs:

   --print-long-lines
          Print matches on very long lines (> 2k characters by default).

Can I change 2k to something else? (120 for me, because honestly never in any of the code I work with the real code is longer than that).


Solution

  • Very strangely, the documented --print-long-lines actually does nothing at all, yet there is a working switch for this: -W NUM / --width NUM which is not documented at all. See https://github.com/ggreer/the_silver_searcher/pull/720