Al Berger
Al Berger

Reputation: 1068

Configuring status line in Vim (gVim)

I have configured the status line in Vim (gVim, to be more precise) so that when there are more than one window open, the status line in the active window is colored, and in other windows are grayed out:

function! WinEnterStatuslineColor()
    setlocal statusline=%1*[%3*%{Usid()}%1*]:%n:\ %2*%F%1*%m%r%h%w\ [%Y,%{strlen(&fenc)?&fenc:&enc},%{&fileformat}]%=%l(%L):%v[%p%%]
endfunction

function! WinLeaveStatuslineColor()
    setlocal statusline=%4*[%6*%{Usid()}%4*]:%n:\ %5*%F%4*%m%r%h%w\ [%Y,%{strlen(&fenc)?&fenc:&enc},%{&fileformat}]%=%l(%L):%v[%p%%]
endfunction

au WinEnter * call WinEnterStatuslineColor()
au WinLeave * call WinLeaveStatuslineColor()

fun! Usid()
    let usname=system('echo $(whoami)')
    let pair = split(usname)
    return pair[0]
endf

hi User1 ctermbg=green ctermfg=red   guifg=white guibg=green
hi User2 ctermbg=red   ctermfg=blue  guifg=yellow   guibg=green gui=bold
hi User3 ctermbg=blue  ctermfg=green guifg=#80ccff  guibg=green gui=bold
hi User4  gui=NONE ctermbg=green ctermfg=red  guifg=#808080 guibg=#bcbcbc 
hi User5  gui=NONE ctermbg=red   ctermfg=blue guifg=#808080   guibg=#bcbcbc 
hi User6  gui=NONE ctermbg=blue  ctermfg=green guifg=#808080  guibg=#bcbcbc 

However, there is one little tweaking I cannot manage to achieve: in non-active status lines all letters become rendered in bold font, and I want that non-active status lines are rendered in the regular non-bold font. Is there a way to do this? (I'm on Arch Linux, if this matters.)

Upvotes: 0

Views: 998

Answers (1)

Kent
Kent

Reputation: 195249

This is very likely to do with your statuslineNC hi group.

Make sure that in that group you have cterm=NONE gui=NONE. You can check the current value: hi statuslineNC

clean it: hi clear statuslinenc

overwrite it hi! statuslineNC foo=bar ...

I'm on Archlinux too, it doesn't matter.

Upvotes: 2

Related Questions