vip

VI Plus
git clone https://codeberg.org/night0721/vip
Log | Files | Refs | README | LICENSE

commit 23f1a2ab8a39b5400f665791560cc9584813588b
parent 171a43d2ac3361e21cef2bfe3890779ba211b9ca
Author: night0721 <[email protected]>
Date:   Mon,  1 Jul 2024 02:48:04 +0100

edit bar to look like catpuccin

Diffstat:
Mbar.c | 32+++++++++++++++++++++++---------
1 file changed, 23 insertions(+), 9 deletions(-)

diff --git a/bar.c b/bar.c @@ -10,20 +10,34 @@ extern editor vip; void draw_status_bar(struct abuf *ab) { abAppend(ab, "\x1b[7m", 4); - char status[80], rstatus[80]; - int len = snprintf(status, sizeof(status), "NORMAL | %.20s", + abAppend(ab, "\x1b[1m", 4); + abAppend(ab, "\x1b[38;2;137;180;250m", 19); + + char mode[9] = " NORMAL "; + int mode_len = 8; + abAppend(ab, mode, 8); + + char file[80], lines[80]; + int file_len = snprintf(file, sizeof(file), " %.20s ", vip.filename ? vip.filename : "[No Name]"); - int rlen = snprintf(rstatus, sizeof(rstatus), "%dL | %d:%d", vip.rows, + int lines_len = snprintf(lines, sizeof(lines), "%dL | %d:%d", vip.rows, vip.cy + 1, vip.rx + 1); - if (len > vip.screencols) len = vip.screencols; - abAppend(ab, status, len); - while (len < vip.screencols) { - if (vip.screencols - len == rlen) { - abAppend(ab, rstatus, rlen); + + abAppend(ab, "\x1b[38;2;49;50;68m", 16); + abAppend(ab, "\x1b[22m", 5); + abAppend(ab, "\x1b[48;2;137;180;250m", 19); + abAppend(ab, file, file_len); + abAppend(ab, "\x1b[38;2;0;0;0m", 13); + + + while (file_len < vip.screencols) { + if (vip.screencols - mode_len - file_len == lines_len) { + abAppend(ab, "\x1b[48;2;255;255;255m", 19); + abAppend(ab, lines, lines_len); break; } else { abAppend(ab, " ", 1); - len++; + file_len++; } } abAppend(ab, "\x1b[m", 3);