Skip to content

line numbers only when reading file (and tty) #380

Closed
@Dieterbe

Description

@Dieterbe

Hello,
first of, ripgrep is slick. thank you very much. I have one letter of the alphabet (r) dedicated to just ripgrep. because typing rg would be too much for me. that's how much i use it. my alias actually invokes rg -j1 so that i get deterministic output (FWIW)

anyway, i know how line number printing behavior is determined by whether you're in a tty or not, and then you can still turn it on and off explicitly.

Personally, i find them a bit too annoying when i'm matching against stdin. since stdin is typically a stream, line numbers don't make sense. especially when i then want to copy paste the output to others, things can get confusing. so could we do a mode for line-numbers-only-when-tty-and-stdin or something?

If i'm the only one asking for this and/or it doesn't seem worth it, I'll learn how to live with it...

so to be clear what I mean is, if you're in a terminal

> echo -e 'a\nb\nab' | r a # i wish i had no line numbers here
1:a
3:ab
> echo -e 'a\nb\nab' > file.txt
> r a file.txt # line numbers ok here
1:a
3:ab

Thanks again. cheerios!

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionAn issue that is lacking clarity on one or more points.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions