User9 colors the status line. I have applied several colors to the statusline to make it easy to recognize, but I wish this is only applied to active panes, not inactive panes. So that inactive panes has monocolor statusline, and is not too distracting. I suppose this is possible if there are two sets of
User9, one for active panes, one for inactive panes. Is there such function?
Unless I misunderstand the issue you should just use User1-5 for the active and the 6-9 for the inactive one.
For example I use the following in my update function (not complete but you should get the idea):
" active let s:a_statusline='%1* %<%f ' " ... etc. " inactive let s:na_statusline='%6* %<%f ' " ... etc. function! s:RefreshStatus() for i in range(1, winnr('$')) call setwinvar(i, '&statusline', '%!LaktakGetStatus(' . i . ')') endfor endfunction function! LaktakGetStatus(w) return a:w==winnr() ? s:a_statusline : s:na_statusline endfunction autocmd VimEnter,WinEnter,BufWinEnter * call <SID>RefreshStatus()
I will post my code as an answer to make it more visible. (Disclaimer: @laktak has included a
<SID> number, but it causes errors, and I have not understood its purpose.)
" To set the statusline for all windowss. function! RefreshStatusLine() for i in range(1, winnr('$')) call setwinvar(i, '&statusline', '%!GetStatusLine(' . i . ')') endfor endfunction " To choose the statusline for either active or inactive windowss. function! GetStatusLine(num_active_window) return a:num_active_window==winnr() ? s:active_statusline : s:inactive_statusline endfunction " First to define that for the only active windows. let s:active_statusline='%1* %F %*%2*%m%r%h%*%3* B:%n %*%4* L:%l/%L %*%5* C:%c%V %*' " Next to define those for other inactive windowss. let s:inactive_statusline=' %F %m%r%h B:%n L:%l/%L C:%c%V ' " Set the statusline whenever the active windows changes. autocmd VimEnter,WinEnter,BufWinEnter * call RefreshStatusLine() " The following lines must come after colorscheme declaration highlight User1 guifg=#ffffff guibg=#660000 highlight User2 guifg=#ffffff guibg=#990033 highlight User3 guifg=#ffffff guibg=#666600 highlight User4 guifg=#ffffff guibg=#336633 highlight User5 guifg=#ffffff guibg=#336699