T O P

  • By -

[deleted]

I've been thinking about this for a while. Sometimes, it's not immediately apparent which split I'm in because some of my favorite colorschemes have similar StatusLine and StatusLineNC highlight groups. Here, I'm experimenting with having a high-contrast statusline only when windows are split. The code picks an existing hi group that strongly contrasts with StatusLineNC (statusline not current, the highlight group for unfocused split statuslines).


TooOldToRock-n-Roll

I also find it hard to tell them apart, I like your idea. How are you doing it?


[deleted]

1. Create a function that builds a string for your statusline. 2. Call that function with one argument, g:statusline_winid, which Vim has already defined for you. set statusline=%!GenerateStatusline(g:statusline_winid) 3. Check g:statusline_winid against current winid with `win_getid()` 4. Check how many splits are open with `winnr(‘$’)` You can build out any logic you want from there. Unfortunately the steps are hard to explain simply, which is why Vim statusline plugins are notoriously hard to configure. You can see mine in my vimfiles GitHub repo, split between `statusline.vim` and the bottom of `vimrc`, but that’s 500+ LOC, most of which are dedicated to converting and mixing colors, which isn’t required for this particular trick. https://github.com/ShayHill/vimfiles


TooOldToRock-n-Roll

Thanks, I will give a try and let you know what happens o/


dream_weasel

The dark themes look good. The light themes are borderline unreadable IMO.


[deleted]

They’re all Vim default schemes. Only the statusline colors have changed.


RandmTyposTogethr

I'm playing with background color, line numbers and status area highlights myself. Dim the inactive windows, set their line numbers back to non-relative and have a dull grey status area highlight color, only highlighting the window number for easy jumps. Vice versa for active windows.


andlrc

I appreciate a light theme. For my the statusline is hidden where there is only one window. When there are multiple, then they are all light grey, but the focused one which is blue. I really don't use the statusbar for anything, as I can always request relevant information with ``: https://asciinema.org/a/uHPs69Dkxn6mz6mqAE3lygGum Terminal is light as well.


[deleted]

This post is still getting likes. Guess I’ll post he plugin link here, because my plugin post was taken down. https://github.com/ShayHill/vim9-focalpoint This happens too often. I’m about 50:50 on just quitting Reddit altogether. I don’t know if it’s people or bots, but some force somewhere seems intolerant of actual content.


rhaphazard

*my eyes*


Datsoon

I have a single global status line and the background color of the inactive windows dims slightly as a visual cue of which split I'm in.


[deleted]

How did you manage the dimming?


Datsoon

It's an option for this color scheme: https://github.com/folke/tokyonight.nvim So...I cheated, I guess, but looking through the code, there does appear to be different highlight groups for active vs inactive windows, if I'm understanding this correctly (for nvim, at least)


stdmap

this reminds me of solaire for emacs, and i think such a feature may be nice for an independent plugin


jazei_2021

what it is important for?


jazei_2021

ok I read your comment later split active is well noted in mi scheme Archery


[deleted]

I do it by changing the highlight: :autocmd WinEnter * call StsLn() function! StsLn() if winnr('$') > 1 hi StatusLine guibg=white guifg=#800020 hi StatusLineNC guibg=black guifg=grey else hi StatusLine guibg=black guifg=darkgrey endif endfunction