Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

So, when you search for "foo" in mydir/, rg can find the term foo inside different places in a number of files, and then print the results like:

  mydir/myfile.java
  15: return foo;
  78: System.out.println(foo);
  123: // TODO: change foo to bar
Hyperlink support means that the line numbers (15, 78, 123) are clickable, and will open your favorite editor to that file and that line number.

That's if your terminal supports hyperlinks, or has hyperlink support enabled - most do. Depending on the terminal app it might be control/cmd click, or option-click to open the hyperlink.

Note (this got me while trying): hyperlinks are not emitted when you search inside a specific file directly, e.g. "rg foo myfile.py".



I'm fascinated! I've been living with and authoring CLI tools for about a decade now and I didn't know that there's widespread support for additional attributes on text besides styling (color, italics, underline, etc) in common terminal emulators. What a cool thing!


For the single file case, if you pass --with-filename then it should work.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: