-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed width line numbers #544
Comments
I think this has been suggested before, but you can't determine the correct padding without reading the entire file first (which isn't going to happen), and not having the correct padding seems like a bummer to me. |
Yes, for Solution 1 one would have to first find all the matches then figure out the padding, which would slow down results. Solution 2 avoids that. One could even allow a width argument for people who know the line number limit they're going to see. That said, solution 2 isn't a complete solution. |
For a while (before it got cumbersome to use) i had a wrapper script for So... if the feature does seem interesting, i think the solution with the best effort-to-functionality ratio would probably be to just have a On a related note, i actually dislike seeing the indentation in the output. It generally doesn't convey anything useful to me when removed of its context, so my wrapper script also eliminated that. So instead of something like this:
It would give this:
That might be a peculiar preference tho |
I feel like I would prefer space-padding to zero-padding. I will confess that I was struck by a desire to line up the line numbers because the introduced difference in indentation bothered me, moreso than because I wanted to see the level of indentation. That suggests I might prefer stripping or truncating the whitespace also. I think that might be out of scope for this issue, however. |
If someone wants to do the work to thread through a |
If someone hasn't already, I'd be happy to try my hand at this as it looks like a good first issue for me. Just to clarify, the way I understand it, the requirement is as follows:
I'll begin working on it right away. |
Perhaps it's a bit too clever/unnecessary, but maybe the argument to Not sure it's really important to be able to specify the padding character at all, but having a whole separate option for it seems a bit over-kill somehow. The rest sounds right tho |
I definitely don't want two flags for this. I like @okdana's idea to use printf style. |
@balajisivaraman Otherwise, I think your plan sounds pretty good to me! |
For those who found this issue ranked first on google and wonder where this feature is: it was removed a couple of months later in #795 |
It would be nice to be able to see the indentation level of searched text line up. One way to do this would be to have fixed width line numbers in search results. This could be accomplished through an option flag and left-padding with either spaces or zeroes when the flag is active.
As this is primarily of interest for matches within a file, only the matches within a file need be considered for how wide the line numbers should be. Alternatively, one could have a pre-determined width (i.e. 6) and overflow larger line numbers.
Implemented, this could look either like this:
Or like this:
The text was updated successfully, but these errors were encountered: