0

I'm trying to format my statusline in macvim. The formatting works fine, and the status line reflects the following code (stored at ~/.vimrc), but not in regard to the color settings. It displays as default color until i :so ~/.vimrc after which everything is as it should be.

What's the problem?

set laststatus=2

hi statusline       guibg=#ffaa00   guifg=#000000

hi StatusLineLeft   guibg=#ffaa00   guifg=#000000
hi StatusLineRight  guibg=#000000   guifg=#ffaa00
hi StatusLineWrap   guibg=#000000   guifg=#ff4400
hi StatusLineGrey   guibg=#000000   guifg=#444444

set statusline=
set statusline+=%#StatusLineLeft#
set statusline+=%.28F      " Path to the file
set statusline+=\           " just a space
set statusline+=%#StatusLineRight#
set statusline+=%=        " Switch to the right side
set statusline+=%#StatusLineGrey#
set statusline+=\ [%b][0x%B]\   " byte under the curror
set statusline+=%#StatusLineRight#
set statusline+=%l        " Current line
set statusline+=/         " Separator
set statusline+=%L        " Total lines
coryknapp
  • 69
  • 4
  • What colorscheme do you use and where is it called relatively to the snippet in your question? – romainl Oct 01 '14 at 06:01
  • @romainl I use solarized, which i was setting before the statusline stuff, but the problem persists even on my trimmed down example. – coryknapp Oct 01 '14 at 18:44
  • Solarized is the culprit: something in how it is written makes it kick in *after* all or most of your plugins *even* if you call it at the top of your vimrc, annihilating all your custom highlight groups in the process. That colorscheme is really a steaming pile of pseudo-scientific crap. You could try to put your highlight groups — and maybe your `statusline` — in an `/after/plugin/mystatusline.vim`. Or drop that horror. – romainl Oct 01 '14 at 19:55
  • I tried solarized for a while and I think I remember having success putting all such highlight commands in a ColorScheme autocmd. – Ben Oct 02 '14 at 02:34

1 Answers1

0

A colorscheme resets all existing highlight definitions, so any additional ones (like the :hi commands for your custom statusline) must come after the :colorscheme command.

Ingo Karkat
  • 167,457
  • 16
  • 250
  • 324