Skip to content
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

Specify color setting of column number #377

Closed
ShikChen opened this issue Feb 23, 2017 · 12 comments
Closed

Specify color setting of column number #377

ShikChen opened this issue Feb 23, 2017 · 12 comments
Labels
question An issue that is lacking clarity on one or more points.

Comments

@ShikChen
Copy link

Currently (0.4.0) the --colors option only supports types path, line and match. There is no way to specify the color of column number now. So when using with --column, the column part is uncolored and has the same style of matching line, which is a little unpleasant.

@BurntSushi
Copy link
Owner

@ShikChen Out of curiosity, what do you use the column information for?

@ShikChen
Copy link
Author

I use it for vim, which needs the column information to jump into exact location. The above statement is also true for option --vimgrep. More precisely, I use it with fzf.vim.

@BurntSushi
Copy link
Owner

@ShikChen Sorry, I wasn't clear. Color information is for humans. What do you use the column information for? I understand that automated tools may read it to do useful things, but automated tools don't need colors.

@ShikChen
Copy link
Author

But I will see the column information in the UI of fzf.vim, if I want to jump with exact location. When the matching line starts without indent (white spaces), my eyes cannot easily parse boundary between the column number and matching line, especially when that line is starting with numbers.

I agree that most of time we don't need line/column numbers. But it's still possible that someone is manipulating tabular data like csv, and need line/column information to distinguish between multiple matches.

I can understand if you decide not to add color to column number. The default search tool in fzf is Ag, which doesn't support it either. Nobody complains about that so maybe I am too sensitive.

Inspired from your comment, now I have some vimscripts that hiding the line/column part in fzf.

@BurntSushi BurntSushi added the question An issue that is lacking clarity on one or more points. label Feb 24, 2017
@BurntSushi
Copy link
Owner

FWIW, I do actually think line numbers are useful to be able to read because it helps orient our minds to where something is in a file (and possibly relative to other things as well). But column numbers seem less useful since lines are generally pretty short and the matches themselves are highlighted with color.

I'll leave this open for now and mull on it some more.

@ShikChen
Copy link
Author

ShikChen commented Mar 2, 2017

I found another scenario that I want the column number recently, although it's a little complex and weird. I have mapped a hotkey in vim to search the current word under the cursor in ripgrep with fzf, and I can interactively filter the results in fzf. I sometimes use the column number as filter. For example, when tracing the code of Bash, I use the column number :1: to select the function definition. (I know that I can use ^ to match the prefix in normal ripgrep/fzf usage, but it's just harder to use in my scenario.)

kpp added a commit to kpp/ripgrep that referenced this issue Mar 30, 2017
@kpp
Copy link
Contributor

kpp commented Mar 31, 2017

The case of reading columns is -o flag.

Image of example

There is only one possibility to differ on bar from another bar if they are both on the same line.

@BurntSushi
Copy link
Owner

@kpp That is interesting, and I think I buy that use case. However, if --only-matching only shows the matched portion of the line and both the match and the line number are colored, the column number will actually be distinct even though it's not specifically colorized.

@kpp
Copy link
Contributor

kpp commented Mar 31, 2017

How about --colors=match:none?

@BurntSushi
Copy link
Owner

Seems contrived to me.

@kpp
Copy link
Contributor

kpp commented Mar 31, 2017

How about echo -e "foo\nfoo\n1:bar" | rg foo -n -A1 --column?

@kpp
Copy link
Contributor

kpp commented Mar 31, 2017

@BurntSushi An options is to reset column color by default, but let users to control it if they want to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question An issue that is lacking clarity on one or more points.
Projects
None yet
Development

No branches or pull requests

3 participants