Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ignore long lines in silversearcher

Tags:

ag

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).

like image 530
exebook Avatar asked Dec 29 '16 13:12

exebook


1 Answers

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

like image 158
ayoon Avatar answered Nov 01 '22 17:11

ayoon