-
Notifications
You must be signed in to change notification settings - Fork 262
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
[Request - idea] Column numbers, relative numbers and color the current column #406
Comments
Thanks for the idea. If I understand you correctly you would like to display relative column numbers for example at the top of the window? The difference to lines number is of course that there is no horizontal space available to display digits taking more than one cell. Hence you would either have to stack the column numbers vertically (probably not a good idea) or only display every 5th value or so. In any case this is probably not a feature suitable for the editor core. In the (distant) future it might be possible to do this in Lua. We would need to somehow expose the 2D cell grid to Lua. |
I've been rethinking in this recently and I was wondering if it would be possible to have only the cross I mentioned in 2016, not the relative column numbers in the headline. I don't know if it would be very difficult or not, but I guess that if already it is possible to highlight a fixed column, and the current line, It maybe be not that complicated to highlight the current column as well. |
diff --git a/vis.c b/vis.c
index 431c779..1b1912b 100644
--- a/vis.c
+++ b/vis.c
@@ -316,14 +316,16 @@ static void window_draw_cursorline(Win *win) {
CellStyle style = win->ui->style_get(win->ui, UI_STYLE_CURSOR_LINE);
Selection *sel = view_selections_primary_get(view);
size_t lineno = view_cursors_line_get(sel)->lineno;
+ size_t colno = view_cursors_col(sel) - 1;
for (Line *l = view_lines_first(view); l; l = l->next) {
if (l->lineno == lineno) {
for (int x = 0; x < width; x++) {
l->cells[x].style.attr |= style.attr;
l->cells[x].style.bg = style.bg;
}
- } else if (l->lineno > lineno) {
- break;
+ } else {
+ l->cells[colno].style.attr |= style.attr;
+ l->cells[colno].style.bg = style.bg;
}
}
} |
@TWO-FINGER Maybe I will try to update the code to allow this as an option that could be set from the visrc.lua file. |
Just like the line numbers and relative line numbers, but for columns. Along with color current line (available now) and maybe a future color column you would have a big cross pointing at the current character, and with the line and column numbers, it would be ultra fast to move around the document instead to count whites, or whatever other way you use to move around the text file.
I think it would be very handy.
Thank you for reading 😄
The text was updated successfully, but these errors were encountered: