molok / vim-smartusline

Vim plugin that changes the color of the statusbar of the focused window according with the current mode (normal/insert/replace)
34 stars 1 forks source link

Can I make modifier indicator different color? #9

Closed skeept closed 11 years ago

skeept commented 11 years ago

Hi,

I have the following settings:

set statusline=%2.2n\ %t\ %h%m%r%=%l/%L\ %2c\ %P let g:smartusline_string_to_highlight = '%2.2n %t %h%m%r'

In the picture you show as an example the modified indicator ([+]) has a different color from the rest of the text but in my case it always stays the same.

Do you know how I can make it a different color? Thank you.

molok commented 11 years ago

This is my statusline:

set statusline=\(%n\)\ %f\ %#Modified#%m%r%*\ (%l/%L,\ %c)\ %P%=%h%w\ %y\ [%{&encoding}:%{&fileformat}]\ \ 

In my colorscheme (vim-colorscheme-vombato) I have defined the Modified highlight group; :help stl

skeept commented 11 years ago

I now have

hi Modified guifg=black guibg=#FFA500 set statusline=%2.2n\ %t\ %h%#Modified#%m%r%=%l/%L\ %2c\ %P let g:smartusline_string_to_highlight = '%2.2n\ %t\ %h%#Modified#%m%r'

the hi line is copied from you colorscheme. But the plugin doesn't seem to work any more with these settings. Any idea what I am doing wrong?

molok commented 11 years ago

I think you should restore the highlight group after %r with %*, also you should probably tell smartusline to highlight only the part before the modified flag: '%2.2n %t %h', but I have not tried it. You should also not escape stuff inside single quotes. Try this:

hi Modified guifg=black guibg=#FFA500
set statusline=%2.2n\ %t\ %h%#Modified#%m%r%=%l/%L\ %2c\ %P
let g:smartusline_string_to_highlight = '%2.2n %t %h'
skeept commented 11 years ago

Thank you, your suggestion works. This is what I have now:

hi Modified guifg=black guibg=#FFA500 set statusline=%2.2n\ %t\ %h%#Modified#%m%r%*%=%l/%L\ %2c\ %P let g:smartusline_string_to_highlight = '%2.2n %t %h'